-
Notifications
You must be signed in to change notification settings - Fork 8
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
C16 - Cedar - Afina Walton #1
base: master
Are you sure you want to change the base?
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nice work Afina! Let me know what questions you have.
🟢
} | ||
} | ||
|
||
return; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
✨Nice iterative solution!
find(key) { | ||
throw new Error("This method hasn't been implemented yet!"); | ||
// compare keys |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
✨
while (current) { | ||
if (key === current.key) return current.value; | ||
else if (key < current.key) { | ||
if (!current.left) return null |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is this necessary?
if (!current.left) return null | ||
current = current.left; | ||
} else if (key > current.key) { | ||
if (!current.right) return null |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Same goes here - do you need this line? Think about why you might not need it! 🤠
} | ||
|
||
// Time Complexity: ? | ||
// Space Complexity: ? | ||
createNodeObject(node) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🧡 Love this helper function
inorder() { | ||
throw new Error("This method hasn't been implemented yet!"); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
✨
preorder() { | ||
throw new Error("This method hasn't been implemented yet!"); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
✨
} | ||
|
||
// Time Complexity: O(n) | ||
// Space Complexity: O(n) | ||
postorder() { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
✨
throw new Error("This method hasn't been implemented yet!"); | ||
// Time Complexity: O(n) | ||
// Space Complexity: O(1) | ||
height(root = this.root) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
✨Awesome work!
add instructions directly to readme
No description provided.