For small dataset (less than 200 elements), why is unsorted array has better performance than binary tree? This wasn't the case 20 years ago. (Hint: It has to do with computer architecture.)
bt is maintained by linked list, which does not guarantee contiguous memory allocation. While array is contiguous, if the memory for the array is small, which can be allocated on one page. So less cache miss
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment