-
Notifications
You must be signed in to change notification settings - Fork 11
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
Earth - Emily #3
base: master
Are you sure you want to change the base?
Conversation
…ion implemented. This is PR is only a first draft
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.
The methods you have so far work, and work, although you don't have time/space complexity. I'm looking forward to the height function going forward.
lib/tree.js
Outdated
@@ -12,34 +12,169 @@ class Tree { | |||
this.root = null; | |||
} | |||
|
|||
addHelper(value) { |
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.
You don't seem to be using this function.
this.addHelper(this.root, newNode); | ||
} | ||
} | ||
|
||
// Time Complexity: ? | ||
// Space Complexity: ? | ||
add(key, value) { |
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.
👍 but time/space complexity?
// } else { | ||
// this.addHelper(key.right, newNode); | ||
// } | ||
// }; | ||
} | ||
|
||
// Time Complexity: ? | ||
// Space Complexity: ? | ||
find(key) { |
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.
👍 but time/space complexity?
} | ||
} | ||
|
||
return null; | ||
} | ||
|
||
// Time Complexity: ? | ||
// Space Complexity: ? | ||
inorder() { |
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.
👍 but time/space complexity?
value: current.value | ||
}); | ||
|
||
this.inorderHelper(current.right, values); | ||
} | ||
|
||
// Time Complexity: ? | ||
// Space Complexity: ? | ||
preorder() { |
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.
👍 but time/space complexity?
}); | ||
|
||
this.preorderHelper(current.left, values); | ||
this.preorderHelper(current.right, values); | ||
} | ||
|
||
// Time Complexity: ? | ||
// Space Complexity: ? | ||
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.
👍 but time/space complexity?
DRAFT
I'm just submitting what I have for now. Just a warning this is messy! I plan on implementing the height function, include time/space complexities, and clean everything up this weekend!