Skip to content

Leaves - Elizabeth #40

Open
north108 wants to merge 3 commits into
Ada-C12:masterfrom
north108:master
Open

Leaves - Elizabeth #40
north108 wants to merge 3 commits into
Ada-C12:masterfrom
north108:master

Conversation

@north108

Copy link
Copy Markdown

No description provided.

@CheezItMan CheezItMan left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Nice work. You hit the learning goals here, but struggled a bit in Big-O. Take a look at my comments and let me know any questions you have.

# Time complexity: ?
# Space complexity: ?
# Time complexity: O(n)
# Space complexity: O(n)

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

See above

# Time complexity: ?
# Space complexity: ?
# Time complexity: O(n)
# Space complexity: O(n)

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Since you don't allocate more data as n increases in size, this is O(1) for space complexity.

else
i += 1
end
false

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

This line isn't doing anything.

# Time complexity: ?
# Space complexity: ?
# Time complexity: 0(n)
# Space complexity: 0(n)

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Same issue as above

# Returns true if found, false otherwise.
# Time complexity: ?
# Space complexity: ?
# Time complexity: O(n^2)

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

We're not running nested loops here. instead the loop cuts the number of items to look at in half each iteration. So this is O(log n).

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