Consider the following C program segment struct CellNode { struct CelINode *leftchild; int element; struct CelINode *rightChild; } int Dosomething(struct CelINode *ptr) { int… Read More
Tag Archives: Data Structures
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
A complete n-ary tree is a tree in which each node has n children or no children. Let I be the number of internal nodes… Read More
A weight-balanced tree is a binary tree in which for each node. The number of nodes in the left sub tree is at least half… Read More