Showing posts with label double linked list. Show all posts
Showing posts with label double linked list. Show all posts

Thursday, February 12, 2009

Algorithm that returns the middle element of a double linked list

FindTheMiddleElementofDoubleLinkedList(L)
01 i <- head
02 j <- tail
03 while i != j do
04 i <- i.next
05 j <- j.previous
06 return i