All Medium Articles

## Python Program for Heap Sort 3.5

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 »

## C Program for Merge Sort 3

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 »

## Zigzag (or diagonal) traversal of Matrix 3.1

Given a 2D matrix, print all elements of the given matrix in diagonal order. For example, consider the following 5 X 4 input matrix. 1… Read More »

## Data Structures | Binary Search Trees | Question 12 3

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 »

## Swap all odd and even bits 3.1

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 »

## C | Storage Classes and Type Qualifiers | Question 19 3

Output? filter_none edit close play_arrow link brightness_4 code #include <stdio.h> int main() {   register int i = 10;   int *ptr = &i;   printf(“%d”, *ptr);   return… Read More »

## A Pancake Sorting Problem 3.6

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 »

## Operating Systems | Process Management | Question 6 3

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 »

## Microsoft Interview | 16 3.5

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 »

## C | Arrays | Question 9 3

Predict the output of the below program: filter_none edit close play_arrow link brightness_4 code #include <stdio.h> #define SIZE(arr) sizeof(arr) / sizeof(*arr); void fun(int* arr, int… Read More »

## C | Loops & Control Structure | Question 16 3

What is the output of the following program? filter_none edit close play_arrow link brightness_4 code #include <stdio.h> int main() {     char check = ‘a’;     switch… Read More »

## C | Loops & Control Structure | Question 15 3

In the following program, X represents the Data Type of the variable check. filter_none edit close play_arrow link brightness_4 code #include <stdio.h> int main() {… Read More »

## C++ | References | Question 6 3

Which of the following is FALSE about references in C++ (A) References cannot be NULL (B) A reference must be initialized when declared (C) Once… Read More »

## Algorithms | Analysis of Algorithms | Question 18 3

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

## Data Structures and Algorithms | Set 30 3.7

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 »

## Data Structures | Queue | Question 10 3.6

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 »

## D E Shaw Interview | Set 1 3

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 »

## C | Storage Classes and Type Qualifiers | Question 19 3.4

Output? (GATE CS 2012) filter_none edit close play_arrow link brightness_4 code #include <stdio.h> int a, b, c = 0; void prtFun (void); int main ()… Read More »

## Generate n-bit Gray Codes 3.4

Given a number n, generate bit patterns from 0 to 2^n-1 such that successive patterns differ by one bit. Examples: Following is 2-bit sequence (n… Read More »

## Data Structures | Tree Traversals | Question 12 3

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 »