Skip to content

Andrea Valliere - Linked List#12

Open
avalliere wants to merge 10 commits intoAda-C7:masterfrom
avalliere:master
Open

Andrea Valliere - Linked List#12
avalliere wants to merge 10 commits intoAda-C7:masterfrom
avalliere:master

Conversation

@avalliere
Copy link

Linked Lists

Congratulations! You're submitting your assignment.

Comprehension Questions

What is the time and space complexity for each method you implemented? Provide justification.

Question Answer
What is the time complexity of the insert method? Provide justification. O(1) - Not traversing the list
What is the space complexity of the insert method? Provide justification. O(1) - Not using extra space
What is the time complexity of the search method? Provide justification. O(n) - You traverse the list once at most, so time complexity only grows with size of list
What is the space complexity of the search method? Provide justification. O(1) - Not using extra space
What is the time complexity of the find_max method? Provide justification. O(n) - traversing once at most
What is the space complexity of the find_max method? Provide justification. O(1) - not using extra space
What is the time complexity of the find_min method? Provide justification. O(n) - traversing once at most
What is the space complexity of the find_min method? Provide justification. O(1) - not using extra space
What is the time complexity of the length method? Provide justification. O(n) - traversing the list once
What is the space complexity of the length method? Provide justification. O(1) - not using extra space
What is the time complexity of the find_nth_from_beginning method? Provide justification. O(n) - traversing the list once at most
What is the space complexity of the find_nth_from_beginning method? Provide justification. O(1) - not using extra space
What is the time complexity of the insert_ascending method? Provide justification.
What is the space complexity of the insert_ascending method? Provide justification.
What is the time complexity of the visit method? Provide justification. O(n) - we'll traverse the list once
What is the space complexity of the visit method? Provide justification. O(1) - not using extra space
What is the time complexity of the delete method? Provide justification. O(n) - traversing the list once at most
What is the space complexity of the delete method? Provide justification. O(1) - not using extra space
What is the time complexity of the reverse method? Provide justification. O(n) - traversing the list once
What is the space complexity of the reverse method? Provide justification. O(1) - just using variables, no other extra space
What is the time complexity of the find_middle_value method? Provide justification.
What is the space complexity of the find_middle_value method? Provide justification.
What is the time complexity of the find_nth_from_end method? Provide justification.
What is the space complexity of the find_nth_from_end method? Provide justification.
What is the time complexity of the has_cycle method? Provide justification.
What is the space complexity of the has_cycle method? Provide justification.

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.

1 participant