Question: Data Structure Selection. You must keep track of some data items. Your options are: A singly linked list. Upon insertion the list is searched so
Data Structure Selection.
You must keep track of some data items. Your options are:
- A singly linked list. Upon insertion the list is searched so the item can be placed in the proper location to maintain sorted order.
- A binary search tree.
For the following scenarios which of these options is best? Justify your selection.
- The items arrive with values having a uniform random distribution. n insertions are performed, followed by lg n searches.
- The items are guaranteed to arrive already sorted from highest to lowest (i.e., whenever an item is inserted, its key value will always be less than that of the last record inserted). A total of n insertions are performed, followed by lg n searches.
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
