Skip to content

Commit f14c133

Browse files
authored
Merge pull request kodecocodes#313 from rzaccone/master
I created an Xcode project with my changes. It makes it easier to
2 parents 6af54b0 + 733487f commit f14c133

File tree

14 files changed

+164654
-0
lines changed

14 files changed

+164654
-0
lines changed

Trie/ReadMe.md

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -162,3 +162,13 @@ Let n be the length of some value in the `Trie`.
162162
See also [Wikipedia entry for Trie](https://en.wikipedia.org/wiki/Trie).
163163

164164
*Written for the Swift Algorithm Club by Christian Encarnacion. Refactored by Kelvin Lau*
165+
166+
# Changes by Rick Zaccone
167+
168+
* Added comments to all methods
169+
* Refactored the `remove` method
170+
* Renamed some variables. I have mixed feelings about the way Swift infers types. It's not always apparent what type a variable will have. To address this, I made changes such as renaming `parent` to `parentNode` to emphasize that it is a node and not the value contained within the node.
171+
* Added a `words` property that recursively traverses the trie and constructs an array containing all of the words in the trie.
172+
* Added a `isLeaf` property to `TrieNode` for readability.
173+
* Implemented `count` and `isEmpty` properties for the trie.
174+
* I tried stress testing the trie by adding 162,825 words. The playground was very slow while adding the words and eventually crashed. To fix this problem, I moved everything into a project and wrote `XCTest` tests that test the trie. There are also several performance tests. Everything passes.

0 commit comments

Comments
 (0)