Skip to content
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

Open
wants to merge 3 commits into
base: master
Choose a base branch
from

Conversation

afinawalton
Copy link

No description provided.

Copy link

@kyra-patton kyra-patton left a 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;

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

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

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

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) {

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!");

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!");

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() {

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) {

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

✨Awesome work!

kyra-patton added a commit that referenced this pull request May 5, 2022
add instructions directly to readme
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants