diff --git a/assets/imgs/compressed/Untitled-2023-07-28-1312.png b/assets/imgs/compressed/Untitled-2023-07-28-1312.png new file mode 100644 index 0000000..9be140b Binary files /dev/null and b/assets/imgs/compressed/Untitled-2023-07-28-1312.png differ diff --git a/assets/imgs/compressed/call-stack.png b/assets/imgs/compressed/call-stack.png index c35a88e..ffbbe30 100644 Binary files a/assets/imgs/compressed/call-stack.png and b/assets/imgs/compressed/call-stack.png differ diff --git a/assets/imgs/compressed/client-server.png b/assets/imgs/compressed/client-server.png index db5d486..8ea98f6 100644 Binary files a/assets/imgs/compressed/client-server.png and b/assets/imgs/compressed/client-server.png differ diff --git a/assets/imgs/compressed/cover.jpg b/assets/imgs/compressed/cover.jpg index 46a3958..1c1bbc5 100644 Binary files a/assets/imgs/compressed/cover.jpg and b/assets/imgs/compressed/cover.jpg differ diff --git a/assets/imgs/compressed/elysia-claim.png b/assets/imgs/compressed/elysia-claim.png index 99da362..7ca88e0 100644 Binary files a/assets/imgs/compressed/elysia-claim.png and b/assets/imgs/compressed/elysia-claim.png differ diff --git a/assets/imgs/compressed/hello-world.png b/assets/imgs/compressed/hello-world.png index a47916a..6591760 100644 Binary files a/assets/imgs/compressed/hello-world.png and b/assets/imgs/compressed/hello-world.png differ diff --git a/assets/imgs/compressed/idle_memory.png b/assets/imgs/compressed/idle_memory.png index c228942..1aa5e4d 100644 Binary files a/assets/imgs/compressed/idle_memory.png and b/assets/imgs/compressed/idle_memory.png differ diff --git a/assets/imgs/compressed/intellisense.png b/assets/imgs/compressed/intellisense.png index 4756704..c229473 100644 Binary files a/assets/imgs/compressed/intellisense.png and b/assets/imgs/compressed/intellisense.png differ diff --git a/assets/imgs/compressed/latency_2.png b/assets/imgs/compressed/latency_2.png index bd8f8e7..7db966a 100644 Binary files a/assets/imgs/compressed/latency_2.png and b/assets/imgs/compressed/latency_2.png differ diff --git a/assets/imgs/compressed/latency_without_max.png b/assets/imgs/compressed/latency_without_max.png index d06cfd1..fbcecb6 100644 Binary files a/assets/imgs/compressed/latency_without_max.png and b/assets/imgs/compressed/latency_without_max.png differ diff --git a/assets/imgs/compressed/max_latency.png b/assets/imgs/compressed/max_latency.png index 5b5ecdf..5f613df 100644 Binary files a/assets/imgs/compressed/max_latency.png and b/assets/imgs/compressed/max_latency.png differ diff --git a/assets/imgs/compressed/mem_const_load.png b/assets/imgs/compressed/mem_const_load.png index 8a929a9..4138dc4 100644 Binary files a/assets/imgs/compressed/mem_const_load.png and b/assets/imgs/compressed/mem_const_load.png differ diff --git a/assets/imgs/compressed/mem_const_load_2.png b/assets/imgs/compressed/mem_const_load_2.png index bd2a7cc..d609e70 100644 Binary files a/assets/imgs/compressed/mem_const_load_2.png and b/assets/imgs/compressed/mem_const_load_2.png differ diff --git a/assets/imgs/compressed/mem_idle_2.png b/assets/imgs/compressed/mem_idle_2.png index 164f4d2..cd32e1e 100644 Binary files a/assets/imgs/compressed/mem_idle_2.png and b/assets/imgs/compressed/mem_idle_2.png differ diff --git a/assets/imgs/compressed/modular-function-ch6.png b/assets/imgs/compressed/modular-function-ch6.png index 4e9bd7c..cb2a4ac 100644 Binary files a/assets/imgs/compressed/modular-function-ch6.png and b/assets/imgs/compressed/modular-function-ch6.png differ diff --git a/assets/imgs/compressed/next.png b/assets/imgs/compressed/next.png index 11ced17..70f2413 100644 Binary files a/assets/imgs/compressed/next.png and b/assets/imgs/compressed/next.png differ diff --git a/assets/imgs/compressed/prev.png b/assets/imgs/compressed/prev.png index 9a2396e..9a5e174 100644 Binary files a/assets/imgs/compressed/prev.png and b/assets/imgs/compressed/prev.png differ diff --git a/assets/imgs/compressed/referer.png b/assets/imgs/compressed/referer.png index be35886..af19821 100644 Binary files a/assets/imgs/compressed/referer.png and b/assets/imgs/compressed/referer.png differ diff --git a/assets/imgs/compressed/rps.png b/assets/imgs/compressed/rps.png index 5730b19..99ea101 100644 Binary files a/assets/imgs/compressed/rps.png and b/assets/imgs/compressed/rps.png differ diff --git a/assets/imgs/compressed/rps_2.png b/assets/imgs/compressed/rps_2.png index ed8deb6..345a309 100644 Binary files a/assets/imgs/compressed/rps_2.png and b/assets/imgs/compressed/rps_2.png differ diff --git a/assets/imgs/compressed/trie-eow.png b/assets/imgs/compressed/trie-eow.png new file mode 100644 index 0000000..7cf4d1c Binary files /dev/null and b/assets/imgs/compressed/trie-eow.png differ diff --git a/assets/imgs/compressed/trie-overview.png b/assets/imgs/compressed/trie-overview.png new file mode 100644 index 0000000..1907614 Binary files /dev/null and b/assets/imgs/compressed/trie-overview.png differ diff --git a/assets/imgs/compressed/user-agent.png b/assets/imgs/compressed/user-agent.png index fab5ecd..45ed8d3 100644 Binary files a/assets/imgs/compressed/user-agent.png and b/assets/imgs/compressed/user-agent.png differ diff --git a/chapters/ch07.0-ex-implementing-a-trie.md b/chapters/ch07.0-ex-implementing-a-trie.md index 6d6586c..56486d5 100644 --- a/chapters/ch07.0-ex-implementing-a-trie.md +++ b/chapters/ch07.0-ex-implementing-a-trie.md @@ -1,6 +1,6 @@ [![Read Prev](/assets/imgs/prev.png)](/chapters/ch06.4-the-need-for-a-trie.md) -# Exercise - Implementing a `Trie` +# Exercises - Implementing a `Trie` > This exercise will motivate you to work on implementing your solution independently. Once you have completed the exercise, you can move on to the next challenge or read the solution to find a different approach. > @@ -25,9 +25,7 @@ The Trie starts with a root node that doesn't hold any character. It serves as t ``` - **Level 1**: You have the characters "O", "T", and "C" branching from the root node. - - **Level 2 and Beyond**: These nodes further branch out to form the words. - - "O" branches to "K", completing the word "OK". - "T" branches to "O", completing the word "TO". - "C" branches to "A" and "U": @@ -53,15 +51,12 @@ In this first challenge, your task is to implement a Trie data structure with on ### Requirements 1. Create a class called `Trie`. - 2. Implement an `insert(word)` method that takes a string `word` and inserts it into the Trie. ### More details 1. **Initialization**: You'll begin with a root node. This node will be the starting point for all word insertions, and it won't store any character itself. - 2. **Traversal**: For each character in the word you want to insert, you'll traverse the Trie from the root node, going as far down as the current character sequence allows. - 3. **Node Creation**: If a character in the word doesn't match any child node of the current node: - Create a new node for that character.