We’ve seen that binary trees boast efficiencies of O(log N) for search, insertion, and deletion, making it an efficient choice for scenarios in which we need to store and manipulate ordered data. This is particularly true if we will be modifying the data often, because while ordered arrays are just as fast as binary trees when searching data, binary trees are significantly faster when it comes to inserting and deleting data.
For example, let’s say that we’re creating an application that maintains a list of book titles. We’d want our application to have the following functionality:
Our program should be able to print out the list of book titles in alphabetical order.
Our program should allow for constant changes to the ...