From 0a91335140ef49224677e17eeb947b5e058d7c15 Mon Sep 17 00:00:00 2001 From: Bill Graham Date: Sun, 29 Dec 2024 15:20:17 -0800 Subject: [PATCH] docs: clarify more about the binary heap (#102) --- mini-lsm-book/src/week1-02-merge-iterator.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/mini-lsm-book/src/week1-02-merge-iterator.md b/mini-lsm-book/src/week1-02-merge-iterator.md index 1de4ea0..550ba6a 100644 --- a/mini-lsm-book/src/week1-02-merge-iterator.md +++ b/mini-lsm-book/src/week1-02-merge-iterator.md @@ -66,7 +66,7 @@ src/iterators/merge_iterator.rs Now that you have multiple memtables and you will create multiple memtable iterators. You will need to merge the results from the memtables and return the latest version of each key to the user. -`MergeIterator` maintains a binary heap internally. Note that you will need to handle errors (i.e., when an iterator is not valid) and ensure that the latest version of a key-value pair comes out. +`MergeIterator` maintains a binary heap internally. You'll see that the ordering of the binary heap is such that the iterator with the lowest head key value is first. When multiple iterators have the same head key value, the newest one is first. Note that you will need to handle errors (i.e., when an iterator is not valid) and ensure that the latest version of a key-value pair comes out. For example, if we have the following data: