What is the difference between struct and class in C++? (A) All members of a structure are public and structures don’t have constructors and destructors… Read More

All Medium Articles

I was interviewed for Microsoft App-Ex Team. I was selected. I am really thankful to GeeksForGeeks site which provides preparation material for technical interviews organised… Read More

Predict the output of the below program: #include <stdio.h> #define SIZE(arr) sizeof(arr) / sizeof(*arr); void fun(int* arr, int n) { int i; *arr += *(arr… Read More

In the following program, X represents the Data Type of the variable check. #include <stdio.h> int main() { X check; switch (check) { // Some… Read More

Consider the following function int unknown(int n) { int i, j, k = 0; for (i = n/2; i

Following questions have been asked in GATE CS 2013 exam. 1) Which of the following statements is/are TRUE for an undirected graph? P: Number of… Read More

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

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

Consider the function f defined below. struct item { int data; struct item * next; }; int f(struct item *p) { return ( (p… 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