Skip to content

Methods complete#6

Open
kellysouza wants to merge 3 commits intoAda-C7:masterfrom
kellysouza:master
Open

Methods complete#6
kellysouza wants to merge 3 commits intoAda-C7:masterfrom
kellysouza:master

Conversation

@kellysouza
Copy link

@kellysouza kellysouza commented Aug 28, 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. Constant, place a node takes the same amount of time because we are adding to the first of the list no matter how many nodes in the linked list.
What is the space complexity of the insert method? Provide justification. Constant. No new data structures
What is the time complexity of the search method? Provide justification. O(n), because we go through each element once
What is the space complexity of the search method? Provide justification. Constant. No new data structures
What is the time complexity of the find_max method? Provide justification. O(n), because we go through each element once
What is the space complexity of the find_max method? Provide justification. Constant. No new data structures
What is the time complexity of the find_min method? Provide justification. O(n), because we go through each element once
What is the space complexity of the find_min method? Provide justification. Constant. No new data structures
What is the time complexity of the length method? Provide justification. O(n), because we go through each element once
What is the space complexity of the length method? Provide justification. Constant. No new data structures
What is the time complexity of the find_nth_from_beginning method? Provide justification. O(n), because we go through each element once
What is the space complexity of the find_nth_from_beginning method? Provide justification. Constant. No new data structures
What is the time complexity of the insert_ascending method? Provide justification. O(n), because we go through each element once
What is the space complexity of the insert_ascending method? Provide justification. Constant. No new data structures
What is the time complexity of the visit method? Provide justification. O(n), because we go through each element once
What is the space complexity of the visit method? Provide justification. Constant. No new data structures
What is the time complexity of the delete method? Provide justification. O(n), because we go through each element once
What is the space complexity of the delete method? Provide justification. Constant. No new data structures
What is the time complexity of the reverse method? Provide justification.
What is the space complexity of the reverse method? Provide justification. Constant. No new data structures
What is the time complexity of the find_middle_value method? Provide justification. O(n^2), because we go through each element twice
What is the space complexity of the find_middle_value method? Provide justification. Constant. No new data structures
What is the time complexity of the find_nth_from_end method? Provide justification. O(n), because we go through each element twice
What is the space complexity of the find_nth_from_end method? Provide justification. Constant. No new data structures
What is the time complexity of the has_cycle method? Provide justification. O(n^2), because we go through each twice
What is the space complexity of the has_cycle method? Provide justification. Constant. No new data structures

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