70 likes | 147 Views
Data Structures. 1-D arrays, linearly-linked lists and binary search trees. Overview. This slide show discusses 1-D arrays and compares them with two sorts of linked list, linearly linked lists and binary search trees in regard to their properties in relation to (a) insertion,
E N D
Data Structures 1-D arrays, linearly-linked lists and binary search trees
Overview This slide show discusses 1-D arrays and compares them with two sorts of linked list, linearly linked lists and binary search trees in regard to their properties in relation to (a) insertion, (b) deletion and (c) searching.
1-D arrays • Can’t dynamically grow and shrink. (-) • Difficult to insert and delete. (-) • Extraordinarily good searching of sorted arrays, of the order of log2n where n is the number of elements in the array. (+)
Linear linked lists • Can grow and shrink dynamically.(+) • Easy to insert and delete. (+) • Extremely bad search time, making them useless if used to provide long lists. (-)
Binary Search Trees • Can grow and shrink dynamically. (+) • Easy to insert and delete. (+) • Easy to search, even for extremely long lists. (+)
Conclusion Binary search trees come out on tops as having all the advantages and none of the disadvantages. Now go to the last slide to see the summary sheet.