Question
Exercise 3.5 You must keep track of some data. Your options are: ( 1) A linked-list maintained in sorted order. (2) A linked-list of unsorted
Exercise 3.5 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. Answer: (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. Answer: (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. Answer: (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. Answer:
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started