Skip to content
All Medium Articles
Consider the following operation along with Enqueue and Dequeue operations on queues, where k is a global parameter. MultiDequeue(Q){ m = k while (Q is… Read More
Total 3 rounds. 1st written followed by 2 face to face and every round was ELIMINATION one.  Round 1(Written – 1hr): 3 sections. 20 min… Read More
Output? (GATE CS 2012) #include <stdio.h> int a, b, c = 0; void prtFun (void); int main () {     static int a = 1; /*… Read More
Given a number N, generate bit patterns from 0 to 2^N-1 such that successive patterns differ by one bit.  Examples: Input: N = 2 Output:… Read More
Which of the following operations is not O(1) for an array of sorted data. You may assume that array elements are distinct. (A) Find the… Read More
The array representation of a complete binary tree contains the data in sorted order. Which traversal of the tree will produce the data in sorted… Read More
We have discussed iterative inorder and iterative preorder traversals. In this post, iterative postorder traversal is discussed, which is more complex than the other two… Read More
Given a linked list where in addition to the next pointer, each node has a child pointer, which may or may not point to a… Read More
Let s be a sorted array of n integers. Let t(n) denote the time taken for the most efficient algorithm to determined if there are… Read More
Suppose each set is represented as a linked list with elements in arbitrary order. Which of the operations among union, intersection, membership, cardinality will be… Read More
I recently had interview with Microsoft and i have been selected. I am really thankful to geeksforgeeks site which provides preparation material for technical interviews… Read More
Recently I have gone through 10 rounds of interviews of my dream company Amazon for SDE1 and I got selected. My only resource and library… Read More
A single array A[1..MAXSIZE] is used to implement two stacks. The two stacks grow from opposite ends of the array. Variables top1 and top2 (topl<… Read More
The problem 3-SAT and 2-SAT are (A) both in P (B) both NP complete (C) NP-complete and in P respectively (D) undecidable and NP-complete respectively… Read More
What is the time complexity of the following recursive function: int DoSomething (int n)  {   if (n <= 2)     return 1;   else       return (DoSomething (floor(sqrt(n)))… Read More
A weight-balanced tree is a binary tree in which for each node. The number of nodes in the left sub tree is at least half… Read More
Given an array of numbers, arrange them in a way that yields the largest value. For example, if the given numbers are {54, 546, 548,… Read More
Recently got interviewed with amazon Hyderabad for SDE1. Written 1) Given a BST, along with left and right pointer for a node, it has forward… Read More
In quick sort, for sorting n elements, the (n/4)th smallest element is selected as pivot using an O(n) time algorithm. What is the worst case… Read More
Suppose the elements 7, 2, 10 and 4 are inserted, in that order, into the valid 3- ary max heap found in the above question,… Read More