|
|
|
|
|
by tptacek
4788 days ago
|
|
The list and the tree don't themselves have time complexity; operations on them do. Finding an element in a list takes O(n) time; in the worst case, you have to check every element of the list. Finding an element in a balanced binary tree takes O(log n) time: at each step, you halve the number nodes you need to check. The balanced binary tree search operation is an example of something whose cost grows very slowly even as the size of the tree grows rapidly. There are algorithms that are hard the same way the O(log n) tree is easy: they grow exponentially with the size of input, so very small changes in the input size can drastically increase their cost. |
|