Computer Science EngineeringHard
The textbook minimum number of stacks needed to implement a queue is
- A. 1
- B. 3
- C. 2
- D. 4
Correct answer: C. 2
One stack receives enqueued items and the other reverses them for dequeue operations.
Practise more Algorithms, Data Structures & Programming (ISRO CS) questionsAlgorithms, Data Structures & Programming (ISRO CS): notes and key points
More Algorithms, Data Structures & Programming (ISRO CS) questions
- In a binary search tree, the inorder successor of a node that has a non-empty right subtree is
- Keys 50, 30, 70, 20, 40, 60, 80 are inserted into an empty BST in this order. The postorder traversal is
- A directed acyclic graph has n vertices. How many strongly connected components does it have?
- What is the minimum number of coins needed to make 11 using denominations {1, 5, 6, 9}?
- Huffman coding is applied to frequencies 5, 9, 12, 13, 16, 45. What is the total weighted path length (sum of internal node weights)?
- What is the Theta bound of: for(i=1;i<=n;i++) for(j=1;j<=n;j=2) count++;