Question: You must keep track of some data. Your options are: (1) A linked-list maintained in sorted order. (2) A linked-list of unsorted records. (3) A

You must keep track of some data. Your options are:

(1) A linked-list maintained in sorted order.

(2) A linked-list of unsorted records.

(3) A binary search tree.

(4) An array-based list maintained in sorted order.

(5) An array-based list of unsorted records.

For each of the following scenarios, which of these choices would be best?
Explain your answer.

(a) The records are guaranteed to arrive already sorted from lowest to highest (i.e., whenever a record is inserted, its key value will always be greater than that of the last record inserted). A total of 1000 inserts will be interspersed with 1000 searches.

(b) The records arrive with values having a uniform random distribution (so the BST is likely to be well balanced). 1,000,000 insertions are performed, followed by 10 searches.

(c) The records arrive with values having a uniform random distribution (so the BST is likely to be well balanced). 1000 insertions are interspersed with 1000 searches.

(d) The records arrive with values having a uniform random distribution (so the BST is likely to be well balanced). 1000 insertions are performed, followed by 1,000,000 searches.

Step by Step Solution

3.30 Rating (153 Votes )

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock

a For this scenario an arraybased list maintained in sorted order would be the most suitable Since the records are guaranteed to arrive already sorted ... View full answer

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 Practical Introduction To Data Structures Questions!