search
Log In

Recent questions tagged binary-tree

2 votes
2 answers
1
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 541 views
0 votes
2 answers
2
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 and $L$ be the number of leaves in a complete $n$-ary tree. If $L=41$, and $I=10$, what is the value of $n$? $3$ $4$ $5$ $6$
asked Nov 20, 2020 in DS jothee 269 views
0 votes
1 answer
3
0 votes
1 answer
4
The height of a binary tree is the maximum number of edges in any root to leaf path. The maximum number number of nodes in a binary tree of height $h$ is $2^{h}$ $2^{h-1} – 1$ $2^{h+1} – 1$ $2^{h+1}$
asked Apr 1, 2020 in DS Lakshman Patel RJIT 397 views
0 votes
2 answers
6
0 votes
1 answer
7
Traversing a binary tree first root and then left and right subtrees called ______ traversal. postorder. preorder. inorder. none of these.
asked Mar 31, 2020 in DS Lakshman Patel RJIT 368 views
2 votes
1 answer
8
0 votes
2 answers
9
0 votes
2 answers
10
0 votes
2 answers
11
Consider a complete binary tree where the left and the right sub trees of the root are max-heaps. The lower bound for the number of operations to convert the tree to a heap is: $\Omega(\log n)$ $\Omega(n\log n)$ $\Omega(n)$ $\Omega(n^2)$
asked Mar 30, 2020 in DS Lakshman Patel RJIT 357 views
0 votes
3 answers
12
Which of the following statements is false? Optimal binary search tree construction can be performed efficiently using dynamic programming. Breadth-first search cannot be used to find connected components of a graph. Given the prefix and postfix walks of a binary tree, the tree cannot be reconstructed uniquely. Depth-first-search can be used to find the connected components of a graph. a b c d
asked Mar 24, 2020 in Algorithms jothee 517 views
2 votes
4 answers
13
The post-order traversal of binary tree is $ACEDBHIGF$. The pre-order traversal is $\text{A B C D E F G H I}$ $\text{F B A D C E G I H}$ $\text{F A B C D E G H I}$ $\text{A B D C E F G I H}$
asked Jan 13, 2020 in DS Satbir 4.7k views
1 vote
1 answer
14
Argue that since sorting $n$ elements takes $\Omega (n\ lgn)$ time in the worst case in the comparison model, any comparison-based algorithm for constructing a $BST$ from an arbitrary list of n elements takes $\Omega (n\ lgn)$ time in the worst case.
asked Nov 20, 2019 in Algorithms KUSHAGRA गुप्ता 413 views
1 vote
4 answers
15
Consider the following function height, to which pointer to the root node of a binary tree shown below is passed Note that max(a,b) defined by #define max(a,b) (a>b)?a:b. int height(Node *root) The output of the above code will be _________________
asked May 22, 2019 in DS srestha 801 views
1 vote
0 answers
16
The number of node in each left subtree is within a factor of $2.$ of the number of nodes in the corresponding right subtree. Also a node allowed to have only one child if that child has no children. This tree has worst case height $O(logn)$. $N$ is the number of nodes in the binary tree. Is this statement TRUE about Binary Tree?
asked May 7, 2019 in Algorithms srestha 220 views
2 votes
3 answers
17
What is the time complexity for insertion in binary tree in worst case? O(1) O(log n) O(n) O(n log n)
asked Apr 29, 2019 in Programming manikgupta123 592 views
0 votes
0 answers
18
somewhere we seen that formula- How many binary tree possible without labeled =c(2n,n)/n+1. anybody explain how we get this formula.
asked Feb 23, 2019 in DS sandeep singh gaur 142 views
34 votes
10 answers
19
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$ are chosen uniformly and independently at random. The expected value of the distance between $a$ and $b$ in $T$ (ie., the number of edges in the unique path between $a$ and $b$) is (rounded off to $2$ decimal places) _________.
asked Feb 7, 2019 in DS Arjun 14.8k views
0 votes
2 answers
20
Which of the following is not correct about B + Tree, which is used for creating index of relational database table? (a) Key values in each node kept in sorted order (b) Leaf node pointer points to next node (c) B + tree is height balanced tree (d) Non-leaf node have pointers to data records
asked Feb 4, 2019 in Databases HeartBleed 1.1k views
0 votes
1 answer
21
The height of a binary tree is defined as the number of nodes in the longest path from root to the leaf node. Let X be the height of a complete binary tree with 256 nodes. Then the value of X will be Answer 9
asked Jan 28, 2019 in DS Ram Swaroop 400 views
0 votes
0 answers
22
I think its answer is 8 .Please ,can any one make it sure for me :)
asked Jan 25, 2019 in DS Nandkishor3939 202 views
0 votes
0 answers
23
Consider a binary tree for every node | P - Q | <= 2. P represents number of nodes in left subtree of S and Q represents number of nodes in right subtree of S for h > 0. The minimum number of nodes present in such tree of height h = 4 ( Root at 0 level)
asked Jan 16, 2019 in Programming Na462 133 views
...