This commit is contained in:
Roman Pushkin 2021-08-15 18:43:37 -07:00
parent 7a56ca4e61
commit d2d670b991

View file

@ -878,3 +878,8 @@ books = [
This data has sequential nature, and looking up an object takes _linear time_ - in other words, the only way to go is to iterate and compare isbn to get the right one.
However, when books are represented as hash (second block), ids are the hash key. There is no specific order (well, in Ruby language there is an order for convenience, but normally hash data structure has no order), but knowing how hashes work allows us to do quick search in _constant time_. We do not explain how exactly hashes achieve this performance, it's not the purpose of this book. However, we highly encourage to read up on that, the algorithm is simple enough and quite interesting.
075
===
Skip for now