All Hard Articles
Given a Balanced Binary Search Tree and a target sum, write a function that returns true if there is a pair with sum equals to… Read More
Given a Balanced Binary Search Tree (BST), the task is to write a function isTripletPresent() which returns true if there is a triplet in the… Read More
Which of the following is/are true (A) calloc() allocates the memory and also initializes the allocates memory to zero, while memory allocated using malloc() has… Read More
The number of elements that can be sorted in time using heap sort is (A) (B) (C) (d) (A) A (B) B (C) C (D)… Read More
The preorder traversal sequence of a binary search tree is 30, 20, 10, 15, 25, 23, 39, 35, 42. Which one of the following is… Read More
Consider an undirected random graph of eight vertices. The probability that there is an edge between a pair of vertices is 1/2. What is the… Read More
Given a 2D array, find the maximum sum submatrix in it. For example, in the following 2D array, the maximum sum submatrix is highlighted with… Read More
We have discussed a simple iterative postorder traversal using two stacks in the previous post. In this post, an approach with only one stack is… Read More
In a min-heap with n elements with the smallest element at the root, the 7th smallest element can be found in time: (A) theta(nlogn) (B)… Read More
We have a binary heap on n elements and wish to insert n more elements (not necessarily one after another) into this heap. The total… Read More
The following  function takes a single-linked list of integers as a parameter and rearranges the elements of the list. The function is called with the… Read More
A list of n string, each of length n, is sorted into lexicographic order using the merge-sort algorithm. The worst case running time of this… Read More
To design an efficient data structure for a specific set of operations, it’s important to consider the time and space complexity of different data structures… Read More
How many different insertion sequences of the key values using the hash function h(k) = k mod 10 and linear probing will result in the… Read More
Consider a complete undirected graph with vertex set {0, 1, 2, 3, 4}. Entry Wij in the matrix W below is the weight of the… Read More
Suppose we are sorting an array of eight integers using heapsort, and we have just finished some heapify (either maxheapify or minheapify) operations. The array… Read More
Consider the directed graph shown in the figure below. There are multiple shortest paths between vertices S and T. Which one will be reported by… Read More
What is the worst case time complexity of following implementation of subset sum problem.  C // Returns true if there is a subset of set[]… Read More
#include<stdio.h>  int main()  {     int a;     char *x;     x = (char *) &a;     a = 512;     x[0] = 1;     x[1] = 2;     printf("%d\n",a);       return 0; … Read More
A CPU generates 32-bit virtual addresses. The page size is 4 KB. The processor has a translation look-aside buffer (TLB) which can hold a total… Read More