Golgappa.net | Golgappa.org | BagIndia.net | BodyIndia.Com | CabIndia.net | CarsBikes.net | CarsBikes.org | CashIndia.net | ConsumerIndia.net | CookingIndia.net | DataIndia.net | DealIndia.net | EmailIndia.net | FirstTablet.com | FirstTourist.com | ForsaleIndia.net | IndiaBody.Com | IndiaCab.net | IndiaCash.net | IndiaModel.net | KidForum.net | OfficeIndia.net | PaysIndia.com | RestaurantIndia.net | RestaurantsIndia.net | SaleForum.net | SellForum.net | SoldIndia.com | StarIndia.net | TomatoCab.com | TomatoCabs.com | TownIndia.com
Interested to Buy Any Domain ? << Click Here >> for more details...


How to find middle element of linked list in one pass?



How to find middle element of linked list in one pass?..

Answer / Satish Sharma

To find the middle element of a singly linked list in one pass, follow these steps:n1. Initialize two pointers: slow and fast.n2. Move the slow pointer one step ahead at each step, while moving the fast pointer two steps ahead.n3. After the loop ends, the slow pointer will be pointing to the middle element.

Is This Answer Correct ?    0 Yes 0 No

Post New Answer

More Data Structures Interview Questions

Evaluate the following prefix expression " ++ 26 + - 1324" (Similar types can be asked)

1 Answers  


how to display Singly Linked List from First to Last?

1 Answers  


Which is faster treemap or hashmap?

1 Answers  


What is lifo?

4 Answers  


Is hashset a collection?

1 Answers  


Is a hashmap a dictionary?

1 Answers  


What is stack and queue in data structure?

1 Answers  


Write the advantage of separate chaining?

1 Answers  


Write an algorithm through which the inserting and deleting of elements can take place in circular queue?

1 Answers  


Define red-black trees.

1 Answers   Wipro,


what are the applications of Linked Lists?

1 Answers  


What is mean by sorting?

1 Answers  


Categories