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

#20 Find the Midpoint #23

Open
somekindofwallflower opened this issue Jun 14, 2022 · 0 comments
Open

#20 Find the Midpoint #23

somekindofwallflower opened this issue Jun 14, 2022 · 0 comments
Assignees
Labels
enhancement New feature or request

Comments

@somekindofwallflower
Copy link
Owner

Description
Return the 'middle' node of a linked list.
If the list has an even number of elements, return
the node at the end of the first half of the list.
Do not use a counter variable, do not retrieve
the size of the list, and only iterate
through the list one time.

Example
const l = new LinkedList();
l.insertLast('a')
l.insertLast('b')
l.insertLast('c')
midpoint(l); // returns { data: 'b' }

@somekindofwallflower somekindofwallflower self-assigned this Jun 14, 2022
@somekindofwallflower somekindofwallflower added the enhancement New feature or request label Jun 14, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

1 participant