You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
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' }
The text was updated successfully, but these errors were encountered:
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' }
The text was updated successfully, but these errors were encountered: