Topic — Add New » Posts Last Poster Freshness
Amazon Interview Question for Software Engineer/Developer about Linked Lists 5 PsychoCoder 11 hours

Perform inplace(we cant create new node)merge of two sorted linked lists.

Amazon
Amazon placement 2 kartik 1 day

You are given a linked list. Apart from the normal "Next" pointer, there is one more pointer(random ptr) in each node which points to some random node of the list. How will you create a clone of such a list? (In less than O(n^2))

Binar Tree to Double Linked List (circular) Conversion 1 kasireddi 2 days
struct node {
   int data;
   struct node* left;
   struct node* right;
};
typedef struct node* Node;  

//root: Current tree node
//prev: this pointer should have the address of in-order predecessor of root
//head: this denoted head of final link list
void treeToDoublyList(Node root, Node & prev, Node & head)
{
   if (!root) return;
   treeToDoublyList(root->left, prev, head);  

   // current node's left points to previous node
   root->left = prev;
   if (prev)
       prev-...
Linked List 4 vikram.kuruguntla 6 days

Given a linked list as follows:
a->b->c->1->2->3
Arrange it in a manner it would return
a->1->b->2->c->3
Note:list contains even number of nodes.

Reverse a linked list every "given num" nodes 2 kartik 1 week

Input (num = 3)
1 -> 2 -> 3 -> 4 -> 5 -> 6 -> 7 -> 8 -> 9 -> 10

Output
3 -> 2 -> 1 -> 6 -> 5 -> 4 -> 9 -> 8 -> 7 -> 10

public static LinkedListNode reverseWhole(LinkedListNode head, int num) {
	if (head == null || head.next == null)
		return head;
	LinkedListNode[] headAndTail = reversePart(head, num);
	LinkedListNode newHead = headAndTail[0];
	LinkedListNode tail = headAndTail[1];
	LinkedListNode next = tail....
Microsoft Interview Question for Software Engineer/Developer (Fresher) about Linked Lists 3 camster 1 week

Reverse a Linked List in size of 2

Say LL is

1->2->3->4->5->6->7->8

Then u need to return

7->8->5->6->3->4->1->2

Microsoft
Amazon Interview Question for Software Engineer/Developer about Linked Lists 4 ragini 2 weeks

Integer has been represented in linked list. Eg. 7541 has been represented as 7->5->4->1 with 4 nodes each having a digit. Given 2 such linked lists, you need to compute the sum of them

Amazon
Amazon Interview Question for Software Engineer/Developer (Fresher) about Linked Lists 5 anuja 2 weeks

Print Reverse of linked list (dont reverse it) with only constant space.

Amazon
[closed] Convert a Sorterd Linked list in to a balanced Binary Search Tree 5 kartik 2 weeks

Given a Sorted Linked List.
Convert it in to any balanced Binary Search Tree.
Validate that the output is really a balanced tree.

Ex:
Input

1 --> 2 --> 3 --> 4--> 5 --> NULL

Output

                                        3
                                  /         \
                             1                 5
                               \              /
                                 2          4
Amazon Interview Question for Software Engineer/Developer (0 - 2 Years) 3 Aashish Barnwal 3 weeks

Question 3 / 3
You are given a function isListPalindrome which takes in a singly linked list of integers. Complete the function given, return 1 if the linked list is a palindrome, else return 0.
Sample Test Cases:

Input #00:
1->2->1

Output #00:
1

Explanation:
The linked list when reversed still reads as 1->2->1. Hence it's a palindrome, return 1;

Amazon
Microsoft Interview Question for Software Engineer/Developer (Fresher) about Linked Lists 1 jyoti 3 weeks

Implement the function : node * add(node *l1, node *l2). The lists L1 and L2 are linked lists where each node of the linked list contains a single hexadecimal digit, represented as a char. The whole list thus represents a hexadecimal number. We had to add the two hex numbers represented in l1 and l2, and return the head of the linked list representing the answer.

Microsoft
Amazon Interview Question for Software Engineer/Developer (Fresher) about Linked Lists 4 mdmobashir 1 month

swap adjacent nodes of given linked list using one pointer

Amazon
Recursively reverse 2 kartik 1 month

Give an efficient algorithm to RECURSIVELY reverse a singly linked list with minimum time and space complexity

Microsoft Interview Question for Software Engineer/Developer (Fresher) about Linked Lists 2 Aashish Barnwal 1 month

ROUND 3 :

1.Do the same merging of linked list recursively if an iterative solution was given in round 2 or the other way.

Microsoft
Microsoft Interview Question for Software Engineer/Developer (Fresher) about Linked Lists 6 Aashish Barnwal 1 month

ROUND 2 :

1.Write a function that returns the result of merging two sorted linked lists . And find the time complexity of your proposed solution .

Microsoft
Reversing doubly linked list 5 camster 1 month

Give an algorithm to reverse a doubly linked list in less than linear time

Adobe Interview Question for Software Engineer/Developer (Fresher) about Algorithms, Aptitiude, C++, 3 beacon 1 month

Given 2 trees A and B find if tree B is a subtree of Tree A or not. Provide the most optimized solution that you can think of.

Adobe