Interview Questions on linked-lists, doubly linked-lists and binary trees

I have collected few very good problems on linked-lists surfing through the internet. They include basic conceptual questions as well as hard to bite. I will keep update the blog as soon as I find some good stuff.

  1. Given a linked list, give an algorithm to reverse it using constant space and in single pass.
  2. Given a linked list of n nodes, give an algorithm to reverse every k nodes of the linked list.
  3. A linked list has a closed loop in it, i.e. the last node points to some node in middle of it. Give an algorithm to find the node from which the loop begins. The last node may points to the first node
  4. Given a linked list with each node having a lower-case character. Find whether the word formed by characters of list is palindrome or not.(Do in a single pass with constant space)
  5. Given a doubly linked-list containing integers in sorted sequence, create a height balanced binary search tree model using the same data structure.
Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s