Skip to content

Category Archives: Data Structures

The best data structure to check whether an arithmetic expression has balanced parentheses is a (GATE CS 2004) (A) queue (B) stack (C) tree (D)… 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
Consider the following C program segment struct CellNode {   struct CelINode *leftchild;   int element;   struct CelINode *rightChild; }    int Dosomething(struct CelINode *ptr) {     int… 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 elements 32, 15, 20, 30, 12, 25, 16 are inserted one by one in the given order into a Max Heap. The resultant Max… Read More
In the worst case, the number of comparisons needed to search a singly linked list of length n for a given element is (GATE CS… Read More
A scheme for storing binary trees in an array X is as follows. Indexing of X starts at 1 instead of 0. the root is… Read More
Which data structure is commonly used to implement the navigation system in a mapping application, helping users find the shortest route between locations? (A) Heap… Read More
How many undirected graphs (not necessarily connected) can be constructed out of a given set V= {V 1, V 2,…V n} of n vertices ?… Read More
Consider an undirected unweighted graph G. Let a breadth-first traversal of G be done starting from a node r. Let d(r, u) and d(r, v)… Read More
Let S be a stack of size n >= 1. Starting with the empty stack, suppose we push the first n natural numbers in sequence,… Read More
Suppose the numbers 7, 5, 1, 8, 3, 6, 0, 9, 4, 2 are inserted in that order into an initially empty binary search tree.… 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
The following postfix expression with single digit operands is evaluated using a stack: 8 2 3 ^ / 2 3 * + 5 1 *… Read More
The height of a binary tree is the maximum number of edges in any root to leaf path. The maximum number of nodes in a… Read More