Skip to content

Scissors - Ivana#57

Open
i-vs wants to merge 1 commit intoAda-C15:masterfrom
i-vs:master
Open

Scissors - Ivana#57
i-vs wants to merge 1 commit intoAda-C15:masterfrom
i-vs:master

Conversation

@i-vs
Copy link
Copy Markdown

@i-vs i-vs commented Jan 18, 2022

No description provided.

Copy link
Copy Markdown

@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 Ivana, this all works. Take a look at my minor feedback, but this is quite well done.

Comment on lines +19 to 21
# Time Complexity: O(1)
# Space Complexity: O(1)
def get_first(self):
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

👍

Comment on lines +28 to 30
# Time Complexity: O(1)
# Space Complexity: O(1)
def add_first(self, value):
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

👍

Comment on lines +31 to +33
node = Node(value, self.head)
self.head = node
self.size += 1
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Suggested change
node = Node(value, self.head)
self.head = node
self.size += 1
self.head = Node(value, self.head)

Comment on lines +37 to 39
# Time Complexity: O(n)
# Space Complexity: O(1) constant space w/ no additional space in memory
def search(self, value):
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

👍

Comment on lines +40 to +41
if self.head is None:
return 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.

Not needed

Suggested change
if self.head is None:
return False
if self.head is None:
return False

Comment on lines +153 to 155
# Time Complexity: O(n)
# Space Complexity: O(n)
def visit(self):
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

👍

Comment on lines +167 to 169
# Time Complexity: O(n)
# Space Complexity: O(1)
def reverse(self):
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

👍

Comment on lines +185 to 188
# Time Complexity: O(n)
# Space Complexity: O(1)

def find_middle_value(self):
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

👍 Another great reuse of get_at_index

Comment on lines +205 to 208
# Time Complexity: O(n)
# Space Complexity: O(1)

def find_nth_from_end(self, 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.

👍 Niiice

Comment on lines +225 to 227
# Time Complexity: O(n)
# Space Complexity: O(1)
def has_cycle(self):
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

👍 neat trick with advance

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