search
Log In
Quick search syntax
tags tag:apple
author user:martin
title title:apple
content content:apple
exclude -tag:apple
force match +apple
views views:100
score score:10
answers answers:2
is accepted isaccepted:true
is closed isclosed:true
Welcome to GATE CSE Doubts, where you can ask questions and receive answers from other members of the community.

Recent questions tagged data-structures

0 votes
2 answers 15 views
Please solve the following question: Evaluate the Infix expression /-*25*12-119 ?
asked Jul 13 in DS Lata Patwal 9 points 15 views
0 votes
1 answer 10 views
In Mid Square Method(Hashing), we square the given number and then use appropriate bits from the middle. Can we have so many answers for a particular question? On what basis we choose the middle digit? What if the square is 4 digit 1234, then what will be the middle value? Will it be 23 or 2 or 3. Please explain.
asked Jul 10 in DS Lata Patwal 9 points 10 views
0 votes
0 answers 24 views
In avl tree can we take base case for minimum height as n(1)=2 rather than n(0)=1 in the recurrence relation : n(h)=2n(h-1)+1 where h is height of the tree.
asked May 23 in DS prateek_hazard 5 points 24 views
1 vote
1 answer 39 views
I have a very generic doubt about the Trees concept in Data structures subject, Are Trees in the subject implicitly assumed to be directed unless mentioned otherwise? Say for example, with Binary Trees or K-ary Trees the degree of child nodes are taken to be 0 without explicitly stating that the Tree is directed, Am I missing something.
asked May 20 in DS Pawan Nirpal 9 points 39 views
0 votes
0 answers 33 views
asked Apr 7 in DS Relon 5 points 33 views
0 votes
1 answer 28 views
True/False 1) Multiplying all edge weight by a positive number might change the graph MST. 2) If all edge in a graph have distinct weight than the shortest path between two vertices is unique. Please answer with reason. Thanks
asked Feb 27 in Algorithms Hradesh patel 9 points 28 views
1 vote
3 answers 1K views
​​​​​Let $H$ be a binary min-heap consisting of $n$ elements implemented as an array. What is the worst case time complexity of an optimal algorithm to find the maximum element in $H$? $\Theta (1)$ $\Theta (\log n)$ $\Theta (n)$ $\Theta (n \log n)$
asked Feb 18 in DS Arjun 1.5k points 1K views
2 votes
2 answers 900 views
Consider a complete binary tree with $7$ nodes. Let $A$ denote the set of first $3$ elements obtained by performing Breadth-First Search $\text{(BFS)}$ starting from the root. Let $B$ denote the set of first $3$ elements obtained by performing Depth-First Search $\text{(DFS)}$ starting from the root. The value of $\mid A-B \mid $ is _____________
asked Feb 18 in DS Arjun 1.5k points 900 views
4 votes
1 answer 1.3K views
Let $P$ be an array containing $n$ integers. Let $t$ be the lowest upper bound on the number of comparisons of the array elements, required to find the minimum and maximum values in an arbitrary array of $n$ elements. Which one of the following choices is correct? $t>2n-2$ ... $t>n \text{ and } t\leq 3\lceil \frac{n}{2}\rceil$ $t>\lceil \log_2(n)\rceil \text{ and } t\leq n$
asked Feb 18 in DS Arjun 1.5k points 1.3K views
4 votes
3 answers 1.1K views
A binary search tree $T$ contains $n$ distinct elements. What is the time complexity of picking an element in $T$ that is smaller than the maximum element in $T$? $\Theta(n\log n)$ $\Theta(n)$ $\Theta(\log n)$ $\Theta (1)$
asked Feb 18 in DS Arjun 1.5k points 1.1K views
0 votes
2 answers 695 views
Consider the following sequence of operations on an empty stack.$\textsf{push}(54);\textsf{push}(52);\textsf{pop}();\textsf{push}(55);\textsf{push}(62);\textsf{s}=\textsf{pop}();$ ... $\textsf{s+q}$ is ___________.
asked Feb 18 in DS Arjun 1.5k points 695 views
4 votes
2 answers 2.4K views
An $articulation$ $point$ in a connected graph is a vertex such that removing the vertex and its incident edges disconnects the graph into two or more connected components. Let $T$ be a $\text{DFS}$ tree obtained by doing $\text{DFS}$ in a connected undirected graph $G$. Which of the following ... and $y$ is a descendent of $u$ in $T$, then all paths from $x$ to $y$ in $G$ must pass through $u$.
asked Feb 18 in DS Arjun 1.5k points 2.4K views
1 vote
0 answers 31 views
"Consider the following array of elements <40, 35, 20, 10, 15, 16, 17, 8, 4, 30>. The minimum number of interchanges needed to convert it into a min-heap is _________ using built heap method." I am getting 7.
asked Jan 6 in Programming anurags228 23 points 31 views
0 votes
0 answers 59 views
The number of min heap trees are possible with 15 distinct elements such that every leaf node must be greater than all non-leaf nodes of the tree are ________. According to me, the answer should be 80* 8! The given answer is different.
asked Jan 6 in Programming anurags228 23 points 59 views
0 votes
1 answer 29 views
Maximum no of elements which can be inserted in a queue which is implemented using a circular queue on an array of size 10. Answer given was: (9) The maximum number of elements which can be stored in a circular queue of array of size n is n-1
asked Jan 3 in DS Nitinkumar.097 13 points 29 views
0 votes
0 answers 11 views
4.9. Suppose that G1 = (V1, {a, b}, S1, P1) and G2 = (V2, {a, b}, S2, P2) are CFGs and that V1 ∩ V2 = ∅. a. It is easy to see that no matter what G1 and G2 are, the CFG Gu = (Vu, {a, b}, Su, Pu) defined by Vu = V1 ∪ V2, Su = S1, and Pu = P1 ∪ P2 ∪ {S1 → S2} ... = P1 ∪ {S1 → S1S1 | } generates every string in L(G1) ∗. Find a grammar G1 with V1 = {S1} and a string x ∈ L(G ∗ ) such that x /∈ L(G) ∗.
asked Dec 23, 2020 in Theory of Computation aryan1234 5 points 11 views
0 votes
0 answers 13 views
Maximum number of node at level I is 2^I. Prove
asked Dec 19, 2020 in DS ApolloXYZ 1 point 13 views
0 votes
0 answers 13 views
What are the total number of nodes in a binary tree of height K ?
asked Dec 19, 2020 in DS ApolloXYZ 1 point 13 views
0 votes
0 answers 7 views
c+ = p&1; //c and p are integers How the above statement is executed..either c= (c+p)&1 or c= c+(p&1).
asked Dec 18, 2020 in Programming BHOJARAM 13 points 7 views
0 votes
1 answer 16 views
Prove by Induction that if T us a binary tree with n internal nodes, I its internal path lane and P its external path lane then E=I+2n, where n>=0
asked Dec 17, 2020 in DS ApolloXYZ 1 point 16 views
0 votes
0 answers 17 views
Prove that Maximum no. of node at level I is 2^I
asked Dec 16, 2020 in DS ApolloXYZ 1 point 17 views
0 votes
0 answers 10 views
Prove by Induction that if T is a binary tree with n internal nodes, I (its internal path lane) and P (its external path lane), then E=I+2n where n>=0
asked Dec 16, 2020 in DS ApolloXYZ 1 point 10 views
0 votes
2 answers 48 views
The degree of a node is the no. of children it has. Show that in any binary tree the number of leaves is 1 more than the no. of nodes of degree 2.
asked Dec 16, 2020 in DS ApolloXYZ 1 point 48 views
0 votes
0 answers 70 views
I am getting 48 as a answer! please clear whether the given answer is correct or there is any mistake?
asked Dec 6, 2020 in Programming Sinchit 17 points 70 views
0 votes
0 answers 82 views
I gave a madeeasy subject-wise test of programming and ds, and it had the following question copied from a quiz of Illinois Institute of Technology CS Dept (Source: http://www.cs.iit.edu/~iraicu/teaching/EECS211/quiz4-sol.pdf) Multiple Select Question(as modified by madeeasy, the ... root and another to the leaf), so shouldn't option A be incorrect, as 2 nodes out of 3 don't have multiple links?
asked Nov 18, 2020 in DS rish-18 9 points 82 views
0 votes
0 answers 28 views
select the correct statements .binary search trees(regardless of the order in which values are inserted into the tree). a)always have multiple links per node b)can be sorted efficiently c)always have the same shape for a particular set of data d)are non linear data structures ans is a,b,d can someone explain a,b part?
asked Nov 15, 2020 in Programming 404 found 37 points 28 views
1 vote
0 answers 33 views
Polynomial addition is implemented using which data structure? $(a)$ Queue $(b)$ Linked List $(c)$ Tree $(d)$ Stack Here My ans was Tree but given ans is Linked List Which one correct? Explaination according to them
asked Nov 13, 2020 in Programming srestha 1k points 33 views
1 vote
1 answer 60 views
The post order traversal of a heap is ACEDBHIGF. The possible pre-order traversal is: 1. ABCDEFGHI FBEACDGHI FBEADCGHI ABDCEFGIH
asked Nov 10, 2020 in DS rsamarth 29 points 60 views
2 votes
1 answer 27 views
What will be the output of the following program? main( ) { main( ); } (A) overflow error (B) syntax error (C) returns 0 (D) returns 1
asked Nov 5, 2020 in Programming anushkaaa 43 points 27 views
0 votes
2 answers 85 views
What would be the answer? I got 32, but it’s wrong.
asked Oct 8, 2020 in Programming Sinchit 17 points 85 views
0 votes
3 answers 345 views
Consider a 2 dimensional array A[0 --- 39, 0 --- 39] in lower triangular matrix representation. The size of each element in the array is 1 byte. If the array is implemented in the memory in the form of row major order and base address of the array is 500. The address of A[15][25] will be _____. [Note: Only lower triangular elements of the matrix are stored in contiguous array]
asked Aug 25, 2020 in DS Scion_of_fire 49 points 345 views
0 votes
2 answers 38 views
sir max height of AVL tree is 1.44*log2 n. 1.44log2 36 = 7.44 so here maximum height of AVL tree with 36 node is 7?
asked Aug 15, 2020 in DS Ankur29 5 points 38 views
0 votes
2 answers 26 views
here L = no of leaves, n = n ary, i = no of internal node so L = (n-1)*i +1 L = (3-1)*10 +1 L = 2*10 +1 = 21 so total no of leaf node = 21?? please clear my doubt
asked Aug 15, 2020 in DS Ankur29 5 points 26 views
0 votes
1 answer 61 views
Source : https://gateoverflow.in/2075/gate2014-3-41 While solving this question I consider this LC-RS representation (I have not considered node 7,8,9 just for simplicity. So just ignore them) and got the final value as $4.$ In the best answer answer given as $D)$ $\#$ of leaf ... be converted to leaf? $3)$ How can 5 OR 3 be a leaf nodes? $4)$ How are we defining a leaf node for such a tree?
asked Aug 15, 2020 in DS KUSHAGRA गुप्ता 1.4k points 61 views
0 votes
0 answers 15 views
These are the options given: (a) Print nodes at K distance from root node. (b) Print nodes of Kth level of binary tree. (c)Both a and b (d) None of these I think the answer would be Both (a) and (b), if we consider root node at Level 0. But the answer given is (a) only If someone could explain why (b) is not the answer than it would be great help.
asked Jul 26, 2020 in DS luc_Bloodstone 19 points 15 views
0 votes
0 answers 48 views
I have the following query: Given a sorted array, I know that we can construct a balanced BST in O(n) time. https://www.geeksforgeeks.org/sorted-array-to-balanced-bst/ Suppose I have a sorted array -[1,2,3,4,5,6.....n]. I want to construct a skewed BST. Something like below: ... element. Here , T(n)=T(n-1)+c.--->O(n). Am I wrong? Please explain in detail so I can understand. Thanks in advance.
asked Jul 25, 2020 in Algorithms Souraj Adhikary 5 points 48 views
0 votes
0 answers 41 views
root → value = SumElements(root → left) root → value = SumElements(root → right) root → value = SumElements(root → left) + SumElements(root → right) SumElements(root → left) + SumElements(root → right) according to me ans shoul be none of them bcoz it must be: (root → value) + SumElements(root → left) + SumElements(root → right) but they have given ans is 3rd option.Am I missing something here??
asked Jul 4, 2020 in DS abcd9982 87 points 41 views
1 vote
0 answers 27 views
Choose incorrect statements from the options given below ? a stack and a queue can be implemented in a single array v[1...m]. ‘n’ circular queues can be implemented in a single array v[1...m], (m>>n) n1 stacks and n2=n-n1 queues can be implemented in an array v[1….m] (m >>n) None of the above Anyone please clarify.
asked Jun 8, 2020 in Programming Shivateja MST 45 points 27 views
0 votes
0 answers 12 views
This is function to create binary tree.But I am unable to write the base case for this recursion function.Any idea how it can be done? private static Node create() { Scanner sc = new Scanner(System.in); int value; System.out.println("Enter a value:"); value = sc.nextInt ... "Right child of " + value); newnode.right = create(); sc.close(); return newnode; } Thanks for your time and help in advance.
asked May 23, 2020 in Programming amitnegi99 5 points 12 views
0 votes
1 answer 48 views
Hi, Consider the program below : main() { char c = “GATE2011”; char *p=c; printf(“%s”,p+p[3]-p[1]); } o/p = 2011 expression internally evaluates to : p+69-65 = p+4 , then 2011 prints but as per precedence graph in c p+69 should evaluate due to associativity of addition and subtraction left to right first iam confused why we have to subtract 69-65 first can someone give me clarification
asked May 10, 2020 in Programming Sumit goyal 2 5 points 48 views
...