Linked Lists Interview Questions
- 0of 0 votes
AnswersA singly linked list has integer as data in each node. Write a function to delete a node from the list given an integer as argument. (Assume all the nodes have unique integers)
- lippie March 21, 2012 in United States for Switching Softwares| Report Duplicate | Flag | PURGE
Cisco Systems Software Engineer / Developer Algorithm C Linked Lists - 0of 0 votes
AnswersGiven a Binary tree , you need to traverse and only print all nodes on given level L.
- lippie March 21, 2012 in United States for Switching Softwares| Report Duplicate | Flag | PURGE
Cisco Systems Software Engineer / Developer Algorithm C Linked Lists - 0of 0 votes
AnswersWrite a function to sort the linked list given the head as parameter. Do not use extra memory. You have to sort it in place. Time complexity is secondary. (He told me that he wants to see how fast I can code with any of of the solutions)
- lippie March 21, 2012 in United States for Switching Softwares| Report Duplicate | Flag | PURGE
Cisco Systems Software Engineer / Developer Algorithm C Coding Linked Lists - 0of 0 votes
AnswersGiven a linked list of integers, delete all the nodes from the linked list which data value equals to a given value.
- Lily March 20, 2012 in United States
void delete(Node **l, int target);| Report Duplicate | Flag | PURGE
Arista Networks Software Engineer / Developer Algorithm C Linked Lists - -1of 1 vote
Answerswrite a fucntion to delete a node from a linked list if pointer to head and node no. is given
- popoff March 20, 2012 in India| Report Duplicate | Flag | PURGE
Amazon Software Engineer / Developer Linked Lists - 0of 0 votes
AnswersDelete a given node of a linked list, when you do not have info about the head or any other node.
- nihaldps February 21, 2012 in India
The prototype of the function is -
void delete (Struct node* x)
where x is any arbit node of a linked list.| Report Duplicate | Flag | PURGE
Adobe Computer Scientist Linked Lists - 0of 0 votes
AnswersFind k'th element to the last of a linked list.Standard one
- anonymus February 17, 2012 in United States| Report Duplicate | Flag | PURGE
Linked Lists - 1of 1 vote
AnswersYou are given two numbers in the form of linked list.Add them without reversing the linked lists. linked lists can be of any length.
- manjunath426jc December 26, 2011 in India
Ex:123 1->2->3
10234 1->0->2->3->4
ans: 10357 1->0->3->5->7| Report Duplicate | Flag | PURGE
Amazon Qualcomm Software Engineer / Developer Linked Lists - 0of 0 votes
AnswersGiven a doubly linked list containing only three integers 1,2,3. Sort the list without exchanging the values.
- Puzzle November 19, 2011 in India
Eg- 1->3->2->1->2->3->2->1->1
output: 1->1->1->1->2->2->2->3->3| Report Duplicate | Flag | PURGE
Amazon Software Engineer in Test Data Structures Linked Lists - 0of 0 votes
AnswersSort a link list using merge sort.
- python.c.madhav October 15, 2011 in India| Report Duplicate | Flag | PURGE
Microsoft Software Engineer / Developer Algorithm Linked Lists - 0of 0 votes
AnswersFind out the middle node in the given singly linked list in one traversal.Length will always be an odd number.
- rthangaveljv September 30, 2011 in -
soln1: Two pointer approach
soln2: Usual method of finding length in one traversal & then finding the middle node in the second traversal.
Question: which method is better & why ? As far as i know both the method needs two traversal though they do it different time.(i.e) either after finishing the first traversal or while the first traversal is going on.? and if u notice carefully the same amount of work is done in both the methods...now tell me why the two pointer approach is preferred??.| Report Duplicate | Flag | PURGE
Software Engineer / Developer Linked Lists - 0of 0 votes
Answersin linked list how to find the 1/3rd and 2/3rd nodes efficiently...
- sekhar740 September 23, 2011 in India
ex : 1-->2-->3-->4-->5-->6.
outout :
1/3rd - 2
2/3rd - 4| Report Duplicate | Flag | PURGE
PayPal Software Engineer / Developer Linked Lists - 0of 0 votes
Answerswhat is better to use single linked list or double linked list
- rahul.singh0089 September 20, 2011 in India| Report Duplicate | Flag | PURGE
Wipro Technologies Software Engineer / Developer Linked Lists - -1of 1 vote
Answerswhy we used linked list, what's demand of linked list in the market
- rahul.singh0089 September 20, 2011 in India| Report Duplicate | Flag | PURGE
Wipro Technologies Software Engineer / Developer Linked Lists - 0of 0 votes
AnswersThis round was focused on DS only
- dheeraj2311 August 06, 2011
Reverse a link list
Gave me a link list in which loop is there. What will happen if we reverse such a kind of LL.
Detect loop in LL
Starting node at which loop is starting| Report Duplicate | Flag | PURGE
Adobe Software Engineer / Developer Linked Lists - 0of 0 votes
AnswersGiven a Doubly Linked List comprising of 1,2,3 nodes only. Write Code to Sort it.
- S.K.S Harsha July 30, 2011| Report Duplicate | Flag | PURGE
Amazon Software Engineer / Developer Linked Lists - 0of 0 votes
Answers4. In the language of your choice write me a function that does the following: “Walk a linked list (passed in as a parameter) and return a min, max, and average of the values at the end.” How would you then test this function?
- dharva June 14, 2011| Report Duplicate | Flag | PURGE
GE (General Electric) Linked Lists - 0of 0 votes
AnswersThere is a linked list whose node has 3 fields, val, next pointer & random pointer...next pointer points to next node in the list and random pointer can point to any node in the list.Write an efficient function which takes such list and returns the copy/clone of that list.
- Nish May 23, 2011| Report Duplicate | Flag | PURGE
Amazon Software Engineer / Developer Linked Lists - 0of 0 votes
AnswersThere are 'n' sorted linked list with avg. 'k' length, write an efficient function which return the head pointer of a single list which is the combination of all 'n' list and in sorted order.(Avoid using extra space)
- Nish May 23, 2011| Report Duplicate | Flag | PURGE
Amazon Software Engineer / Developer Linked Lists - 0of 0 votes
AnswersGiven 2 sorted linked lists - merge them. Make sure you don't have duplicates in the merged list. The input lists could have duplicates within them or across the 2 lists.
- ST April 18, 2011| Report Duplicate | Flag | PURGE
Microsoft Citrix System Inc Software Engineer / Developer Software Engineer in Test Algorithm Linked Lists - 0of 0 votes
Answersdelete a particular node in a linked list given a pointer to that node, what if it was the last node
- Abhi April 15, 2011| Report Duplicate | Flag | PURGE
NVIDIA Software Engineer / Developer Linked Lists - 0of 0 votes
AnswersYesterday i had interview @Motorola Mobility ..
- Sksharsha April 08, 2011
The interviewer asked the following question
Questions 1 : Given a Linked List where a node points somewhere ( might be another node) but not the subsequent node. Find if such a link exists in the given list
Interviewer told that its called Malformed Linked List , since the link was pointing to random node instead behaving the usual way
* Reverse a Singly linked list given a single head pointer| Report Duplicate | Flag | PURGE
Motorola Software Engineer / Developer Linked Lists - 0of 0 votes
AnswersThere is a doubly linked list with next pointer and arbitrary pointer( points to an arbitrary node in list). You have to make a copy of the linked list and return. In the end original list shouldn't be modified. Best time O(n).
- cracker April 06, 2011| Report Duplicate | Flag | PURGE
Amazon Software Engineer / Developer Algorithm Linked Lists - 0of 0 votes
AnswersGive atleast 10 test cases for a program which finds and eliminates the duplicates in a singly linked list. assume it has all positive integers and returns the head of the linked list without the duplicates
- WittyWoman March 25, 2011| Report Duplicate | Flag | PURGE
Microsoft Software Engineer in Test Linked Lists - 0of 0 votes
AnswersSay a function takes a pointer and allocates it some memory. How would the function 'Prototype' be?
- NVIDIA reject March 15, 2011
Ans: void memallocate (size_ size, void ** p)
they wanted to know the double pointer declaration. He also asked why we give double pointer in functions that take Linked List head etc.| Report Duplicate | Flag | PURGE
NVIDIA Software Engineer / Developer C Linked Lists - 0of 0 votes
AnswersImplement enqueue and dequeue operations using stack(s).
- Anil February 22, 2011| Report Duplicate | Flag | PURGE
Microsoft Software Engineer / Developer Algorithm Stacks Linked Lists