Skip to content

Paper - Malakhova K.#56

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

Paper - Malakhova K.#56
kmalakhova wants to merge 1 commit intoAda-C15:masterfrom
kmalakhova:master

Conversation

@kmalakhova
Copy link
Copy Markdown

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 Kate, you hit the learning goals here. Well done.

Comment on lines 16 to 18
# Time Complexity: ?
# Space Complexity: ?
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 +27 to 29
# 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 +30 to +32
new_node = Node(value)
new_node.next = self.head
self.head = new_node
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Can be simplified a bit.

Suggested change
new_node = Node(value)
new_node.next = self.head
self.head = new_node
self.head = Node(value, self.head)

Comment on lines +36 to 38
# Time Complexity: O(n)
# Space Complexity: O(1)
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 +47 to 49
# Time Complexity: O(n)
# Space Complexity: O(1)
def length(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 +86 to 88
# Time Complexity: O(n)
# Space Complexity: O(1)
def add_last(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.

👍


# method to return the max value in the linked list
# returns the data value and not the node
def find_max(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 +112 to 114
# Time Complexity: O(1)
# Space Complexity: O(n)
def delete(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 +130 to 132
# 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 +142 to 144
# 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.

👍

@kmalakhova kmalakhova changed the title Linked lists exercise Papaer - Malakhova K. Jan 16, 2022
@kmalakhova kmalakhova changed the title Papaer - Malakhova K. Paper - Malakhova K. Jan 16, 2022
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