Here you will find more than 50000 job interview questions

Job Questions Search Engine


Sponsored Links

How to find the middle element of a linked list?

July 1, 2010 by bigboss · Comments Off
Filed under: Linked List Interview Questions 

Solution 1 (Uses one slow pointer and one fast pointer). Increment the first pointer by one and increment the second pointer by two. When the second pointer would point to the last element of linked list first pointer would point to the middle element of linked list.

Solution 2 Use counter and save the element of the linked list

  • Categories

    |
  • Tags

    ADO.NET Questions Algorithm Questions ASP.NET Questions auto_ptr Binary tree questions C++ Constructor Interview Questions C++ Questions CISCO Exams Questions Common Interview Questions Core Java Interview Questions Csharp Questions datastructure questions Delphi 6 find command gdb interview questions grep interview questions IBM certification exams questions Infosys Puzzles Java Struts Linked List Problem Linux Command Questions List Manager Interview Questions Markov Algorithm memory leakage mysql Interview Questions Normalization Oracle Application Developer Certification Exam Interview Questions Oracle Questions Perl Questions PHP Questions Pointers Interview Questions PostgreSQL Database Questions pthread interview questions Smart Pointer Solaris Interview Questions SQL SERVER Interview Questions STL STL Map Symbian OS Tricky Interview Questions Unix Interview Questions unix shell Vector Windows OS Questions