Skip to content

Ting Wong - Linked List#20

Open
tingwong wants to merge 2 commits intoAda-C7:masterfrom
tingwong:master
Open

Ting Wong - Linked List#20
tingwong wants to merge 2 commits intoAda-C7:masterfrom
tingwong:master

Conversation

@tingwong
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) - regardless of the input, it will be constant time.
What is the space complexity of the insert method? Provide justification. O(1) - the amount of space doesn't change with the input.
What is the time complexity of the search method? Provide justification. O(n) - the time complexity will change with be dependent on how long the list is.
What is the space complexity of the search method? Provide justification. O(1) - the space required is constant; we aren't allocating more space for a larger list.
What is the time complexity of the find_max method? Provide justification. O(n) - the time will change dependent on how long the linked list is.
What is the space complexity of the find_max method? Provide justification. O(1) - the space required will not increase based on how long the linked list is.
What is the time complexity of the find_min method? Provide justification. O(n) - the time complexity will change based on how long the list is.
What is the space complexity of the find_min method? Provide justification. O(1) - the space required will not increase based on how long the list is.
What is the time complexity of the length method? Provide justification. O(n) - the length of time will increase based on list size.
What is the space complexity of the length method? Provide justification. O(1) - the space required will not increase based on how long the list is.
What is the time complexity of the find_nth_from_beginning method? Provide justification. O(n) - the length of time will increase based on list size.
What is the space complexity of the find_nth_from_beginning method? Provide justification. O(1) - the space required will not increase based on how long the list is.
What is the time complexity of the insert_ascending method? Provide justification. O(n) - the length of time will increase based on list size
What is the space complexity of the insert_ascending method? Provide justification. O(1) - the amount of space doesn't change with the input.
What is the time complexity of the visit method? Provide justification. O(n) - the length of time will increase based on list size
What is the space complexity of the visit method? Provide justification. O(1) - the amount of space doesn't change with the input.
What is the time complexity of the delete method? Provide justification. O(n) - the length of time will increase based on list size
What is the space complexity of the delete method? Provide justification. O(1) - the amount of space doesn't change with the input.
What is the time complexity of the reverse method? Provide justification. O(n) - the length of time will increase based on list size
What is the space complexity of the reverse method? Provide justification. O(1) - the amount of space doesn't change with the input.
What is the time complexity of the find_middle_value method? Provide justification. O(n) - the length of time will increase based on list size
What is the space complexity of the find_middle_value method? Provide justification. O(1) - the amount of space doesn't change with the input.
What is the time complexity of the find_nth_from_end method? Provide justification. O(n) - the length of time will increase based on list size
What is the space complexity of the find_nth_from_end method? Provide justification. O(1) - the amount of space doesn't change with the input.
What is the time complexity of the has_cycle method? Provide justification. O(n) - the length of time will increase based on list size
What is the space complexity of the has_cycle method? Provide justification. O(1) - the amount of space doesn't change with the input.

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