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

Tamiko Terada - Linked List #22

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

Conversation

TamikoT
Copy link

@TamikoT TamikoT commented Oct 16, 2017

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) add to beginning of list so no traversal
What is the space complexity of the insert method? Provide justification. O(1) only temp var
What is the time complexity of the search method? Provide justification. O(n) traversal once, visit each at worst
What is the space complexity of the search method? Provide justification. O(1) only temp var
What is the time complexity of the find_max method? Provide justification. O(n) traversal once, visit each at worst
What is the space complexity of the find_max method? Provide justification. O(1) only temp var
What is the time complexity of the find_min method? Provide justification. O(n) traversal once, visit each at worst
What is the space complexity of the find_min method? Provide justification. O(1) only temp var
What is the time complexity of the length method? Provide justification. O(n) traversal exactly once
What is the space complexity of the length method? Provide justification. O(1) only temp var
What is the time complexity of the find_nth_from_beginning method? Provide justification. O(n) traversal once, visit each at worst
What is the space complexity of the find_nth_from_beginning method? Provide justification. O(1) only temp var
What is the time complexity of the insert_ascending method? Provide justification. O(n) traversal once, visit each at worst
What is the space complexity of the insert_ascending method? Provide justification. O(1) only temp var
What is the time complexity of the visit method? Provide justification. O(n) traversal exactly once
What is the space complexity of the visit method? Provide justification. O(1) only temp var
What is the time complexity of the delete method? Provide justification. O(n) traversal once, visit each at worst
What is the space complexity of the delete method? Provide justification. O(1) only temp var
What is the time complexity of the reverse method? Provide justification. O(n) traversal exactly once
What is the space complexity of the reverse method? Provide justification. O(1) only temp var
What is the time complexity of the find_middle_value method? Provide justification. O(n) traversal once
What is the space complexity of the find_middle_value method? Provide justification. O(1) only temp var
What is the time complexity of the find_nth_from_end method? Provide justification. O(n) traversal once
What is the space complexity of the find_nth_from_end method? Provide justification. O(1) only temp var
What is the time complexity of the has_cycle method? Provide justification. O(n) traverses once if not a cycle, worse if circular && very large dataset
What is the space complexity of the has_cycle method? Provide justification. O(1) only temp var

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