Answer to Question #45494 in Other Programming & Computer Science for Naf

Question #45494
1. The following code fragment operates on a stack S initially empty. What is the output of this code fragment? S.push(2); S.push(4); S.push(6); S.push(8); while (! S.isEmpty() ) System.out.println(S.pop()); 2. The following code fragment operates on a queue Q initially empty. What is the output of this code fragment? Q.enqueue(2); Q.enqueue(4); Q.enqueue(6); Q.enqueue(8); while (! Q.isEmpty() ) System.out.println(Q.dequeue()); 3. i) Describe in detail (using pseudocode) the implementation of a priority queue based on a sorted array. Show that your implementation achieves O(1) for operations min and removeMin, and O(n) for insertions. ii) Explain in a high-level way as well as in pseudo code how the removeMin operation works in a min-heap. iii). Explain in a high-­level way and also using pseudo-­code how to insert a key into a hash table that uses linear probing for collisions. Assume the hash table is implemented using an array.
1
Expert's answer

Not answered

Need a fast expert's response?

Submit order

and get a quick answer at the best price

for any assignment or question with DETAILED EXPLANATIONS!

Comments

No comments. Be first!

Leave a comment

Ask Your question

LATEST TUTORIALS
New on Blog
APPROVED BY CLIENTS
paypal