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

Maple - Rhyannon Rodriguez #72

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

rhyannonjoy
Copy link

Only required exercises completed

Copy link

@kyra-patton kyra-patton 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 Rhyannon! I left one comment about the time complexity of get_first. Let me know what questions you have.

🟢

@@ -13,83 +12,161 @@ def __init__(self):

# returns the value in the first node
# returns None if the list is empty
# Time Complexity: ?
# Space Complexity: ?
# Time Complexity: Linear O(N), size of LL

Choose a reason for hiding this comment

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

⏱ Time complexity would actually be O(1) here, because you only ever need to look at the head of the list.

# Time Complexity: ?
# Space Complexity: ?
# Time Complexity: Adding a head, Constant O(1)
# Space Complexity: Constant O(1) not creating new data structure
def add_first(self, value):

Choose a reason for hiding this comment

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

# Time Complexity: ?
# Space Complexity: ?
# Time Complexity: Linear O(N), size of the LL
# Space Complexity: Constant O(1), we're not creating data structures
def search(self, value):

Choose a reason for hiding this comment

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

# Time Complexity: ?
# Space Complexity: ?
# Time Complexity: Linear O(N), size of the LL
# Space Complexity: Constant O(1), we're not creating data structures
def length(self):

Choose a reason for hiding this comment

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

# Time Complexity: ?
# Space Complexity: ?
# Time Complexity: Linear O(N), size of the LL
# Space Complexity: Constant O(1), we're not creating data structures
def get_at_index(self, index):

Choose a reason for hiding this comment

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

current = self.head
while current.next:
current = current.next
current.next = new_node

# method to return the max value in the linked list
# returns the data value and not the node
def find_max(self):

Choose a reason for hiding this comment

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

# Time Complexity: ?
# Space Complexity: ?
# Time Complexity: Linear O(N), size of the LL
# Space Complexity: Constant O(1), we're not creating data structures
def delete(self, value):

Choose a reason for hiding this comment

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

# Time Complexity: ?
# Space Complexity: ?
# Time Complexity: Linear O(N), size of the LL
# Space Complexity: Linear O(N), depending on the size of the visited_list
def visit(self):

Choose a reason for hiding this comment

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

def visit(self):
helper_list = []
visited_list = []
current = self.head

while current:

Choose a reason for hiding this comment

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

# Time Complexity: ?
# Space Complexity: ?
# Time Complexity: Linear O(N), depending on the size of the LL
# Space Complexity: Constant O(1), no creation of new data structures
def reverse(self):

Choose a reason for hiding this comment

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

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