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

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 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.

Fantastic news! We've Found the answer you've been seeking!

Step by Step Answer:

Question Posted: