Linked Lists Interview Questions
- 5of 7 votes
AnswersDelete last node from the linked list. First node pointer is not given.
- yolo July 11, 2013 in India
I told him its not possible in conventional linked list.
He asked me what if we can add some more data in node.
Data should not be a pointer to previous node i.e., it should still be singly linked list.| Report Duplicate | Flag | PURGE
Amazon SDE1 Linked Lists - 0of 0 votes
AnswersHow will you find a loop in a linked list. e.g. if the 4th node of the list is pointing back to the 2nd node (for a list of size 6), then it will be in a loop; how will you find this node?
- VivekD June 03, 2013 in India| Report Duplicate | Flag | PURGE
Harman Kadron Software Engineer / Developer Linked Lists - -5of 7 votes
Answersneed to implement a weather report functionality. user will provide the city name , need to return the weather report.
- gopi.komanduri May 29, 2013 in India
if weather station exists n functioning properly , will return the weather report of that station .
else ,
will return the nearest available weather station report.
interviewer looking for optimized manner.
looking for datastructures to stores the cities n algo to return the report.| Report Duplicate | Flag | PURGE
Mentor Graphics Analyst Algorithm Arrays Bit Manipulation Brain Teasers C C# C++ Cache Coding Computer Architecture & Low Level Data Mining Data Structures Dynamic Programming General Questions and Comments Graphics Hash Table Ideas Linked Lists Math & Computation Object Oriented Design Problem Solving Sets Sorting Stacks String Manipulation Terminology & Trivia Threads Trees and Graphs XML - 8of 8 votes
AnswersWrite a function which returns kth element from the tail in a linked list.
- hasan.tanpinar April 04, 2013 in United States| Report Duplicate | Flag | PURGE
Google Intern Linked Lists - 0of 0 votes
AnswersWhich one is faster and why?
- audi March 15, 2013 in United States
1. Array
2. Link List.
If we just want to iterate in for loop and print it.| Report Duplicate | Flag | PURGE
Qualcomm Arrays Linked Lists - 0of 0 votes
AnswersWrite a function in java to reverse linked list recursively but the function should have void return type?
- <--> February 23, 2013 in United States| Report Duplicate | Flag | PURGE
Lab126 Software Engineer Intern Linked Lists - 0of 0 votes
Answersmerge two unsorted linked-list into one new sorted linked list, off course in a efficient way
- nguptak February 15, 2013 in United States| Report Duplicate | Flag | PURGE
Software Engineer / Developer Linked Lists Sorting - 0of 0 votes
AnswersAppend the last n nodes of a linked list to the beginning of the list
- ruddermechanic February 07, 2013 in India
eg: 1->2->3->4->5->6
if n=2
5->6->1->2->3->4| Report Duplicate | Flag | PURGE
Microsoft Software Engineer / Developer Linked Lists - 0of 0 votes
AnswersGiven two linked lists combine them in a way such that the resultant must contain the elements alternatively from one list and the other list?
- Ashish January 31, 2013 in India
For ex.
LL1 : 1->2->3->4
LL2 : 5->6->7
Result : 1->5->2->6->3->7->4
Also provide test cases for the algorithm ?| Report Duplicate | Flag | PURGE
Microsoft Software Engineer / Developer Linked Lists - 5of 5 votes
AnswersYou have a link list with the following structure:
- francisco.gutierrez.91 January 24, 2013 in United States for Office
struct Node{ Node*next; Node*other; }
next pointer points to next node, but "other" pointer points to any node in the list, it can be itself or null.
you receive the header of a list with this structure.
you have to copy it(allocate new memory) , you cannot modify the structure, you can not modify the list you are given.| Report Duplicate | Flag | PURGE
Microsoft Software Engineer / Developer Linked Lists Algorithm Data Structures - 0of 0 votes
AnswersMicrosoft recruiting final round:
- francisco.gutierrez.91 January 24, 2013 in United States for Office
Interview 1-Question 1:
Insert node in a sorted singly linked list| Report Duplicate | Flag | PURGE
Microsoft Linked Lists - 2of 2 votes
AnswersSelect a random node data from a very long linked list whose length is not known such that the probability of each node is equal.
- ishwant.nandra January 17, 2013 in United States| Report Duplicate | Flag | PURGE
Amazon Software Engineer / Developer Linked Lists - 0of 2 votes
AnswersRound 3 :
- sonesh January 03, 2013 in India
Q 6 : You are given a ternary tree (a tree with 3 children at max with left, middle, right pointer at each node), create a singly linked list from it without using extra space ?| Report Duplicate | Flag | PURGE
Microsoft Software Engineer / Developer Algorithm Data Structures Linked Lists Trees and Graphs - 1of 1 vote
AnswersHow can we reduce search time in linked list(reduce time complexity to O(log n), it is not given but I gave my answer with O(log n) complexity) ?
- sonesh January 01, 2013 in India for Strategies Group| Report Duplicate | Flag | PURGE
Goldman Sachs Software Engineer / Developer Algorithm Linked Lists - 0of 0 votes
AnswersWrite a function that will return true if a circular singly linked list has duplicate values. For example, given a pointer to a node in the circular singly linked list, *slist, where the only values each node of this list contains int value, and *nxt_pointer. How would you traverse it and what way will allow you to have the best case for time-complexity? How would we know when the circular singly linked list stops?
- DorothyN91 December 17, 2012 in United States| Report Duplicate | Flag | PURGE
Amazon Software Engineer / Developer Linked Lists - 3of 5 votes
AnswersGiven two singly linked list, find if they are intersecting. Do this in single iteration. Also find the intersecting node in O(n) time and O(1) space. By intersection I mean intersection by reference not by value
- dm December 05, 2012 in India| Report Duplicate | Flag | PURGE
Amazon Microsoft Software Engineer / Developer Linked Lists - 0of 0 votes
AnswersGiven an array of pointers to some nodes in a doubly linked list, find the number of connected node blocks the pointers point to.
- karthiksheshadri December 03, 2012 in United States| Report Duplicate | Flag | PURGE
Linked Lists - 1of 1 vote
AnswersWith a pointer to head node of a linked list as argument, write a function to swap the consecutive elements of the list and return the head node. (Do note change values of any node, only change the links.)
- @ce October 24, 2012 in India
Example :-
1->2->3->4->5->6->7
2->1->4->3->6->5->7| Report Duplicate | Flag | PURGE
Microsoft Intern Linked Lists - 0of 0 votes
Answershow to sort a single linked list with out using an additional node?
- pradeep.vempati October 11, 2012 in India| Report Duplicate | Flag | PURGE
Amazon Software Engineer / Developer Linked Lists - 0of 2 votes
AnswersRotating K times a Linked List
- gdsrinivasan October 06, 2012 in United States
Given: k=3
LinkedList: 10->20->30->40->50->60->70->80
Output:
Sry, I dont remember the exact output as the list was almost zigzag sorted like:
30->40->10->20->60->50->70->80
any possibles hunches for a valid qn...?| Report Duplicate | Flag | PURGE
Amazon Software Engineer / Developer Linked Lists - 0of 0 votes
AnswersSwap two nodes in place without using any extra node. For example, if you have lists a->b->c then output should be b->a->-c- and so on..
- M. Sam September 20, 2012 in United States| Report Duplicate | Flag | PURGE
Microsoft Software Engineer / Developer Linked Lists - 0of 0 votes
AnswersYou have a linked list in which each node is another linked list. How do you find the 7th most unique element in the among all the nodes in the most optimal time ?
- vinay August 19, 2012 in United States| Report Duplicate | Flag | PURGE
Linked Lists - 0of 0 votes
AnswersGiven a head to linked list and integer as input, write a function to delete all matching elements in the linked list
- horizon_nk August 16, 2012 in United States| Report Duplicate | Flag | PURGE
Cisco Systems Software Engineer / Developer Linked Lists - 1of 1 vote
AnswersYou have a circular Linked List:
- Andy2000 August 16, 2012 in United States
a->b->c->d->e->c
Find where the cycle is starting| Report Duplicate | Flag | PURGE
Microsoft Software Engineer in Test Linked Lists - 1of 1 vote
AnswersWith a linked list data structure, find if a given string is palindrome or not.
- sathish.leo May 26, 2012 in United States| Report Duplicate | Flag | PURGE
Expedia Amazon Software Engineer / Developer Linked Lists - 3of 3 votes
AnswersQ1.- Written exam (Amazon, Bangalore)
- Nitin Gupta May 12, 2012 in India
Given a singly link list and a number 'K', swap the Kth node from the start with the Kth node from the last. Check all the edge cases.
Sample Input: 1->2->3->4->5->6->7->8 and K = 3
Sample Output : 1->2->6->4->5->3->7->8
Sample Input: 1->2->3->4->5->6->7->8 and K = 10
Sample Output: print error "LIST IS OF LESSER SIZE".| Report Duplicate | Flag | PURGE
Amazon Software Engineer / Developer Algorithm C C# C++ Coding Data Structures Java Linked Lists - 1of 1 vote
AnswersQ3. Written Exam Amazon(Bangalore)
- Nitin Gupta May 12, 2012 in India
Given a singly linked list which may or may not contain loop and loop may or may not start from the head node. Count the number of elements in the linked list.| Report Duplicate | Flag | PURGE
Amazon Software Engineer / Developer Algorithm C C# C++ Coding Data Structures Java Linked Lists - 0of 0 votes
AnswersWrite code to remove a node from a linked list. Choose the node which would be most efficient to remove.
- KaranGoswamiKenZ May 02, 2012 in United States for Firmware
Hint: Head node.| Report Duplicate | Flag | PURGE
Intel Software Engineer / Developer Linked Lists - 0of 0 votes
Answersinput linked list is : 1->9->3->8->5->7->7
- ashish April 10, 2012 in India for hyderabad
do you see any pattern in this input ?
odd placed nodes are in increasing order and even placed nodes are in decreasing order.
write a code that gives the the following linkedlist:
output linked list should be 1->3->5->7->7->8->9
?? can it be done inplace ?| Report Duplicate | Flag | PURGE
Amazon Software Engineer / Developer Linked Lists - 0of 0 votes
Answersgiven a linked list and two integers M and N. Scan the linked list such that you retain M nodes then delete next N nodes and continue the same till the end of linked list.
- ashish March 25, 2012 in India for bing| Report Duplicate | Flag | PURGE
Microsoft Software Engineer / Developer Linked Lists