Ian's DBC SF Firecrackers Blog

Big O Complexity

Throughout Phase 0, we've explored two main approaches to storing large amounts of data: arrays and hash tables. However as the amoung of data grows, the runtime grows with it, so many other storage approaches exist to mitigate the time complexity. That's were "Big O notation" comes in. For searching an array or linked list, the complexity is O(n), meaning that for a list that has 1000000 elements, the expected search time is 1000 longer than a list with 1000 elements.

Now to greatly reduce that rising runtime cost, you could use something like a binary search tree. It is similar to a linked list in that each playload data element is stored in it's own node, but the nodes could be connected to up to 3 other nodes: it's parent, a left, and a right. How the nodes are populated have searching in mind (hence the name) by using a comparison. Because the growth of the tree spatially gets more complex by powers of 2, the time complexity is O(log(n)), meaning the runtime only grows logarithmically with linear growth.