Question: Question about Data Structure Implement & Analysis (C++) 1. Suppose we want to implement a Priority Queue. In lecture, we explored using a std::vector in

Question about Data Structure Implement & Analysis (C++)

Question about Data Structure Implement & Analysis (C++) 1. Suppose we want

1. Suppose we want to implement a Priority Queue. In lecture, we explored using a std::vector in a few ways: unsorted, sorted, and as a heap. Suppose I wish to store the underlying data as an AVL Tree. (a) For each of the fundamental operations of a PriorityQueue, explain briefly how you would implement it with an AVL Tree. Each should take you 1-2 sentences at most; you do not need to write full code. If something is a standard AVL tree operation, such as a re-balance, you need only refer to it. You do not need to re-write the description. Then, state how long these will take to run. The last one is done for you as an example (only because last instead of first will fit better into a Gradescope outline). i. extractMino: ii. insert ii. min() : We could follow left pointers from the root until a node does not have a left pointer. That is the min. This takes O(log n) time because the AVL Tree has (log n) depth. (b) Is this better or worse than a heap, as shown in lecture? Why or why not? You need only a brief explanation for why you said yes or no

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!