Conversation
CheezItMan
left a comment
There was a problem hiding this comment.
Overall well done, but you submitted the TREE assignment instead of this one. When you get it turned in, I'll change the mark.
Take a look at my comments and let me know what questions you have.
| # Time Complexity:O(1) | ||
| # Space Complexity:O(1) | ||
| def add_first(value) |
| # Space Complexity: ? | ||
| def find_min | ||
| raise NotImplementedError | ||
| while (current = current.next) |
| # Time Complexity: O(n) | ||
| # Space Complexity: O(n) | ||
| def search(value) |
| # Time Complexity: O(n) | ||
| # Space Complexity: O(n) | ||
| def find_min |
There was a problem hiding this comment.
👍 , the space complexity is O(1) because you're not creating a new list.
| # Time Complexity: O(n) | ||
| # Space Complexity: O(n) | ||
| def length |
There was a problem hiding this comment.
👍 , the space complexity is O(1) because you're not creating a new list.
| # Time Complexity: O(n) | ||
| # Space Complexity: O(n) | ||
| def delete(value) |
There was a problem hiding this comment.
👍 , the space complexity is O(1) because you're not creating a new list.
| # Time Complexity: o(n) | ||
| # Space Complexity: O(n) | ||
| # def reverse | ||
| # current = @head | ||
| # while current != nil | ||
| # temp = current.previous | ||
| # current.previous = current.next | ||
| # current.next = temp | ||
| # current = current.previous | ||
| # end | ||
| # temp = @head | ||
| # @head = @tail | ||
| # @tail = temp | ||
| # end | ||
|
|
||
| def reverse |
There was a problem hiding this comment.
👍 , the space complexity is O(1) because you're not creating a new list.
| # Time Complexity: ? | ||
| # Space Complexity: ? | ||
| def get_first |
| # Time Complexity: O(n) | ||
| # Space Complexity: O(n) | ||
| def add_last(value) |
| # Time Complexity: O(n) | ||
| # Space Complexity: O(n) | ||
| def get_last |
There was a problem hiding this comment.
👍 , the space complexity is O(1) because you're not creating a new list.
I wasn't sure if the reverse one was optional. After trying it, I decided to skip the test as I didn't want to waste more time at the last minute.