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

Linked List Assignment #3

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open

Linked List Assignment #3

wants to merge 2 commits into from

Conversation

roslynm
Copy link

@roslynm roslynm commented Mar 26, 2022

No description provided.

Copy link

@CheezItMan CheezItMan 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 Roslyn, you hit the main learning goals here. I left a few minor comments here. Take a look and let me know what questions you have.

@@ -0,0 +1,7 @@
{

Choose a reason for hiding this comment

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

This could probably be added to .gitignore

Comment on lines +23 to 26
Time Complexity: O(1)
Space Complexity: O(1)
*/
getFirst() {

Choose a reason for hiding this comment

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

👍

Comment on lines +33 to 36
Time Complexity: O(1)
Space Complexity: O(1)
*/
addFirst(value) {

Choose a reason for hiding this comment

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

👍

Comment on lines +49 to 52
Time Complexity: O(n)
Space Complexity: O(1)
*/
search(value) {

Choose a reason for hiding this comment

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

👍

Comment on lines +65 to 68
Time Complexity: O(n)
Space Complexity: O(1)
*/
length() {

Choose a reason for hiding this comment

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

👍

Comment on lines +169 to 172
Time Complexity: O(n)
Space Complexity: O(1)
*/
visit() {

Choose a reason for hiding this comment

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

👍 Space complexity of O(n) because you're building a list.

Comment on lines +187 to 190
Time Complexity: O(n)
Space Complexity: O(1)
*/
reverse() {

Choose a reason for hiding this comment

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

👍

Comment on lines +211 to 214
Time Complexity: O(n)
Space Complexity: O(1)
*/
findMiddleValue() {

Choose a reason for hiding this comment

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

👍 Good reuse of existing methods and arithmetic.

Comment on lines +224 to 227
Time Complexity: O(n)
Space Complexity: O(1)
*/
findNthFromEnd(n) {

Choose a reason for hiding this comment

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

👍 Good reuse of existing methods and arithmetic.

Comment on lines +235 to 238
Time Complexity: O(n)
Space Complexity: O(1)
*/
hasCycle() {

Choose a reason for hiding this comment

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

What if the loop isn't back to the `head? What if it loops back to the 3rd node in the list?

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