Linked Lists Interview Questions
- 0of 0 votes
AnswersReverse a linked list using recursion
- Vineet February 21, 2011| Report Duplicate | Flag | PURGE
Microsoft Jane Street Software Engineer / Developer Linked Lists - 0of 0 votes
AnswersHow do you test function Add that adds two linked lists?
- Soanli October 24, 2010| Report Duplicate | Flag | PURGE
Microsoft Software Engineer in Test Linked Lists - 0of 0 votes
AnswersFind and delete nodes from a linked list with value=k. What's the complexity? Does it handle boundary cases?
- Cartman October 19, 2010
Hint: Make sure to free the memory when deleting a node using delete() or free()| Report Duplicate | Flag | PURGE
Facebook Software Engineer / Developer Linked Lists - 0of 0 votes
AnswersThere is a linked list of numbers of length N. N is very large and you don't know N. You have to write a function that will return k random numbers from the list. Numbers should be completely random.
- katheopaul September 07, 2010| Report Duplicate | Flag | PURGE
Microsoft Software Engineer / Developer Linked Lists - 0of 0 votes
AnswersWrite the clone method of a linked list whose one node point to some random node.
- o(?) September 07, 2010| Report Duplicate | Flag | PURGE
Amazon Software Engineer in Test Linked Lists - 0of 0 votes
AnswersLinked List with following structure..
struct node { int data; struct node *next; struct node *next_larger; }
initially next_larger of every node is point to NULL.
- TheDewarist August 29, 2010
now write a c code which set all node's next_larger pointer.
where next_largest point to the next larger then its own value and largest value node's next_larger pointer points to NULL
i.e.
if LL is 3->1->5->6->4
then 3's next_larger points to 4
and 1's next_larger points to 3
and 5's next_larger points to 6
and 6's next_larger points to NULL
and 4's next_larger points to 5| Report Duplicate | Flag | PURGE
Amazon Software Engineer / Developer Linked Lists - 0of 0 votes
Answersfind the maximum subsequence sum in a linked list. Consider the node as shown below.This node class has a extra item isvertex which determines whether the node is a vertex r not.
- sps July 11, 2010
so find the longest distance between any 2 vertex in the linked list.
Node SLL{
int data;
Node n;
bool isVertex;
}| Report Duplicate | Flag | PURGE
Microsoft Software Engineer in Test Linked Lists - 0of 0 votes
AnswersMerge two linked lists: Node* MergeList(Node *list1, Node* list2). Do not create a node in the function while merging the lists.
- Rahul July 10, 2010
Struct Node{
int data;
struct node* p;
}| Report Duplicate | Flag | PURGE
Microsoft Software Engineer / Developer Linked Lists - 0of 0 votes
AnswersGiven a singly linked list, swap every two elements (e.g. a->b->c->d->e->f->null should become b->a->d->c->f->e->null). Code it such that memory position is swapped and not the node value.
- AnonymousUser March 28, 2010| Report Duplicate | Flag | PURGE
Amazon Software Engineer / Developer Linked Lists - 0of 0 votes
AnswersWrite a function that would: return the 5th element from the end in a singly linked list of integers, in one pass, and then provide a set of test cases against that function
- abhays.1984 March 19, 2010| Report Duplicate | Flag | PURGE
Microsoft Software Engineer in Test Coding Testing Linked Lists - 0of 0 votes
AnswersWrite a function to find the nth last element from a Linked List.
- kanurukh March 15, 2010| Report Duplicate | Flag | PURGE
Amazon Software Engineer / Developer Linked Lists - 0of 0 votes
AnswersReverse a linked list with atmost two extra pointers.
- Rocky February 12, 2010| Report Duplicate | Flag | PURGE
Microsoft Software Engineer in Test Linked Lists - 0of 0 votes
AnswersGiven a singly linked-list, and a pointer to node, how to delete the node.
- myanything February 02, 2010| Report Duplicate | Flag | PURGE
Amazon Software Engineer / Developer Linked Lists - 0of 0 votes
AnswersHow to check singly linked list is a circular linked list.
- myanything February 02, 2010| Report Duplicate | Flag | PURGE
Amazon Software Engineer / Developer Linked Lists - 0of 0 votes
Answersstruct node{
- dok January 22, 2010
struct node* next;
struct node* reference;
}
duplicate the list by:
struct node* duplicate(struct node* original)
how to handle the "reference" in the new list?| Report Duplicate | Flag | PURGE
Amazon Software Engineer / Developer Linked Lists - 0of 0 votes
AnswersImplement merge sort of linked list
- AM January 13, 2010| Report Duplicate | Flag | PURGE
Google Software Engineer / Developer Linked Lists - 0of 0 votes
AnswersWrite a function that would return the 5th element from the tail (or end) of a singly linked list of integers, in one pass, and then provide a set of test cases against that function (please do not use any list manipulation functions that you do not implement yourself).
- luke December 11, 2009| Report Duplicate | Flag | PURGE
Software Engineer / Developer Linked Lists - 0of 0 votes
Answerswe know how to FIX the loop in a linked list using that two pointers trick. Interviewer asked me to give proof for this.
- vivek December 08, 2009| Report Duplicate | Flag | PURGE
Amazon Software Engineer / Developer Linked Lists - 0of 0 votes
AnswersGiven 2 linked lists(which need not have unique elements) find intersection point in the form of Y.(it can be anywhere--middle or tail)
- Vaishnavi November 10, 2009
Hint: dont compare values, compare addresses| Report Duplicate | Flag | PURGE
Amazon Software Engineer / Developer Linked Lists - 0of 0 votes
AnswersReverse a linked list. First I gave recursive. Then was asked for iterative.
- Vaishnavi November 10, 2009| Report Duplicate | Flag | PURGE
Amazon Software Engineer / Developer Linked Lists - 0of 0 votes
AnswersTelephoic:
- rider October 17, 2009
Given a linked list, findout wether it is a palindrome or not,
I have given a solution with extra space, after that he asked as ..
No extra space is allowed,
expecting most efficient| Report Duplicate | Flag | PURGE
Amazon Software Engineer / Developer Linked Lists - 0of 0 votes
AnswersWrite a program for a function which takes two lists(l1,l2) and return a node which merges the two list as follows.
- pavan October 13, 2009
l1:a ->b->c->d ->null
l2: 1->2->3->4->null
l3: a->1->b->2->c->3->d->4->null| Report Duplicate | Flag | PURGE
Amazon Software Engineer in Test Linked Lists - 0of 0 votes
AnswersFind an item in a sorted link list.
- Anonymous October 08, 2009
Write test cases.
Don't forget to ask if the list is sorted in an ascending or descending order.| Report Duplicate | Flag | PURGE
Microsoft Software Engineer in Test Linked Lists - 0of 2 votes
AnswersHow would you traverse a linked list with complexity O(n^0.5)?
- Murhty September 22, 2009| Report Duplicate | Flag | PURGE
Apple Software Engineer / Developer Linked Lists - 0of 0 votes
AnswersWithout using an additional linked list arrange elements such that all even numnbers are placed after odd numbers
- Vaishnavi September 15, 2009| Report Duplicate | Flag | PURGE
Amazon Testing / Quality Assurance Linked Lists - 0of 0 votes
AnswersTo check whether one linked list is reverse of the other without taking extra space o(n) space.
- Anonymous August 08, 2009| Report Duplicate | Flag | PURGE
Linked Lists - 0of 0 votes
AnswersGiven a sorted linked list, delete all duplicate numbers, leave only distinct numbers from original list. e.g., given 1->2->3->3->4->4->5, return 1->2->5. Given 1->1->1->2->3, return 2->3.
- Anonymous July 28, 2009| Report Duplicate | Flag | PURGE
Microsoft Software Engineer in Test Testing Linked Lists - 0of 0 votes
AnswersPrint a linked list recursively in a reverse manner without changing the actual list
- fuckubloomberg July 26, 2009| Report Duplicate | Flag | PURGE
Bloomberg LP Amazon Financial Software Developer Software Engineer / Developer Linked Lists