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

Earth - Ringo #4

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

Earth - Ringo #4

wants to merge 4 commits into from

Conversation

ringolingo
Copy link

No description provided.

Copy link

@CheezItMan CheezItMan 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 Ringo, you hit all the learning goals here. Well done.

Comment on lines +15 to 19
// Time Complexity: O(log n) -- assuming the tree is balanced, as the number of nodes increases
// the number of times addHelper has to be called will only increase logarithmically
// Space Complexity: O(log n) -- assuming the tree is balanced, the number of calls to addHelper
// that will be on the stack at one time increases logarithmically, rather than linearly
add(key, value) {

Choose a reason for hiding this comment

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

👍 Correct on complexity, with the assumption

Comment on lines +45 to 49
// Time Complexity: O(log n) -- assuming the tree is balanced, as tree increases in size,
// the number of times findHelper has to be called will only increase logarithmically
// Space Complexity: O(log n) -- assuming the tree is balanced, the number of calls to findHelper
// on the stack at one time increases logarithmically
find(key) {

Choose a reason for hiding this comment

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

👍 Correct on complexity, with the assumption

Comment on lines +65 to 68
// Time Complexity: O(n). Method needs to visit every node in the tree
// Space Complexity: O(log n). The number of function calls on the stack will only be as great
// as the maximum height of the tree, which increases logarithmically to # of nodes (assuming balanced)
inorder() {

Choose a reason for hiding this comment

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

👍 Correct on complexity, with the assumption

Comment on lines +81 to 84
// Time Complexity: O(n). Method needs to visit every node in the tree
// Space Complexity: O(log n). The number of function calls on the stack will only be as great
// as the maximum height of the tree, which increases logarithmically to # of nodes (assuming balanced)
preorder() {

Choose a reason for hiding this comment

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

👍 Correct on complexity, with the assumption

Comment on lines +97 to 100
// Time Complexity: O(n). Method needs to visit every node in the tree
// Space Complexity: O(log n). The number of function calls on the stack will only be as great
// as the maximum height of the tree, which increases logarithmically to # of nodes (assuming balanced)
postorder() {

Choose a reason for hiding this comment

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

👍 Correct on complexity, with the assumption

Comment on lines +113 to 118
// Time Complexity: O(n). Method needs to follow every branch to its end
// and therefore visits every node.
// Space Complexity: O(log n). The max number of function calls on the stack will
// only be the maximum height of the tree, which scales logarithmically to the
// size of the tree (if balanced)
height() {

Choose a reason for hiding this comment

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

👍 Correct on complexity, with the assumption

Comment on lines +135 to 139
// Time Complexity: O(n). The method needs to visit every node in the tree so the time taken
// will increase linear to the size of the tree increasing.
// Space Complexity: O(n). The size of the queue at any point in time will increase logarithmically
// with the size of the tree, but the results array will increase linear to the size of the tree.
bfs() {

Choose a reason for hiding this comment

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

👍 Correct on complexity

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