Ask 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

+3
Answers (1)
  1. 4 November, 16:33
    0
    Question was incomplete and continued the question

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

    BST

    Sorted Array

    Un-sorted Array

    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.

    Explanation:

    Answer for a: Un-sorted array or Un-sorted linked list : as mentioned in the question itself that the records are arriving in the sorted order and search will not be O (log n) and insert will be not be O (n).

    Answer for b : Un-sorted array or Un-sorted linkedlist : Number of the items to be inserted is already known which is 1,000,000 but it is very high and at the same time search is low. Unsorted array or Unsorted linked list will be best option here.
Know the Answer?
Not Sure About the Answer?
Find an answer to your 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. ...” in 📗 Computers & Technology if the answers seem to be not correct or there’s no answer. Try a smart search to find answers to similar questions.
Search for Other Answers