Which data structure (Array or B+ tree) is best for the fowllowing scenario in memory?
A file is containing sorted numbers (around 1024 numbers in file).
-
we have to put all numbers in a data structure.
-
one search operation.
i know searching an array with binary search is O(log n).but building an array is fast than B+ tree.
But dont know about the search operation of B+tree ?
Searching through a B+ tree is of O(log n) as well.
If you just need to search through a list of sorted numbers, then an array would be your best bet, especially if you are not planning to insert/delete numbers from the list.