InterviewSolution
Saved Bookmarks
| 1. |
Write an algorithm to insert an element into circular queue. |
|
Answer» 1) Create an empty stack S. 2) Initialize current node as root 3) Push the current node to S and SET current = current->left until current is NULL 4) If current is NULL and stack is not empty then a) Pop the top ITEM from stack. b) Print the popped item, set current = popped_item->right C) Go to step 3. 5) If current is NULL and stack is empty then we are done. |
|