Basic Data Structures
254 past exam problems with worked solutions.
Practise them on GATE DA →
Trees
- UGC-NET Jan 2017: Which of the following statements is false?
- UGC-NET Dec 2014: A full binary tree with n leaves contains
- UGC-NET Jul 2016: The number of different binary trees with 6 nodes is
- UGC-NET Nov 2017: Consider a full binary tree with n internal nodes, internal path length i, and external path length e. The internal…
- UGC-NET Dec 2012: The worst case time complexity of AVL is tree is better in comparison to binary search tree for
- UGC-NET Jun 2012: The Inorder traversal of the tree will yield a sorted listing of elements of tree in
- UGC-NET Jun 2012: A binary search tree is a binary tree in which
- UGC-NET Oct 2020: 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…
- UGC-NET Sep 2013: The minimum number of nodes in a binary tree of depth d (root at level 0) is
- UGC-NET Sep 2013: Consider the In-order and Post-order traversals of a tree as given below: In-order: j e n k o p b f a c l g m d h i…
- UGC-NET Dec 2012: In which tree, for every node the height of its left subtree and right subtree differ almost by 1?
- UGC-NET Dec 2015: The number of disk pages access in B-tree search, where h is height, n is the number of keys and t is the minimum…
- UGC-NET Jun 2015: Consider the following statements: (i) Depth-first search is used to traverse a rooted tree. (ii) Pre-order,…
- UGC-NET Dec 2013: How many edges are there in a forest of t-trees containing a total of n vertices?
- UGC-NET Jun 2013: In any n -element heap, which of the following is the tightest correct statement about the number of nodes of height h?
- UGC-NET Nov 2017: Heap allocation is required for languages that
- UGC-NET Jul 2016: Suppose that we have numbers between 1 and 1,000 in a binary search tree and want to search for the number 364. Which…
- UGC-NET Sep 2013: Given a binary search trees for a set of n=5 keys with the following probabilities: hline i 0 1 2 3 4 5; hline p_i -…
- UGC-NET Dec 2012: Suppose that someone starts with a chain letter. Each person who receives the letter is asked to send it on to 4 other…
- UGC-NET Dec 2014: A certain tree has two vertices of degree 4, one vertex of degree 3 and one vertex of degree 2. If the other vertices…
- UGC-NET Jul 2016: Suppose you are given a binary tree with n nodes, such that each node has exactly eiter zero or two children. The…
- UGC-NET Jun 2012: To represent hierarchical relationship between elements, which data structure is suitable?
- UGC-NET Jun 2012: Number of binary trees formed with 5 nodes are
- UGC-NET Dec 2014: Suppose that we have numbers between 1 and 1000 in a binary search tree and we want to search for the number 365.…
- UGC-NET Dec 2018: A binary search tree is constructed by inserting the following numbers in order: 60, 25, 72, 15, 30, 68, 101, 13, 18,…
- GATE DA 2024: Consider the following tree traversals on a full binary tree: (i) Preorder (ii) Inorder (iii) Postorder Which of the…
- GATE DA 2024: Let H, I, L, and N represent height, number of internal nodes, number of leaf nodes, and the total number of nodes…
- GATE DA 2026: You are given the following Pre-order and In-order traversals of a Binary Tree T with nodes E, F, G, P, Q, R, S.…
- GATE CS 2025 · Set 2: Consider a binary tree T in which every node has either zero or two children. Let n > 0 be the number of nodes in T.…
- GATE CS 2025 · Set 2: Suppose the values 10, -4, 15, 30, 20, 5, 60, 19 are inserted in that order into an initially empty binary search…
- GATE CS 2025 · Set 1: Which of the following statement(s) is/are TRUE for any binary search tree (BST) having n distinct integers?
- GATE CS 2025 · Set 1: The height of any rooted tree is defined as the maximum number of edges in the path from the root node to any leaf…
Arrays & Matrix Representation
- UGC-NET Dec 2008: If (rear==maxsize-1) rear=0; else rear=rear+1; is required in:
- UGC-NET Oct 2020: In a binary max heap containing n numbers, the smallest element can be found in ______
- UGC-NET Jul 2016: The number of different spanning trees in complete graph, K_4 and bipartite graph, K_2,2 have ____ and ___ respectively.
- UGC-NET Jun 2012: Which of the following data structure is linear type?
- UGC-NET Jun 2013: Suppose you want to delete the name that occurs before ‘Vivek’ in an alphabetical listing. Which one of the following…
- UGC-NET Sep 2013: Which of the following is the minimum cost for an assignment problem given below? Jobs hline A B C D; hline I 5 3 2 8;…
- UGC-NET Jul 2016: Which one of the following array represents a binary max-heap?
- UGC-NET Jun 2013: Consider the following statements for priority queue: S1: It is a data structure in which the intrinsic ordering of…
- UGC-NET Jan 2017: A recursive function h, is defined as follows: h(m) =k, if m=0; =1, if m=1; = 2 h(m-1)+4h(m-2), if m ≥ 2 If the value…
- UGC-NET Jun 2015: Level order Traversal of a rooted Tree can be done by starting from root and performing:
- UGC-NET Dec 2014: When an array is passed as parameter to a function, which of the following statements is correct?
- UGC-NET Jun 2013: Arrays in C language can have ____ with reference to memory representation.
- UGC-NET Jun 2015: What is the output of the following program: (Assume that the appropriate preprocessor directives are included and…
- UGC-NET Oct 2020: Suppose you are compiling on a machine with 1 -byte chars, 2 -byte shorts, 4 -byte ints, and 8 -byte doubles, and with…
- UGC-NET Dec 2014: Consider an array A[20, 10], assume 4 words per memory cell and the base address of array A is 100. What is the…
- GATE CS 2026 · Set-2: Consider a stack S and a queue Q. Both of them are initially empty and have the capacity to store ten elements each.…
- GATE CS 2026 · Set-2: Consider a binary search tree (BST) with n leaf nodes (n>0). Given any node V, the key present in the node is denoted…
- GATE CS 2026 · Set-2: The set T represents various traversals over binary tree. The set S represents the order of visiting nodes during a…
- GATE CS 2026 · Set-1: The following sequence corresponds to the preorder traversal of a binary search tree T:…
- GATE CS 2026 · Set-1: Let P be the set of all integers from 1 to 15. Consider any order of insertion of the elements of P into a binary…
- GATE CS 2026 · Set-1: Consider the following code snippet in C language that computes the number of nodes in a non-empty singly linked list…
- GATE CS 2026 · Set-1: The height of a binary tree is the number of edges in the longest path from the root to a leaf in the tree. The…
- GATE CS 2026 · Set-1: Let n be an odd number greater than 100. Consider a binary minheap with n elements stored in an array P whose index…
- GATE CS 2025 · Set-2: Consider an unordered list of N distinct integers. What is the minimum number of element comparisons required to find…
- GATE CS 2024 · Set-2: Let S1 and S2 be two stacks. S1 has capacity of 4 elements. S2 has capacity of 2 elements. S1 already has 4 elements:…
- GATE CS 2024 · Set-2: You are given a set V of distinct integers. A binary search tree T is created by inserting all elements of V one by…
- GATE CS 2024 · Set-2: Let A be an array containing integer values. The distance of A is defined as the minimum number of elements in A that…
- GATE CS 2024 · Set-1: Consider a binary min-heap containing 105 distinct elements. Let k be the index (in the underlying array) of the…
- GATE CS 2024 · Set-1: An array [82,101,90,11,111,75,33,131,44,93] is heapified. Which one of the following options represents the first…
- GATE CS 2024 · Set-1: Consider the operator precedence and associativity rules for the integer arithmetic operators given in the table…
- GATE CS 2023: Consider a sequence a of elements a_0 = 1, a_1 = 5, a_2 = 7, a_3 = 8, a_4 = 9, and a_5 = 2. The following operations…
- GATE CS 2023: Which one of the following sequences when stored in an array at locations A[1],..., A[10] forms a max-heap?
- GATE CS 2022: Consider the queues Q1 containing four elements and Q2 containing none (shown as the Initial State in the figure). The…
- GATE CS 2022: Suppose a binary search tree with 1000 distinct elements is also a complete binary tree. The tree is stored using the…
- GATE CS 2021 · Set-2: Consider the following ANSI C program: #include <stdio.h> #include <stdlib.h> struct Node int value; struct Node…
- GATE CS 2021 · Set-1: Consider the following sequence of operations on an empty stack. push(54); push(52); pop(); push(55); push(62);…
- GATE CS 2021 · Set-1: Let P be an array containing n integers. Let t be the lowest upper bound on the number of comparisons of the array…
- ISRO 2020: A stack is implemented with an array A[0.. N-1] and a variable pos. The push and pop operations are defined by the…
- ISRO 2020: Of the following, which best approximates the ratio of the number of nonterminal nodes in the total number of nodes in…
- ISRO 2020: The post-order traversal of binary tree is ACEDBHIGF. The pre-order traversal is
- ISRO 2020: The minimum height of an AVL tree with n nodes is
- ISRO 2020: Consider the following binary search tree. The root is 15, with left child 6 and right child 18. Node 6 has left child…
- ISRO 2020: Consider a 2-dimensional array x with 10 rows and 4 columns, with each element storing a value equivalent to the…
- ISRO 2020: Convert the pre-fix expression to in-fix -^*+A B C^*-D E+F G
- GATE CS 2020: Consider the array representation of a binary min-heap containing 1023 elements. The minimum number of comparisons…
- GATE CS 2020: The preorder traversal of a binary search tree is 15,10,12,11,20,18,16,19. Which one of the following is the postorder…
- GATE CS 2019: Let T be a full binary tree with 8 leaves. (A full binary tree has every level full.) Suppose two leaves a and b of T…
- ISRO 2018: A doubly linked list is declared as: struct Node int Value; struct Node *Fwd; struct Node *Bwd;;Where Fwd and Bwd…
- ISRO 2018: Consider a singly linked list of the form where F is a pointer to the first element in the linked list and L is the…
- ISRO 2018: An array A consists of n integers in locations A[0], A[1],..., A[n-1]. It is required to shift the elements of the…
- GATE CS 2018: The number of possible min-heaps containing each value from 1, 2, 3, 4, 5, 6, 7 exactly once is _____. rule2.5cm0.4pt
- GATE CS 2018: The postorder traversal of a binary tree is 8,9,6,7,4,5,2,3,1. The inorder traversal of the same tree is…
- ISRO 2017: Choose the equivalent prefix form of the following expression (a+(b-c))^star((d-e) /(f+g-h))
- ISRO 2017: In a doubly linked list the number of pointers affected for an insertion operation will be
- ISRO 2017: The 7 nodes of a binary tree are numbered 1 to 7 level by level, left to right: node 1 is the root, nodes 2 and 3 are…
- ISRO 2017: Given two statements Insertion of an element should be done at the last node of the circular list Deletion of an…
- GATE CS 2017 · Set-2: The pre-order transversal of a binary search tree is given by 12, 8, 6, 2, 7, 9, 10, 16, 15, 19, 17, 20. Then the…
- GATE CS 2017 · Set-1: Consider the C code fragment given below. typedef struct node int data; node* next; node; void join (node* m, node* n)…
- GATE CS 2017 · Set-1: Let T be a binary search tree with 15 nodes. The minimum and maximum possible heights of T are: Note: The height of a…
- ISRO 2016: A complete binary tree with n non-leaf nodes contains
- ISRO 2016: The average number of key comparisons required for a successful search for sequential search on n items is
- GATE CS 2007: The following postfix expression with single digit operands is evaluated using a stack: 8 2 3 / 2 3 * + 5 1 * - Note…
- GATE CS 2016 · Set-2: The number of ways in which the numbers 1,2,3,4,5,6,7 can be inserted in an empty binary search tree, such that the…
- GATE CS 2016 · Set-2: Consider the following New-order strategy for traversing a binary tree: Visit the root; Visit the right sub tree using…
- GATE CS 2016 · Set-2: A complete binary min-heap is made by including each integer in [1,1023] exactly once. The depth of a node in the heap…
- GATE CS 2016 · Set-1: Let Q denote a queue containing sixteen numbers and S be an empty stack. Head(Q) returns the element at the head of…
- ISRO 2015: The queue data structure is to be realized by using stack. The number of stacks needed would be
- ISRO 2015: If the sequence of operations - push (1), push (2), pop, push (1), push (2), pop, pop, pop, push (2), pop are…
- GATE CS 2015 · Set-3: Consider the following two C code segments. Y and X are one- and two-dimensional arrays of size n and n × n…
- GATE CS 2015 · Set-3: Consider the following array of elements. (89,19,50,17,12,15,2,5,7,11,6,9,100) The minimum number of interchanges…
- GATE CS 2015 · Set-3: The result evaluating the postfix expression 10 5 + 60 6 / * 8 - is
- GATE CS 2015 · Set-3: While inserting the elements 71, 65, 84, 69, 67, 83 in an empty binary search tree (BST) in the sequence shown, the…
- GATE CS 2015 · Set-3: Consider a binary tree T that has 200 leaf nodes. Then, the number of nodes in T that have exactly two children are…
- GATE CS 2015 · Set-2: A binary tree T has 20 leaves. The number of nodes in T having two children is _______. rule2.5cm0.4pt
- GATE CS 2015 · Set-1: Consider a max heap, represented by the array: 40, 30, 20, 10, 15, 16, 17, 8, 4. Now consider that a value 35 is…
- GATE CS 2015 · Set-1: Which of the following is/are correct inorder traversal sequence(s) of binary search tree(s)? I. 3, 5, 7, 8, 15, 19,…
- GATE CS 2015 · Set-1: The height of a tree is the length of the longest root-to-leaf path in it. The maximum and minimum number of nodes in…
- ISRO 2014: How many different trees are there with four nodes A,B,C and D?
- ISRO 2014: A frame buffer array is addressed in row-major order for a monitor with pixel locations starting from (0,0) and ending…
- ISRO 2014: The five items: A, B, C, D, and E are pushed in a stack, one after other starting from A. The stack is popped four…
- ISRO 2014: Consider a standard Circular Queue implementation (which has the same condition for Queue Full and Queue Empty) whose…
- ISRO 2014: Suppose there are 11 items in sorted order in an array. How many searches are required on the average, if binary…
- GATE CS 2014 · Set-3: Consider the pseudocode given below. The function Dosomething () takes as argument a pointer to the root of an…
- GATE CS 2014 · Set-2: Suppose a stack implementation supports an instruction REVERSE, which reverses the order of elements on the stack, in…
- GATE CS 2014 · Set-2: A priority queue is implemented as a Max-Heap. Initially, it has 5 elements. The level-order traversal of the heap is:…
- ISRO 2013: In this question, a full binary tree is one in which every internal node has exactly two children and all leaves are…
- ISRO 2013: In an array of 2N elements that is both 2-ordered and 3-ordered, what is the maximum number of positions that an…
- ISRO 2013: The following steps in a linked list p = getnode() info(p) = 10 next (p) = list list = p result in which type of…
- ISRO 2013: The number of rotations required to insert a sequence of elements 9, 6, 5, 8, 7, 10 into an empty AVL tree is?
- ISRO 2013: Let A(1:8, -5:5, -10:5) be a three dimensional array. How many elements are there in the array A?
- GATE CS 2013: The preorder traversal sequence of a binary search tree is 30, 20, 10, 15, 25, 23, 39, 35, 42. Which one of the…
- GATE CS 2012: The height of a tree is defined as the number of edges on the longest path in the tree. The function shown in the…
- GATE CS 2012: Suppose a circular queue of capacity (n-1) elements is implemented with an array of n elements. Assume that the…
- ISRO 2011: The in-order traversal of a complete binary tree with 7 nodes (all three levels full) resulted in FBGADCE. Then the…
- GATE CS 2011: We are given a set of n distinct elements and an unlabeled binary tree with n nodes. In how many ways can we populate…
- GATE CS 2010: The following C function takes a simply-linked list as input argument. It modifies the list by moving the last element…
- GATE CS 2010: In a binary tree with n nodes, every node has an odd number of descendants. Every node is considered to be its own…
- ISRO 2009: The expression 1 * 2 wedge 3 * 4 wedge 5 * 6 will be evaluated as
- ISRO 2009: A one dimensional array A has indices 1....75. Each element is a string and takes up three memory words. The array is…
- ISRO 2009: The infix expression A+(B-C)^*D is correctly represented in prefix notation as
- ISRO 2009: The following numbers are inserted into an empty binary search tree in the given order: 10, 1, 3, 5, 15, 12, 16. What…
- GATE CS 2003: A data structure is required for storing a set of integers such that each of the following operations can be done in…
- ISRO 2009: 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. The…
- GATE CS 2009: Consider a binary max-heap implemented using an array. What is the content of the array after two delete operations on…
- GATE CS 2009: Consider a binary max-heap implemented using an array. Which one of the following array represents a binary max-heap?
- GATE CS 2009: What is the maximum height of any AVL-tree with 7 nodes? Assume that the height of a tree with a single node is 0.
- ISRO 2008: The minimum number of fields with each node of doubly linked list is
- ISRO 2008: A complete binary tree with the property that the value at each node is at least as large as the values at its…
- ISRO 2008: Which of the following operations is performed more efficiently by doubly linked list than by linear linked list?
- ISRO 2008: The time required to search an element in a linked list of length n is
- ISRO 2008: Stack A has the entries a, b, c (with a on top). Stack B is empty. An entry popped out of stack A can be printed…
- GATE IT 2008: A binary tree with n>1 nodes has n_1, n_2 and n_3 nodes of degree one, two and three respectively. The degree of a…
- GATE IT 2008: A binary tree with n>1 nodes has n_1, n_2 and n_3 nodes of degree one, two and three respectively. The degree of a…
- GATE IT 2008: How many distinct BSTs can be constructed with 3 distinct keys?
- GATE IT 2008: A Binary Search Tree (BST) stores values in the range 37 to 573. Consider the following sequence of keys. I.…
- GATE IT 2008: A Binary Search Tree (BST) stores values in the range 37 to 573. Consider the following sequence of keys. I.…
- GATE IT 2008: The following three are known to be the preorder, inorder and postorder sequences of a binary tree. But it is not…
- GATE CS 2008: The following C function takes a single-linked list of integers as a parameter and rearranges the elements of the…
- GATE CS 2008: We have a binary heap on n elements and wish to insert n more elements (not necessarily one after another) into this…
- GATE CS 2008: You are given the postorder traversal, P, of a binary search tree on the n elements 1, 2,...,n. You have to determine…
- GATE CS 2008: The minimum number of comparisons required to determine if an integer appears more than n/2 times in a sorted array of…
- GATE IT 2007: Consider the following C program: #include <stdio.h> #include <ctype.h> #define EOF -1 void push (int); /* push the…
- GATE IT 2007: Suppose you are given an implementation of a queue of integers. The operations that can be performed on the queue are:…
- GATE IT 2007: When searching for the key value 60 in a binary search tree, nodes containing the key values 10, 20, 40, 50, 70, 80,…
- GATE CS 2007: An array of n numbers is given, where n is an even number. The maximum as well as the minimum of these n numbers needs…
- GATE CS 2007: Consider the following C program segment where CellNode represents a node in a binary tree: struct CellNode struct…
- GATE CS 2007: The inorder and preorder traversal of a binary tree are d b e a f c g and a b d e c f g, respectively The postorder…
- GATE CS 2007: The maximum number of binary trees that can be formed with three unlabeled nodes is:
- GATE CS 2007: 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…
- GATE IT 2006: An array X of n distinct integers is interpreted as a complete binary tree. The index of the first element of the…
- GATE IT 2006: An array X of n distinct integers is interpreted as a complete binary tree. The index of the first element of the…
- GATE IT 2006: An array X of n distinct integers is interpreted as a complete binary tree. The index of the first element of the…
- GATE IT 2006: Suppose that we have numbers between 1 and 100 in a binary search tree and want to search for the number 55. Which of…
- GATE IT 2006: Which of the following sequences of array elements forms a heap?
- GATE IT 2006: In a binary tree, the number of internal nodes of degree 1 is 5, and the number of internal nodes of degree 2 is 10.…
- GATE CS 2006: A 3-ary max heap is like a binary max heap, but instead of 2 children, nodes have 3 children. A 3-ary heap can be…
- GATE CS 2006: A 3-ary max heap is like a binary max heap, but instead of 2 children, nodes have 3 children. A 3-ary heap can be…
- GATE CS 2006: Given two arrays of numbers a_1,...,a_n and b_1,...,b_n where each number is 0 or 1, the fastest algorithm to find the…
- GATE CS 2006: An implementation of a queue Q, using two stacks S1 and S2, is given below: void insert(Q, x) push(S1, x); void…
- GATE CS 2006: An element in an array X is called a leader if it is grater than all elements to the right of it in X. The best…
- GATE CS 2006: A scheme for storing binary trees in an array X is as follows. Indexing of X starts at 1 instead of 0. The roots is…
- GATE IT 2005: Let a and b be two sorted arrays containing n integers each, in non-decreasing order. Let c be a sorted array…
- GATE IT 2005: A binary search tree contains the numbers 1,2,3,4,5,6,7,8. When the tree is traversed in pre-order and the values in…
- GATE IT 2005: In a binary tree, for every node the difference between the number of nodes in the left and right subtrees is at most…
- GATE IT 2005: A function f defined on stacks of integers satisfies the following properties. f(∅) = 0 and f (push (S, i)) = max…
- GATE IT 2005: The numbers 1, 2,.… n are inserted in a binary search tree in some order. In the resulting tree, the right subtree of…
- GATE CS 2005: In a complete k-ary tree, every internal node has exactly k children. The number of leaves in such a tree with n…
- GATE CS 2005: How many distinct binary search trees can be created out of 4 distinct keys?
- GATE CS 2005: Postorder traversal of a given binary search tree, T produces the following sequence of keys 10, 9, 23, 22, 27, 25,…
- GATE CS 2005: A program P reads in 500 integers in the range [0,100] representing the scores of 500 students. It then prints the…
- GATE IT 2004: An array of integers of size n can be converted into a heap by adjusting the heaps rooted at each internal node of the…
- GATE IT 2004: A program attempts to generate as many permutations as possible of the string, 'abcd' by pushing the characters…
- GATE IT 2004: Let P be a singly linked list. Let Q be the pointer to an intermediate node x in the list. What is the worst-case time…
- GATE CS 2004: A program takes as input a balanced binary search tree with n leaf nodes and computes the value of a function g(x) for…
- GATE CS 2004: Consider the following C program segment struct CellNode struct CelINode *leftchild; int element; struct CelINode…
- GATE CS 2004: Suppose each set is represented as a linked list with elements in arbitray order. Which of the operations among union,…
- GATE CS 2004: Two matrices M1 and M2 are to be stored in arrays A and B respectively. Each array can be stored either in row-major…
- GATE CS 2004: Assume that the operators +, -, × are left associative and wedge (exponentiation) is right associative. The order of…
- GATE CS 2004: A circularly linked list is used to represent a Queue. A single variable p is used to access the Queue. To which node…
- GATE CS 2004: Consider the label sequences obtained by the following pairs of traversals on a labeled binary tree. Which of these…
- GATE CS 2004: The best data structure to check whether an arithmetic expression has balanced parenthesis is a:
- GATE CS 2004: A single array A[1...MAXSIZE] is used to implement two stacks. The two stacks grow from opposite ends of the array.…
- GATE CS 2003: Consider the function f defined below. struct item int data; struct item * next;; int f(struct item *p) return ((p ==…
- GATE CS 2003: Let S be a stack of size n ≥ 1. Starting with the empty stack, suppose we push the first n natural numbers in…
- GATE CS 2003: In a heap with n elements with the smallest element at the root, the 7^th smallest element ban be found in time
- GATE CS 2002: To evaluate an expression without any embedded function calls
- GATE CS 2002: A weight-balanced tree is a binary tree in which for each node, the number of nodes in the let sub tree is at least…
- GATE CS 2002: Consider the following algorithm for searching for a given number x in an unsorted array A[1.....n] having n distinct…
- GATE CS 2002: The number of leaf nodes in a rooted tree of n nodes, with each node having 0 or 3 children is
- GATE CS 2002: Consider the following declaration of a two-dimensional array in C: char a[100][100]; Assuming that the main memory is…
- GATE CS 2002: In the worst case, the number of comparisons needed to search a single linked list of length n for a given element is
- GATE CS 2000: Let LASTPOST, LASTIN and LASTPRE denote the last vertex visited `in a postorder, inorder and preorder traversal…
- GATE CS 2000: Suppose you are given an array s[1....n] and a procedure reverse (s, i, j) which reverses the order of elements in s…
- GATE CS 2000: Consider the following nested representation of binary trees: (X Y Z) indicates Y and Z are the left and right…
- GATE CS 2000: An n × n array v is defined as follows: v[i,j] = i - j for all i, j, i ≤ n, 1 ≤ j ≤ n The sum of the elements of the…
- GATE CS 1999: Suppose we want to arrange the n numbers stored in any array such that all negative values occur before all positive…
- GATE CS 1998: Let A be a two dimensional array declared as follows: A: array [1... 10] [1... 15] of integer; Assuming that each…
- GATE CS 1998: A complete n-ary tree is one in which every node has 0 or n sons. If x is the number of internal nodes of a complete…
- GATE CS 1997: A priority queue Q is used to implement a stack that stores characters. PUSH (C) is implemented as INSERT (Q,C,K)…
- GATE CS 1997: A binary search tree contains the value 1,2,3,4,5,6,7,8. The tree is traversed in pre-order and the values are printed…
- GATE CS 1997: Which of the following is essential for converting an infix expression to the postfix form efficiently?
- GATE CS 1996: A binary search tree is generated by inserting in order the following integers: 50,15,62,5,20,58,91,3,8,37,60,24 The…
- GATE CS 1996: The minimum number of interchanges needed to convert the array into a max-heap is 89, 19, 40, 17, 12, 10, 2, 5, 7, 11,…
- GATE CS 1996: Consider the binary tree with root a. The root's left child is b and its right child is e. Node b has left child c and…
- GATE CS 1996: Consider the following balanced (AVL) binary tree: with root a. The root's left child is b and its right child is e.…
- GATE CS 1996: Consider the following statements: (i). First-in-first out types of computations are efficiently supported by STACKS.…
- GATE CS 1995: The postfix expression for the infix expression A+B*(C+D)/F+D*E is:
- GATE CS 1995: A binary tree T has n leaf nodes. The number of nodes of degree 2 in T is
- GATE CS 1995: For merging two sorted lists of sizes m and n into a sorted list of size m+n, we require comparisons of
- GATE CS 1994: Linked lists are not suitable data structures for which one of the following problems?
- GATE CS 1994: Which of the following permutations can be obtained in the output (in the same order) using a stack assuming that the…
- GATE CS 1994: In a compact single dimensional array representation for lower triangular matrices (i.e all the elements above the…
- GATE CS 2001: What is the minimum number of stacks of size n required to implement a queue to size n?
- GATE CS 2001: Consider any array representation of an n element binary heap where the elements are stored from index 1 to index n of…
- GATE CS 1991: Choose the correct alternatives (more than one may be correct) and write the corresponding letters only: The following…
- GATE CS 1990: The total external path length, EPL, of a binary tree with n external nodes is Σ_w l_w, where l_w is the path length…
- GATE CS 1990: The number of rooted binary trees (distinct shapes, nodes unlabelled) with n nodes is (more than one may be correct)
- GATE CS 1987: In a circular linked list oraganisation, insertion of a record involves modification of
- Curated: Consider the following declaration of a multi-dimensional array in C: int a[4][16][4][8] Assuming that the main memory…
Queues
- UGC-NET Jun 2011: When the priority queue is represented by max heap, the insertion and deletion of an element can be performed in…
- UGC-NET Sep 2013: The efficient data structure to insert/delete a number in a stored set of number is
- GATE DA 2024: The fundamental operations in a double-ended queue D are: insertFirst(e) - Insert a new element e at the beginning of…
- Curated: Consider the following Python code. from collections import deque q = deque() for x in [4, 7, 1, 9]: q.append(x)…
Stacks
- UGC-NET Jun 2012: The postfix expression AB + CD -* can be evaluated using a
- UGC-NET Dec 2012: Given an empty stack, after performing push(1), push(2), pop, push(3), push(4), pop, pop, push(5), pop, what is the…
- UGC-NET Dec 2014: How many PUSH and POP operations will be needed to evaluate the following expression by reverse polish notation in a…
- UGC-NET Dec 2014: Convert the following infix expression into its equivalent post fix expression (A + B ^ D) / (E – F) + G
- UGC-NET Jan 2017: The seven elements A, B, C, D, E,F and G are pushed onto a stack in reverse order, i.e., starting from G. The stack is…
- UGC-NET Jul 2016: Consider the following operations performed on a stack of size 5: Push (a); Pop(); Push(b); Push(c); Pop(); Push(d);…
- UGC-NET Jul 2016: Which of the following is not an inherent application of stack?
- UGC-NET Jun 2012: The following postfix expression is evaluated using a stack. 823^/23*+51*-. The top two elements of the stack after…
- UGC-NET Jun 2014: What is the maximum number of parenthesis that will appear on the stack at any one time for parenthesis expression…
- UGC-NET Jun 2014: The reverse polish notation equivalent to the infix expression ((A + B) ^* C + D)/(E + F + G)
- UGC-NET Dec 2018: Consider the following postfix expression with single digit operands: 6 2 3 ^* / 4 2 ^* + 6 8 ^* - The top two…
- GATE DA 2025: Consider the following pseudocode. Create empty stack S Set x=0, flag=0, sum=0 Push x onto S while (S is not empty) if…
- GATE DA 2024: Match the items in Column 1 with the items in Column 2 in the following table: hline Column 1 Column 2; hline (p)…
Linked Lists
- UGC-NET Dec 2013: If the queue is implemented with a linked list, keeping track of a front pointer, which of these pointers will change…
- GATE CS 2025 · Set 2: A meld operation on two instances of a data structure combines them into one single instance of the same data…
- Curated: Each node of a singly linked list has fields v and next. The function below reverses the list whose head is h, and…
Hash Tables
- GATE DA 2024: Consider performing uniform hashing on an open address hash table with load factor α=n/m<1, where n elements are…
- GATE DA 2025: Consider a hash table of size 10 with indices {0, 1, …, 9}, with the hash function h(x) = 3x mod 10, where linear…
- Curated: A hash table has 7 slots and resolves collisions by chaining, with h(k) = k bmod 7. Each new key is appended at the…
GATE DA practice: past exam problems by chapter, with worked solutions · gatedaprep.com