please respond if you are familiar with this problem Thanks Describe an algorith
ID: 3553835 • Letter: P
Question
please respond if you are familiar with this problem
Thanks
Explanation / Answer
1.for the function to find the mid of a linked list.
Initialize 2 pointer both pointing to the head of the list initially.
Now increment the first one by 2 places and keep the second one at rest. Keep moving the first pointer by 2 places and for each move of first pointer move the second pointer by one position. When the first pointer reaches to the end of linked list, second pointer will be pointing to the mid node.
Related Questions
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.