Skip to content
All Medium Articles
Heapsort is a comparison based sorting technique based on a Binary Heap data structure. It is similar to selection sort where we first find the… Read More
Merge Sort is a Divide and Conquer algorithm. It divides input array in two halves, calls itself for the two halves and then merges the… Read More
Merge Sort is a Divide and Conquer algorithm. It divides input array in two halves, calls itself for the two halves and then merges the… Read More
Given a 2D matrix, print all elements of the given matrix in diagonal order. For example, consider the following 5 X 4 input matrix.   Example:… Read More
Consider the same code as given in above question. What does the function print() do in general? The function print() receives root of a Binary… Read More
Consider the following code snippet in C. The function print() receives root of a Binary Search Tree (BST) and a positive integer k as arguments.… Read More
Given an unsigned integer, swap all odd bits with even bits. For example, if the given number is 23 (00010111), it should be converted to… Read More
Output? #include <stdio.h> int main() {   register int i = 10;   int *ptr = &i;   printf("%d", *ptr);   return 0; } (A) Prints 10 on all… Read More
We have discussed Pancake Sorting in the previous post. Following is a problem based on Pancake Sorting. Given an unsorted array, sort the given array.… Read More
Three concurrent processes X, Y, and Z execute three different code segments that access and update certain shared variables. Process X executes the P operation… Read More
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
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. 1st Round: 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