Problem 2
How long would it take to remove the
Problem 3
Show that, given only the less-than operator (
Problem 7
An airport is developing a computer simulation of air-traffic control that handles events such as landings and takeoffs. Each event has a time-stamp that denotes the time when the event occurs. The simulation program needs to efficiently perform the following two fundamental operations: • Insert an event with a given time-stamp (that is, add a future event) • Extract the event with smallest time-stamp (that is, determine the next event to process) Which data structure should be used for the above operations? Why?
Problem 8
Although it is correct to use a "reverse" comparator with our priority queue
ADT so that we retrieve and remove an element with the maximum key each time,
it is confusing to have an element with the maximum key returned by a function
named "removeMin." Write a short adapter class that can take any priority
queue
Problem 9
Illustrate the performance of the selection-sort algorithm on the following input sequence: (22,15,36,44,10,3,9,13,29,25).
Problem 11
Give an example of a worst-case sequence with
Problem 14
Illustrate the performance of the heap-sort algorithm on the following input sequence: (2,5,16,4,10,23,39,18,26,15)
Problem 15
Let
Problem 19
Let
Problem 20
Show that the sum