Forum discussion on Binary Search Tree

Answer the question and discuss if you have any confusion

Answer the question and discuss if you have any confusion

by Md Assaduzzaman -
Number of replies: 59

1. What are the properties of Binary Search Tree?

2. Why binary search tree is better than linked list or sorted array?

In reply to Md Assaduzzaman

Re: Answer the question and discuss if you have any confusion

by ABU BAKAR SIDDIQUE 201-15-3352 -
1)ANS:
The properties of Binary Search Tree:
a)The maximum number of nodes at level ‘l’ will be 2l−1 . Here level is the number of nodes on path from root to the node, including the root itself. We are considering the level of root is 1.
b)Maximum number of nodes present in binary tree of height h is 2h−1 . Here height is the max number of nodes on root to leaf path. Here we are considering height of a tree with one node is 1.
c)In a binary tree with n nodes, minimum possible height or minimum number of levels arelog2⟮n+1⟯ . If we consider that the height of leaf node is considered as 0, then the formula will be log2⟮n+1⟯−1.
d)A binary tree with ‘L’ leaves has at least log2L+1 number of levels.
e)If a binary tree has 0 or 2 children, then number of leaf nodes are always one more than nodes with two children.
As binary tree is one kind of tree; it has all properties of tree in graph theory.

2)ANS:
A binary tree has a better time complexity for searching O(log N) but in the worst case can be the same as a linked list O(n). This means searching a binary tree will be faster than searching a linked list. Also, binary trees store values implicity sorted, so sorting operations are trivial.

Binary trees are great because they allow efficient sorting and searching. Their disadvantage is that in the worst case they can degenerate into a linked list in terms of efficiency. For example, inserting already-sorted data into a tree. Another disadvantage is coding complexity. Binary trees are much more complex than linked lists, especially for deletion and memory freeing. Also, to solve the problem of degeneration stated above, a self-balancing tree must be used which creates even more complexity.

Linked lists are simple to implement and have many practical applications, however, they have a lot of limitations. The best search algorithm that can be used on them is a linear search. The best sorting algorithms that can be used are not the best available. For example, any sort that requires random-access cannot be used on a linked list.
In reply to Md Assaduzzaman

Re: Answer the question and discuss if you have any confusion

by Md. Atikur Rahman -
1. Properties of Binary Search Tree.
A Binary Search Tree (BST) is a tree in which all the nodes follow the below-mentioned properties −

The value of the key of the left sub-tree is less than the value of its parent (root) node's key.

The value of the key of the right sub-tree is greater than or equal to the value of its parent (root) node's key.

Thus, BST divides all its sub-trees into two segments; the left sub-tree and the right sub-tree and can be defined as −

left_subtree (keys) < node (key) ≤ right_subtree (keys)



2. binary search tree is better than linked list or sorted array.
Binary search is an algorithm for the search-problem, and can be utilized in many different settings, including certain kinds of decision procedures for optimization problems.

Binary search requires that the input data maintains a partial ordering (in simple terms, it is sorted in non-decreasing order). The benefit we want out of the algorithm is to access each value at the middle position in constant time. In a linked list, getting the middle position can take [math]O(n)[/math] time. So the time complexity would go from [math]O(\log{n})[/math] to [math]O(n\log{n})[/math].

A data structure such as an array is far more suitable as you can access any member of the array in constant time. Remember that the data must be sorted to use binary search.
In reply to Md Assaduzzaman

Re: Answer the question and discuss if you have any confusion

by Avishek Das (201-15-3452) -

Answer to the Q. No 01

Binary search tree  is a tree where all the nodes follow the following characteristics -

  • The value of the left sub-tree key is lower than that of the parent (main) node key.
  • The value of the key of the right sub-tree is greater than or equal to the value of the root of its parent (root) node.
  • Thus, Binary Search Tree  has divided all its sub-trees into two parts; Left sub-tree and right sub-tree and it can be defined as -left sub-tree (keys) < node (key) ≤ right sub-tree (keys) .

Answer to the Q. No 02


Binary search tree is better than linked list or sorted array. Binary search can be used in many different settings, including an algorithm for search-problems and specific decision-making methods for optimization problems.....


Binary search requires that the input data maintains a partial ordering (in simple terms, it is sorted in non-decreasing order). The benefit we want out of the algorithm is to access each value at the middle position in constant time. In a linked list, getting the middle position can take [math]O(n)[/math] time. So, the time complexity would go from [math]O(\log{n})[/math] to [math]O(n\log{n})[/math].

So,  a data structure like an array is much more suitable because you can access any member of the array at constant time. Remember that data must be selected to use binary search.




In reply to Md Assaduzzaman

Re: Answer the question and discuss if you have any confusion

by Sanjida Zaman Toma 201-15-3102 -
1. Properties of Binary Search Tree.
A Binary Search Tree (BST) is a tree in which all the nodes follow the below-mentioned properties −

The value of the key of the left sub-tree is less than the value of its parent (root) node's key.

The value of the key of the right sub-tree is greater than or equal to the value of its parent (root) node's key.

Thus, BST divides all its sub-trees into two segments; the left sub-tree and the right sub-tree and can be defined as −

left_subtree (keys) < node (key) ≤ right_subtree (keys)



2. Binary search tree is better than linked list or sorted array.
Binary search is an algorithm for the search-problem, and can be utilized in many different settings, including certain kinds of decision procedures for optimization problems.

Binary search requires that the input data maintains a partial ordering (in simple terms, it is sorted in non-decreasing order). The benefit we want out of the algorithm is to access each value at the middle position in constant time. In a linked list, getting the middle position can take [math]O(n)[/math] time. So the time complexity would go from [math]O(\log{n})[/math] to [math]O(n\log{n})[/math].

A data structure such as an array is far more suitable as you can access any member of the array in constant time. Remember that the data must be sorted to use binary search.
In reply to Md Assaduzzaman

Re: Answer the question and discuss if you have any confusion

by Ordha Nafiz Akbar -
Answer to the Q. No 01

The value of the left sub-tree key is lower than that of the parent (main) node key.
The value of the key of the right sub-tree is greater than or equal to the value of the root of its parent (root) node.
Thus, Binary Search Tree has divided all its sub-trees into two parts; Left sub-tree and right sub-tree and it can be defined as -left sub-tree (keys) < node (key) ≤ right sub-tree (keys) .

Answer to the Q. No 02


Binary search tree is better than linked list or sorted array because it can be used in many different settings, including an algorithm for search-problems and specific decision-making methods for optimization problems
In reply to Md Assaduzzaman

Re: Answer the question and discuss if you have any confusion

by Janatul Naeem (201-15-3605) -
1. Properties of Binary Search Tree.
A Binary Search Tree (BST) is a tree in which all the nodes follow the below-mentioned properties −

The value of the key of the left sub-tree is less than the value of its parent (root) node's key.

The value of the key of the right sub-tree is greater than or equal to the value of its parent (root) node's key.

Thus, BST divides all its sub-trees into two segments; the left sub-tree and the right sub-tree and can be defined as −

left_subtree (keys) < node (key) ≤ right_subtree (keys)



2. binary search tree is better than linked list or sorted array.
Binary search is an algorithm for the search-problem, and can be utilized in many different settings, including certain kinds of decision procedures for optimization problems.

Binary search requires that the input data maintains a partial ordering (in simple terms, it is sorted in non-decreasing order). The benefit we want out of the algorithm is to access each value at the middle position in constant time. In a linked list, getting the middle position can take [math]O(n)[/math] time. So the time complexity would go from [math]O(\log{n})[/math] to [math]O(n\log{n})[/math].

A data structure such as an array is far more suitable as you can access any member of the array in constant time. Remember that the data must be sorted to use binary search
In reply to Md Assaduzzaman

Re: Answer the question and discuss if you have any confusion

by 201-15-3417 Arpita Basak -
1. Properties of Binary Search Tree.
A Binary Search Tree (BST) is a tree in which all the nodes follow the below-mentioned properties −

The value of the key of the left sub-tree is less than the value of its parent (root) node's key.

The value of the key of the right sub-tree is greater than or equal to the value of its parent (root) node's key.

Thus, BST divides all its sub-trees into two segments; the left sub-tree and the right sub-tree and can be defined as −

left_subtree (keys) < node (key) ≤ right_subtree (keys)



2. Binary search tree is better than linked list or sorted array.
Binary search is an algorithm for the search-problem, and can be utilized in many different settings, including certain kinds of decision procedures for optimization problems.

Binary search requires that the input data maintains a partial ordering (in simple terms, it is sorted in non-decreasing order). The benefit we want out of the algorithm is to access each value at the middle position in constant time. In a linked list, getting the middle position can take [math]O(n)[/math] time. So the time complexity would go from [math]O(\log{n})[/math] to [math]O(n\log{n})[/math].

A data structure such as an array is far more suitable as you can access any member of the array in constant time. Remember that the data must be sorted to use binary search.
In reply to Md Assaduzzaman

Re: Answer the question and discuss if you have any confusion

by Md. Seyam Ali Biswas -
1. Properties of Binary Search Tree.
A Binary Search Tree (BST) is a tree in which all the nodes follow the below-mentioned properties −

The value of the key of the left sub-tree is less than the value of its parent (root) node's key.

The value of the key of the right sub-tree is greater than or equal to the value of its parent (root) node's key.

Thus, BST divides all its sub-trees into two segments; the left sub-tree and the right sub-tree and can be defined as −

left_subtree (keys) < node (key) ≤ right_subtree (keys)



2. Binary search tree is better than linked list or sorted array.
Binary search is an algorithm for the search-problem, and can be utilized in many different settings, including certain kinds of decision procedures for optimization problems.

Binary search requires that the input data maintains a partial ordering (in simple terms, it is sorted in non-decreasing order). The benefit we want out of the algorithm is to access each value at the middle position in constant time. In a linked list, getting the middle position can take [math]O(n)[/math] time. So the time complexity would go from [math]O(\log{n})[/math] to [math]O(n\log{n})[/math].

A data structure such as an array is far more suitable as you can access any member of the array in constant time. Remember that the data must be sorted to use binary search.
In reply to Md Assaduzzaman

Re: Answer the question and discuss if you have any confusion

by Maherunnesa Mim -
• Answer to the Q. No 01


A binary search tree is a tree where all the nodes follow the following characteristics -


• The value of the left sub-tree key is lower than that of the parent (main) node key.
• The value of the key of the right sub-tree is greater than or equal to the value of the root of its parent (root) node.
• Thus, Binary Search Tree has divided all its sub-trees into two parts; Left sub-tree and right sub-tree and it can be defined as -left sub-tree (keys) < node (key) ≤ right sub-tree (keys).
• Answer to the Q. No 02

A binary search tree is better than a linked list or sorted array. Binary search can be used in many different settings, including an algorithm for search-problems and specific decision-making methods for optimization problems.....


Binary search requires that the input data maintains a partial ordering (in simple terms, it is sorted in non-decreasing order). The benefit we want out of the algorithm is to access each value at the middle position in constant time. In a linked list, getting the middle position can take [math]O(n)[/math] time. So, the time complexity would go from [math]O(\log{n})[/math] to [math]O(n\log{n})[/math].

• So, a data structure like an array is much more suitable because you can access any member of the array at constant time. Remember that data must be selected to use a binary search.
In reply to Md Assaduzzaman

Re: Answer the question and discuss if you have any confusion

by Prayma Bishshash 201-15-3168 -
Answer to the question no1:
Properties of Binary Search Tree.
A Binary Search Tree (BST) is a tree in which all the nodes follow the below-mentioned properties −
The value of the key of the left sub-tree is less than the value of its parent (root) node's key.
The value of the key of the right sub-tree is greater than or equal to the value of its parent (root) node's key.

Thus, BST divides all its sub-trees into two segments; the left sub-tree and the right sub-tree and can be defined as −
left subtree (keys) < node (key) ≤ right subtree (keys).



Answer to the question no 2:
Binary search tree is better than linked list or sorted array.
Binary search is an algorithm for the search-problem, and can be utilized in many different settings, including certain kinds of decision procedures for optimization problems.
Binary search requires that the input data maintains a partial ordering (in simple terms, it is sorted in non-decreasing order). The benefit we want out of the algorithm is to access each value at the middle position in constant time. In a linked list, getting the middle position can take [math]O(n)[/math] time. So the time complexity would go from [math]O(\log{n})[/math] to [math]O(n\log{n})[/math].
A data structure such as an array is far more suitable as you can access any member of the array in constant time. Remember that the data must be sorted to use binary search.
In reply to Md Assaduzzaman

Re: Answer the question and discuss if you have any confusion

by Md. Shahin Alam -
• Answer to the Q. No 01
A binary search tree is a tree where all the nodes follow the following characteristics -
• The value of the left sub-tree key is lower than that of the parent (main) node key.
• The value of the key of the right sub-tree is greater than or equal to the value of the root of its parent (root) node.
• Thus, Binary Search Tree has divided all its sub-trees into two parts; Left sub-tree and right sub-tree and it can be defined as -left sub-tree (keys) < node (key) ≤ right sub-tree (keys).

Answer to the question number- 02
Binary search tree is better than linked list or sorted array.
Binary search is an algorithm for the search-problem, and can be utilized in many different settings, including certain kinds of decision procedures for optimization problems.

Binary search requires that the input data maintains a partial ordering (in simple terms, it is sorted in non-decreasing order). The benefit we want out of the algorithm is to access each value at the middle position in constant time. In a linked list, getting the middle position can take [math]O(n)[/math] time. So the time complexity would go from [math]O(\log{n})[/math] to [math]O(n\log{n})[/math].

A data structure such as an array is far more suitable as you can access any member of the array in constant time. Remember that the data must be sorted to use binary search.
In reply to Md Assaduzzaman

Re: Answer the question and discuss if you have any confusion

by Khatuna Jannat Sarnali -

1 no answer:

A Binary Search Tree (BST) is a tree in which all the nodes follow the below-mentioned properties −

The value of the key of the left sub-tree is less than the value of its parent (root) node's key.

The value of the key of the right sub-tree is greater than or equal to the value of its parent (root) node's key.

Thus, BST divides all its sub-trees into two segments; the left sub-tree and the right sub-tree and can be defined as −

left_subtree (keys) < node (key) ≤ right_subtree (keys)



2 no answer

Binary search tree is better than linked list or sorted array.
Binary search is an algorithm for the search-problem, and can be utilized in many different settings, including certain kinds of decision procedures for optimization problems.

Binary search requires that the input data maintains a partial ordering (in simple terms, it is sorted in non-decreasing order). The benefit we want out of the algorithm is to access each value at the middle position in constant time. In a linked list, getting the middle position can take [math]O(n)[/math] time. So the time complexity would go from [math]O(\log{n})[/math] to [math]O(n\log{n})[/math].

A data structure such as an array is far more suitable as you can access any member of the array in constant time. Remember that the data must be sorted to use binary search.

In reply to Md Assaduzzaman

Re: Answer the question and discuss if you have any confusion

by Md.Yeasin Chowdhury 201-15-3443 -
Ans:to:Q:No:01

Properties of Binary Search Tree.
A Binary Search Tree (BST) is a tree in which all the nodes follow the below-mentioned properties −

The value of the key of the left sub-tree is less than the value of its parent (root) node's key.

The value of the key of the right sub-tree is greater than or equal to the value of its parent (root) node's key.

Thus, BST divides all its sub-trees into two segments; the left sub-tree and the right sub-tree and can be defined as −

left_subtree (keys) < node (key) ≤ right_subtree (keys)


Ans:to:Q:No:02

Binary search tree is better than linked list or sorted array.
Binary search is an algorithm for the search-problem, and can be utilized in many different settings, including certain kinds of decision procedures for optimization problems.

Binary search requires that the input data maintains a partial ordering (in simple terms, it is sorted in non-decreasing order). The benefit we want out of the algorithm is to access each value at the middle position in constant time. In a linked list, getting the middle position can take [math]O(n)[/math] time. So the time complexity would go from [math]O(\log{n})[/math] to [math]O(n\log{n})[/math].

A data structure such as an array is far more suitable as you can access any member of the array in constant time. Remember that the data must be sorted to use binary search.
In reply to Md Assaduzzaman

Re: Answer the question and discuss if you have any confusion

by Ismotara Dipty -

Answer to the question no 1:

In computer science, a binary search tree, also called an ordered or sorted binary tree, is a rooted binary tree whose internal nodes each store a key greater than all the keys in the node's left subtree and less than those in its right subtree.

Binary Search Tree is a node-based binary tree data structure which has the following properties:

1.All nodes of left subtree are less than the root node

2.All nodes of right subtree are more than the root node.

3.The left and right subtree each must also be a binary search tree. 

Answer to the question no 2:

Binary search is an algorithm for the search-problem, and can be utilized in many different settings, including certain kinds of decision procedures for optimization problems.


Binary search requires that the input data maintains a partial ordering (in simple terms, it is sorted in non-decreasing order). The benefit we want out of the algorithm is to access each value at the middle position in constant time. In a linked list, getting the middle position can take  O(n)  time. So the time complexity would go from  O(logn)  to  O(nlogn) .


A data structure such as an array is far more suitable as you can access any member of the array in constant time. Remember that the data must be sorted to use binary search.


In reply to Md Assaduzzaman

Re: Answer the question and discuss if you have any confusion

by Ibrahim Tasin -
Answer to the question no.1

Properties of Binary Search Tree.
A Binary Search Tree (BST) is a tree in which all the nodes follow the below-mentioned properties − The value of the key of the left sub-tree is less than the value of its parent (root) node's key. The value of the key of the right sub-tree is greater than or equal to the value of its parent (root) node's key. Thus, BST divides all its sub-trees into two segments; the left sub-tree and the right sub-tree and can be defined as − left_subtree (keys) < node (key) ≤ right_subtree (keys)



Answer to the question no.2


 Binary search tree is better than linked list or sorted array.
Binary search is an algorithm for the search-problem, and can be utilized in many different settings, including certain kinds of decision procedures for optimization problems. Binary search requires that the input data maintains a partial ordering (in simple terms, it is sorted in non-decreasing order). The benefit we want out of the algorithm is to access each value at the middle position in constant time. In a linked list, getting the middle position can take [math]O(n)[/math] time. So the time complexity would go from [math]O(\log{n})[/math] to [math]O(n\log{n})[/math]. A data structure such as an array is far more suitable as you can access any member of the array in constant time. Remember that the data must be sorted to use binary search.
In reply to Md Assaduzzaman

Re: Answer the question and discuss if you have any confusion

by Mafujul Haque Plabon -
Answer to the question no(1)
Properties of Binary Search Tree.
A Binary Search Tree (BST) is a tree in which all the nodes follow the below-mentioned properties −

The value of the key of the left sub-tree is less than the value of its parent (root) node's key.

The value of the key of the right sub-tree is greater than or equal to the value of its parent (root) node's key.

Thus, BST divides all its sub-trees into two segments; the left sub-tree and the right sub-tree and can be defined as −

left_subtree (keys) < node (key) ≤ right_subtree (keys)

Answer to the question no(2)

Binary search tree is better than linked list or sorted array.
Binary search is an algorithm for the search-problem, and can be utilized in many different settings, including certain kinds of decision procedures for optimization problems.

Binary search requires that the input data maintains a partial ordering (in simple terms, it is sorted in non-decreasing order). The benefit we want out of the algorithm is to access each value at the middle position in constant time. In a linked list, getting the middle position can take [math]O(n)[/math] time. So the time complexity would go from [math]O(\log{n})[/math] to [math]O(n\log{n})[/math].

A data structure such as an array is far more suitable as you can access any member of the array in constant time. Remember that the data must be sorted to use binary search.
In reply to Md Assaduzzaman

Re: Answer the question and discuss if you have any confusion

by Taslima Jahan Tushi 201-15-3269 -

No 01

Ans to the question no.1.The value of the left sub-tree key is lower than that of the parent (main) node key.
The value of the key of the right sub-tree is greater than or equal to the value of the root of its parent (root) node.
Thus, Binary Search Tree has divided all its sub-trees into two parts; Left sub-tree and right sub-tree and it can be defined as -left sub-tree (keys) < node (key) ≤ right sub-tree (keys) .

Answer to the Q. No 02


Binary search tree is better than linked list or sorted array because it can be used in many different settings, including an algorithm for search-problems and specific decision-making methods for optimization problems

In reply to Md Assaduzzaman

Re: Answer the question and discuss if you have any confusion

by Sazzad Hosain Sagor -
1)ANS:
The properties of Binary Search Tree:
a)The maximum number of nodes at level ‘l’ will be 2l−1 . Here level is the number of nodes on path from root to the node, including the root itself. We are considering the level of root is 1.
b)Maximum number of nodes present in binary tree of height h is 2h−1 . Here height is the max number of nodes on root to leaf path. Here we are considering height of a tree with one node is 1.
c)In a binary tree with n nodes, minimum possible height or minimum number of levels arelog2⟮n+1⟯ . If we consider that the height of leaf node is considered as 0, then the formula will be log2⟮n+1⟯−1.
d)A binary tree with ‘L’ leaves has at least log2L+1 number of levels.
e)If a binary tree has 0 or 2 children, then number of leaf nodes are always one more than nodes with two children.
As binary tree is one kind of tree; it has all properties of tree in graph theory.

2)ANS:
A binary tree has a better time complexity for searching O(log N) but in the worst case can be the same as a linked list O(n). This means searching a binary tree will be faster than searching a linked list. Also, binary trees store values implicity sorted, so sorting operations are trivial.

Binary trees are great because they allow efficient sorting and searching. Their disadvantage is that in the worst case they can degenerate into a linked list in terms of efficiency. For example, inserting already-sorted data into a tree. Another disadvantage is coding complexity. Binary trees are much more complex than linked lists, especially for deletion and memory freeing. Also, to solve the problem of degeneration stated above, a self-balancing tree must be used which creates even more complexity.

Linked lists are simple to implement and have many practical applications, however, they have a lot of limitations. The best search algorithm that can be used on them is a linear search. The best sorting algorithms that can be used are not the best available. For example, any sort that requires random-access cannot be used on a linked list.
In reply to Md Assaduzzaman

Re: Answer the question and discuss if you have any confusion

by Antho Ghosh -
Answer to the Q. No 01

Binary search tree is a tree where all the nodes follow the following characteristics -

The value of the left sub-tree key is lower than that of the parent (main) node key.
The value of the key of the right sub-tree is greater than or equal to the value of the root of its parent (root) node.
Thus, Binary Search Tree has divided all its sub-trees into two parts; Left sub-tree and right sub-tree and it can be defined as -left sub-tree (keys) < node (key) ≤ right sub-tree (keys) .

Answer to the Q. No 02


Binary search tree is better than linked list or sorted array. Binary search can be used in many different settings, including an algorithm for search-problems and specific decision-making methods for optimization problems.....


Binary search requires that the input data maintains a partial ordering (in simple terms, it is sorted in non-decreasing order). The benefit we want out of the algorithm is to access each value at the middle position in constant time. In a linked list, getting the middle position can take [math]O(n)[/math] time. So, the time complexity would go from [math]O(\log{n})[/math] to [math]O(n\log{n})[/math].

So, a data structure like an array is much more suitable because you can access any member of the array at constant time. Remember that data must be selected to use binary search.
In reply to Md Assaduzzaman

Re: Answer the question and discuss if you have any confusion

by Arifa Rahman Tony -
1. Properties of Binary Search Tree.
A Binary Search Tree (BST) is a tree in which all the nodes follow the below-mentioned properties −

The value of the key of the left sub-tree is less than the value of its parent (root) node's key.

The value of the key of the right sub-tree is greater than or equal to the value of its parent (root) node's key.

Thus, BST divides all its sub-trees into two segments; the left sub-tree and the right sub-tree and can be defined as −

left_subtree (keys) < node (key) ≤ right_subtree (keys)



2. Binary search tree is better than linked list or sorted array.
Binary search is an algorithm for the search-problem, and can be utilized in many different settings, including certain kinds of decision procedures for optimization problems.

Binary search requires that the input data maintains a partial ordering (in simple terms, it is sorted in non-decreasing order). The benefit we want out of the algorithm is to access each value at the middle position in constant time. In a linked list, getting the middle position can take [math]O(n)[/math] time. So the time complexity would go from [math]O(\log{n})[/math] to [math]O(n\log{n})[/math].

A data structure such as an array is far more suitable as you can access any member of the array in constant time. Remember that the data must be sorted to use binary search.
In reply to Md Assaduzzaman

Re: Answer the question and discuss if you have any confusion

by 201-15-3596 sadia afrin satu -
1. Properties of Binary Search Tree.
A Binary Search Tree (BST) is a tree in which all the nodes follow the below-mentioned properties −
The value of the key of the left sub-tree is less than the value of its parent (root) node's key.
The value of the key of the right sub-tree is greater than or equal to the value of its parent (root) node's key.
Thus, BST divides all its sub-trees into two segments; the left sub-tree and the right sub-tree and can be defined as −
left_subtree (keys) < node (key) ≤ right_subtree (keys)

2. Binary search tree is better than linked list or sorted array.
Binary search is an algorithm for the search-problem, and can be utilized in many different settings, including certain kinds of decision procedures for optimization problems.

Binary search requires that the input data maintains a partial ordering (in simple terms, it is sorted in non-decreasing order). The benefit we want out of the algorithm is to access each value at the middle position in constant time. In a linked list, getting the middle position can take [math]O(n)[/math] time. So the time complexity would go from [math]O(\log{n})[/math] to [math]O(n\log{n})[/math].

A data structure such as an array is far more suitable as you can access any member of the array in constant time. Remember that the data must be sorted to use binary search.
In reply to Md Assaduzzaman

Re: Answer the question and discuss if you have any confusion

by Fiaj Rahman(201-15-3077) -
1. Properties of Binary Search Tree.
A Binary Search Tree (BST) is a tree in which all the nodes follow the below-mentioned properties −

The value of the key of the left sub-tree is less than the value of its parent (root) node's key.

The value of the key of the right sub-tree is greater than or equal to the value of its parent (root) node's key.

Thus, BST divides all its sub-trees into two segments; the left sub-tree and the right sub-tree and can be defined as −

left_subtree (keys) < node (key) ≤ right_subtree (keys)



2. Binary search tree is better than linked list or sorted array.
Binary search is an algorithm for the search-problem, and can be utilized in many different settings, including certain kinds of decision procedures for optimization problems.

Binary search requires that the input data maintains a partial ordering (in simple terms, it is sorted in non-decreasing order). The benefit we want out of the algorithm is to access each value at the middle position in constant time. In a linked list, getting the middle position can take [math]O(n)[/math] time. So the time complexity would go from [math]O(\log{n})[/math] to [math]O(n\log{n})[/math].

A data structure such as an array is far more suitable as you can access any member of the array in constant time. Remember that the data must be sorted to use binary search.
In reply to Md Assaduzzaman

Re: Answer the question and discuss if you have any confusion

by 201-15-3532 Sumaiya Haider -
Properties of Binary Search Tree.
A Binary Search Tree (BST) is a tree in which all the nodes follow the below-mentioned properties −
The value of the key of the left sub-tree is less than the value of its parent (root) node's key.
The value of the key of the right sub-tree is greater than or equal to the value of its parent (root) node's key.
Thus, BST divides all its sub-trees into two segments; the left sub-tree and the right sub-tree and can be defined as −
left_subtree (keys) < node (key) ≤ right_subtree (keys)

2. Binary search tree is better than linked list or sorted array.
Binary search is an algorithm for the search-problem, and can be utilized in many different settings, including certain kinds of decision procedures for optimization problems.

Binary search requires that the input data maintains a partial ordering (in simple terms, it is sorted in non-decreasing order). The benefit we want out of the algorithm is to access each value at the middle position in constant time. In a linked list, getting the middle position can take [math]O(n)[/math] time. So the time complexity would go from [math]O(\log{n})[/math] to [math]O(n\log{n})[/math].

A data structure such as an array is far more suitable as you can access any member of the array in constant time. Remember that the data must be sorted to use binary search.
In reply to Md Assaduzzaman

Re: Answer the question and discuss if you have any confusion

by 201-15-3255 Al Imran Alvy -
1)ANS:
The properties of Binary Search Tree:
a)The maximum number of nodes at level ‘l’ will be 2l−1 . Here level is the number of nodes on path from root to the node, including the root itself. We are considering the level of root is 1.
b)Maximum number of nodes present in binary tree of height h is 2h−1 . Here height is the max number of nodes on root to leaf path. Here we are considering height of a tree with one node is 1.
c)In a binary tree with n nodes, minimum possible height or minimum number of levels arelog2⟮n+1⟯ . If we consider that the height of leaf node is considered as 0, then the formula will be log2⟮n+1⟯−1.
d)A binary tree with ‘L’ leaves has at least log2L+1 number of levels.
e)If a binary tree has 0 or 2 children, then number of leaf nodes are always one more than nodes with two children.
As binary tree is one kind of tree; it has all properties of tree in graph theory.

2)ANS:
A binary tree has a better time complexity for searching O(log N) but in the worst case can be the same as a linked list O(n). This means searching a binary tree will be faster than searching a linked list. Also, binary trees store values implicity sorted, so sorting operations are trivial.

Binary trees are great because they allow efficient sorting and searching. Their disadvantage is that in the worst case they can degenerate into a linked list in terms of efficiency. For example, inserting already-sorted data into a tree. Another disadvantage is coding complexity. Binary trees are much more complex than linked lists, especially for deletion and memory freeing. Also, to solve the problem of degeneration stated above, a self-balancing tree must be used which creates even more complexity.

Linked lists are simple to implement and have many practical applications, however, they have a lot of limitations. The best search algorithm that can be used on them is a linear search. The best sorting algorithms that can be used are not the best available. For example, any sort that requires random-access cannot be used on a linked list.
In reply to Md Assaduzzaman

Re: Answer the question and discuss if you have any confusion

by RIFAT JAHAN ZIM 201-15-3611 -

01:- Ans to the question no.1.The value of the left sub-tree key is lower than that of the parent (main) node key.
The value of the key of the right sub-tree is greater than or equal to the value of the root of its parent (root) node.
Thus, Binary Search Tree has divided all its sub-trees into two parts; Left sub-tree and right sub-tree and it can be defined as -left sub-tree (keys) < node (key) ≤ right sub-tree (keys) .

 02
Binary search tree is better than linked list or sorted array because it can be used in many different settings, including an algorithm for search-problems and specific decision-making methods for optimization problems

In reply to Md Assaduzzaman

Re: Answer the question and discuss if you have any confusion

by Jannatul Ferdous Moon -
Ans to the question no : 1

Binary search tree is a tree where all the nodes follow the following characteristics -

The value of the left sub-tree key is lower than that of the parent (main) node key.
The value of the key of the right sub-tree is greater than or equal to the value of the root of its parent (root) node.
Thus, Binary Search Tree has divided all its sub-trees into two parts; Left sub-tree and right sub-tree and it can be defined as -left sub-tree (keys) < node (key) ≤ right sub-tree (keys) .


Ans to the question no : 2

Binary search tree is better than linked list or sorted array. Binary search can be used in many different settings, including an algorithm for search-problems and specific decision-making methods for optimization problems -

Binary search requires that the input data maintains a partial ordering (in simple terms, it is sorted in non-decreasing order). The benefit we want out of the algorithm is to access each value at the middle position in constant time. In a linked list, getting the middle position can take [math]O(n)[/math] time. So, the time complexity would go from [math]O(\log{n})[/math] to [math]O(n\log{n})[/math]. So, a data structure like an array is much more suitable because you can access any member of the array at constant time. Remember that data must be selected to use binary search.
In reply to Md Assaduzzaman

Re: Answer the question and discuss if you have any confusion

by Shohanur Rahman 201-15-3401 -

Answer for question-01

Binary Search Tree is a node-based binary tree data structure which has the following properties:

  • The left subtree of a node contains only nodes with keys lesser than the node’s key.
  • The right subtree of a node contains only nodes with keys greater than the node’s key.
  • The left and right subtree each must also be a binary search tree.

Answer for question-02

Binary search trees are better than linked lists or sorted arrays. Binary search can be used in many different settings, including an algorithm for search-problems and specific decision-making methods for optimization problems. Binary search requires maintaining a partial sequence of input data (usually it is sorted in sort order). The advantage we want outside of the algorithm is to access the position between each value at constant time. In a linked list, it may take time to get the position between [math] and (n) [/ math]. So the complexity of time will go from [mathematics] and (log-log {n}) [/ math] to [mathematics] and (n গ log} n}) [/ mathematics]. Data structures like arrays are much more suitable because you can slowly access any member of the array. Note that data must be selected to use a binary search.

In reply to Md Assaduzzaman

Re: Answer the question and discuss if you have any confusion

by Sajib Bormon 201-15-3773 -
Answer to the question no:1


A Binary Search Tree (BST) is a tree in which all the nodes follow the below-mentioned properties :

1. The value of the key of the left sub-tree is less than the value of its parent (root) node's key.

2. The value of the key of the right sub-tree is greater than or equal to the value of its parent (root) node's key.

3. Thus, BST divides all its sub-trees into two segments; the left sub-tree and the right sub-tree and can be defined as −

left_subtree (keys) < node (key) ≤ right_subtree (keys)


Answer to the question no:2

Binary search is an algorithm for the search-problem, and can be utilized in many different settings, including certain kinds of decision procedures for optimization problems.

Binary search requires that the input data maintains a partial ordering (in simple terms, it is sorted in non-decreasing order). The benefit we want out of the algorithm is to access each value at the middle position in constant time. In a linked list, getting the middle position can take [math]O(n)[/math] time. So the time complexity would go from [math]O(\log{n})[/math] to [math]O(n\log{n})[/math].

A data structure such as an array is far more suitable as you can access any member of the array in constant time. Remember that the data must be sorted to use binary search
In reply to Md Assaduzzaman

Re: Answer the question and discuss if you have any confusion

by Md Taufiq ali -
1. Properties of Binary Search Tree.
A Binary Search Tree (BST) is a tree in which all the nodes follow the below-mentioned properties −

The value of the key of the left sub-tree is less than the value of its parent (root) node's key.

The value of the key of the right sub-tree is greater than or equal to the value of its parent (root) node's key.

Thus, BST divides all its sub-trees into two segments; the left sub-tree and the right sub-tree and can be defined as −

left_subtree (keys) < node (key) ≤ right_subtree (keys)



2. binary search tree is better than linked list or sorted array.
Binary search is an algorithm for the search-problem, and can be utilized in many different settings, including certain kinds of decision procedures for optimization problems.

Binary search requires that the input data maintains a partial ordering (in simple terms, it is sorted in non-decreasing order). The benefit we want out of the algorithm is to access each value at the middle position in constant time. In a linked list, getting the middle position can take [math]O(n)[/math] time. So the time complexity would go from [math]O(\log{n})[/math] to [math]O(n\log{n})[/math].

A data structure such as an array is far more suitable as you can access any member of the array in constant time. Remember that the data must be sorted to use binary search.
In reply to Md Assaduzzaman

Re: Answer the question and discuss if you have any confusion

by Mohammad Nadiatul Islam Sakib -
Answer to the Q. No 01

The value of the left sub-tree key is lower than that of the parent (main) node key.
The value of the key of the right sub-tree is greater than or equal to the value of the root of its parent (root) node.
Thus, Binary Search Tree has divided all its sub-trees into two parts; Left sub-tree and right sub-tree and it can be defined as -left sub-tree (keys) < node (key) ≤ right sub-tree (keys) .

Answer to the Q. No 02


Binary search tree is better than linked list or sorted array because it can be used in many different settings, including an algorithm for search-problems and specific decision-making methods for optimization problems
In reply to Md Assaduzzaman

Re: Answer the question and discuss if you have any confusion

by Md. Sakibuzzaman Alif -
1. Properties of Binary Search Tree.
A Binary Search Tree (BST) is a tree in which all the nodes follow the below-mentioned properties −

The value of the key of the left sub-tree is less than the value of its parent (root) node's key.

The value of the key of the right sub-tree is greater than or equal to the value of its parent (root) node's key.

Thus, BST divides all its sub-trees into two segments; the left sub-tree and the right sub-tree and can be defined as −

left_subtree (keys) < node (key) ≤ right_subtree (keys)



2. binary search tree is better than linked list or sorted array.
Binary search is an algorithm for the search-problem, and can be utilized in many different settings, including certain kinds of decision procedures for optimization problems.

Binary search requires that the input data maintains a partial ordering (in simple terms, it is sorted in non-decreasing order). The benefit we want out of the algorithm is to access each value at the middle position in constant time. In a linked list, getting the middle position can take [math]O(n)[/math] time. So the time complexity would go from [math]O(\log{n})[/math] to [math]O(n\log{n})[/math].

A data structure such as an array is far more suitable as you can access any member of the array in constant time. Remember that the data must be sorted to use binary search.
In reply to Md Assaduzzaman

Re: Answer the question and discuss if you have any confusion

by 201-15-3293 Abdur Razzak -
1. Properties of Binary Search Tree.
A Binary Search Tree (BST) is a tree in which all the nodes follow the below-mentioned properties −

The value of the key of the left sub-tree is less than the value of its parent (root) node's key.

The value of the key of the right sub-tree is greater than or equal to the value of its parent (root) node's key.

Thus, BST divides all its sub-trees into two segments; the left sub-tree and the right sub-tree and can be defined as −

left_subtree (keys) < node (key) ≤ right_subtree (keys)



2. binary search tree is better than linked list or sorted array.
Binary search is an algorithm for the search-problem, and can be utilized in many different settings, including certain kinds of decision procedures for optimization problems.

Binary search requires that the input data maintains a partial ordering (in simple terms, it is sorted in non-decreasing order). The benefit we want out of the algorithm is to access each value at the middle position in constant time. In a linked list, getting the middle position can take [math]O(n)[/math] time. So the time complexity would go from [math]O(\log{n})[/math] to [math]O(n\log{n})[/math].

A data structure such as an array is far more suitable as you can access any member of the array in constant time. Remember that the data must be sorted to use binary search
In reply to Md Assaduzzaman

Re: Answer the question and discuss if you have any confusion

by Tapu Chandra Malo -
1. Properties of Binary Search Tree.
A Binary Search Tree (BST) is a tree which follow the below-mentioned properties −

# The value of the key of the left sub-tree is less than the value of its parent (root) node's key. and
The value of the key of the right sub-tree is greater than the value of its parent (root) node's key

Those BST divides all its sub-trees into two segments; the left sub-tree and the right sub-tree and can be defined as −

left_sub tree (keys) < node (key) ≤ right_sub tree (keys)



2. Binary search tree is better than linked list or sorted array.
Binary search is an algorithm for the search-problem, and can be utilized in many different settings, including certain kinds of decision procedures for optimization problems.

Binary search requires that the input data maintains a partial ordering (in simple terms, it is sorted in non-decreasing order). so that time complexity is O(logn).The benefit we want out of the algorithm is to access each value at the middle position in constant time. In a linked list, getting the middle position can take [math]O(n)[/math] time. So the time complexity would go from [math]O(\log{n})[/math] to [math]O(n\log{n})[/math].

A data structure such as an array is far more suitable as you can access any member of the array in constant time. Remember that the data must be sorted to use binary search.
In reply to Md Assaduzzaman

Re: Answer the question and discuss if you have any confusion

by Md. Farhatul Haider -
1. Properties of Binary Search Tree.
A Binary Search Tree (BST) is a tree in which all the nodes follow the below-mentioned properties −

The value of the key of the left sub-tree is less than the value of its parent (root) node's key.

The value of the key of the right sub-tree is greater than or equal to the value of its parent (root) node's key.

Thus, BST divides all its sub-trees into two segments; the left sub-tree and the right sub-tree and can be defined as −

left_subtree (keys) < node (key) ≤ right_subtree (keys)



2. Binary search tree is better than linked list or sorted array.
Binary search is an algorithm for the search-problem, and can be utilized in many different settings, including certain kinds of decision procedures for optimization problems.

Binary search requires that the input data maintains a partial ordering (in simple terms, it is sorted in non-decreasing order). The benefit we want out of the algorithm is to access each value at the middle position in constant time. In a linked list, getting the middle position can take [math]O(n)[/math] time. So the time complexity would go from [math]O(\log{n})[/math] to [math]O(n\log{n})[/math].

A data structure such as an array is far more suitable as you can access any member of the array in constant time. Remember that the data must be sorted to use binary search.
In reply to Md Assaduzzaman

Re: Answer the question and discuss if you have any confusion

by Mst Naima Sultana -

1. Properties of Binary Search Tree.
A Binary Search Tree (BST) is a tree which follow the below-mentioned properties −

# The value of the key of the left sub-tree is less than the value of its parent (root) node's key. and
The value of the key of the right sub-tree is greater than the value of its parent (root) node's key

Those BST divides all its sub-trees into two segments; the left sub-tree and the right sub-tree and can be defined as −

left_sub tree (keys) < node (key) ≤ right_sub tree (keys)



2. Binary search tree is better than linked list or sorted array.
Binary search is an algorithm for the search-problem, and can be utilized in many different settings, including certain kinds of decision procedures for optimization problems.

Binary search requires that the input data maintains a partial ordering (in simple terms, it is sorted in non-decreasing order). so that time complexity is O(logn).The benefit we want out of the algorithm is to access each value at the middle position in constant time. In a linked list, getting the middle position can take [math]O(n)[/math] time. So the time complexity would go from [math]O(\log{n})[/math] to [math]O(n\log{n})[/math].

A data structure such as an array is far more suitable as you can access any member of the array in constant time. Remember that the data must be sorted to use binary search.

In reply to Md Assaduzzaman

Re: Answer the question and discuss if you have any confusion

by Nujhat Tabassum(201-15-3363) -

Answer to the question. No-01

Properties of binary search tree:

• The key of any node is greater than all keys occurring in its left subtree and less than all keys occurring in its right subtree.
• The value of the left sub-tree key is lower than that of the parent (main) node key.
• The value of the key of the right sub-tree is greater than or equal to the value of the root of its parent (root) node.
• Binary Search Tree has divided all its sub-trees into two parts; Left sub-tree and right sub-tree and it can be defined as -left sub-tree (keys) < node (key) ≤ right sub-tree (keys).
• The data stored at each node has a distinguished key which is unique in the tree and belongs to a total order.


Answer to the question. No-02

Why binary search tree is better than linked list or sorted array:

A binary tree has a better time complexity for searching O(log N) but in the worst case can be the same as a linked list O(n). This means searching a binary tree will (in most cases) be faster than searching a linked list. Also, binary trees store values implicitly sorted, so sorting operations are trivial.
A binary search tree is better than a linked list or sorted array. Binary search can be used in many different settings, including an algorithm for search-problems and specific decision-making methods for optimization problems.
Binary search requires that the input data maintains a partial ordering (in simple terms, it is sorted in non-decreasing order). The benefit of the algorithm is to access each value at the middle position in constant time. In a linked list, getting the middle position can take [math]O(n)[/math] time. So, the time complexity would go from [math]O(\log{n})[/math] to [math]O(n\log{n})[/math].
In reply to Md Assaduzzaman

Re: Answer the question and discuss if you have any confusion

by Md.Habibur Rahman -
1. Properties of Binary Search Tree.
A Binary Search Tree (BST) is a tree in which all the nodes follow the below-mentioned properties −

The value of the key of the left sub-tree is less than the value of its parent (root) node's key.

The value of the key of the right sub-tree is greater than or equal to the value of its parent (root) node's key.

Thus, BST divides all its sub-trees into two segments; the left sub-tree and the right sub-tree and can be defined as −

left_subtree (keys) < node (key) ≤ right_subtree (keys)



2. Binary search tree is better than linked list or sorted array.
Binary search is an algorithm for the search-problem, and can be utilized in many different settings, including certain kinds of decision procedures for optimization problems.

Binary search requires that the input data maintains a partial ordering (in simple terms, it is sorted in non-decreasing order). The benefit we want out of the algorithm is to access each value at the middle position in constant time. In a linked list, getting the middle position can take [math]O(n)[/math] time. So the time complexity would go from [math]O(\log{n})[/math] to [math]O(n\log{n})[/math].

A data structure such as an array is far more suitable as you can access any member of the array in constant time. Remember that the data must be sorted to use binary search.
In reply to Md Assaduzzaman

Re: Answer the question and discuss if you have any confusion

by Arpita Ghosh 201-15-3422 -
Picture of DSLab-(PC-J)
1. Properties of Binary Search Tree.
A Binary Search Tree (BST) is a tree in which all the nodes follow the below-mentioned properties −

The value of the key of the left sub-tree is less than the value of its parent (root) node's key.

The value of the key of the right sub-tree is greater than or equal to the value of its parent (root) node's key.

Thus, BST divides all its sub-trees into two segments; the left sub-tree and the right sub-tree and can be defined as −

left_subtree (keys) < node (key) ≤ right_subtree (keys)



2. binary search tree is better than linked list or sorted array.
Binary search is an algorithm for the search-problem, and can be utilized in many different settings, including certain kinds of decision procedures for optimization problems.

Binary search requires that the input data maintains a partial ordering (in simple terms, it is sorted in non-decreasing order). The benefit we want out of the algorithm is to access each value at the middle position in constant time. In a linked list, getting the middle position can take [math]O(n)[/math] time. So the time complexity would go from [math]O(\log{n})[/math] to [math]O(n\log{n})[/math].

A data structure such as an array is far more suitable as you can access any member of the array in constant time. Remember that the data must be sorted to use binary search.
In reply to Md Assaduzzaman

Re: Answer the question and discuss if you have any confusion

by Md. Seyam Ali Biswas -
1. Properties of Binary Search Tree.
A Binary Search Tree (BST) is a tree in which all the nodes follow the below-mentioned properties −

The value of the key of the left sub-tree is less than the value of its parent (root) node's key.

The value of the key of the right sub-tree is greater than or equal to the value of its parent (root) node's key.

Thus, BST divides all its sub-trees into two segments; the left sub-tree and the right sub-tree and can be defined as −

left_subtree (keys) < node (key) ≤ right_subtree (keys)



2. Binary search tree is better than linked list or sorted array.
Binary search is an algorithm for the search-problem, and can be utilized in many different settings, including certain kinds of decision procedures for optimization problems.

Binary search requires that the input data maintains a partial ordering (in simple terms, it is sorted in non-decreasing order). The benefit we want out of the algorithm is to access each value at the middle position in constant time. In a linked list, getting the middle position can take [math]O(n)[/math] time. So the time complexity would go from [math]O(\log{n})[/math] to [math]O(n\log{n})[/math].

A data structure such as an array is far more suitable as you can access any member of the array in constant time. Remember that the data must be sorted to use binary search
In reply to Md Assaduzzaman

Re: Answer the question and discuss if you have any confusion

by Nabid Anjum Ome 201-15-3308 -
Answer for question-01

Binary Search Tree is a node-based binary tree data structure which has the following properties:

The left subtree of a node contains only nodes with keys lesser than the node’s key.
The right subtree of a node contains only nodes with keys greater than the node’s key.
The left and right subtree each must also be a binary search tree.
Answer for question-02

Binary search trees are better than linked lists or sorted arrays. Binary search can be used in many different settings, including an algorithm for search-problems and specific decision-making methods for optimization problems. Binary search requires maintaining a partial sequence of input data (usually it is sorted in sort order). The advantage we want outside of the algorithm is to access the position between each value at constant time. In a linked list, it may take time to get the position between [math] and (n) [/ math]. So the complexity of time will go from [mathematics] and (log-log {n}) [/ math] to [mathematics] and (n log} n}) [/ mathematics]. Data structures like arrays are much more suitable because you can slowly access any member of the array. Note that data must be selected to use a binary search
In reply to Md Assaduzzaman

Re: Answer the question and discuss if you have any confusion

by Mafujul Haque Plabon -
Answer to the question no (1)

The value of the left sub-tree key is lower than that of the parent (main) node key.
The value of the key of the right sub-tree is greater than or equal to the value of the root of its parent (root) node.
Thus, Binary Search Tree has divided all its sub-trees into two parts; Left sub-tree and right sub-tree and it can be defined as -left sub-tree (keys) < node (key) ≤ right sub-tree (keys) .

Answer to the question no (2)


Binary search tree is better than linked list or sorted array because it can be used in many different settings, including an algorithm for search-problems and specific decision-making methods for optimization problems
In reply to Md Assaduzzaman

Re: Answer the question and discuss if you have any confusion

by Tanmoy Komer (201-15-3439) -
1. Properties of Binary Search Tree.
A Binary Search Tree (BST) is a tree in which all the nodes follow the below-mentioned properties −

The value of the key of the left sub-tree is less than the value of its parent (root) node's key.

The value of the key of the right sub-tree is greater than or equal to the value of its parent (root) node's key.

Thus, BST divides all its sub-trees into two segments; the left sub-tree and the right sub-tree and can be defined as −

left_subtree (keys) < node (key) ≤ right_subtree (keys)



2. binary search tree is better than linked list or sorted array.
Binary search is an algorithm for the search-problem, and can be utilized in many different settings, including certain kinds of decision procedures for optimization problems.

Binary search requires that the input data maintains a partial ordering (in simple terms, it is sorted in non-decreasing order). The benefit we want out of the algorithm is to access each value at the middle position in constant time. In a linked list, getting the middle position can take [math]O(n)[/math] time. So the time complexity would go from [math]O(\log{n})[/math] to [math]O(n\log{n})[/math].

A data structure such as an array is far more suitable as you can access any member of the array in constant time. Remember that the data must be sorted to use binary sear
In reply to Md Assaduzzaman

Re: Answer the question and discuss if you have any confusion

by Mohammad Ashikuzzaman 3438 -
Answer to the question No:-01

Binary search tree is a tree where all the nodes follow the following characteristics -

The value of the left sub-tree key is lower than that of the parent (main) node key.
The value of the key of the right sub-tree is greater than or equal to the value of the root of its parent (root) node.
Thus, Binary Search Tree has divided all its sub-trees into two parts; Left sub-tree and right sub-tree and it can be defined as -left sub-tree (keys) < node (key) ≤ right sub-tree (keys).

Answer to question No:-02

2. Binary search tree is better than linked list or sorted array.
Binary search is an algorithm for the search-problem, and can be utilized in many different settings, including certain kinds of decision procedures for optimization problems.

Binary search requires that the input data maintains a partial ordering (in simple terms, it is sorted in non-decreasing order). The benefit we want out of the algorithm is to access each value at the middle position in constant time. In a linked list, getting the middle position can take [math]O(n)[/math] time. So the time complexity would go from [math]O(\log{n})[/math] to [math]O(n\log{n})[/math].

A data structure such as an array is far more suitable as you can access any member of the array in constant time. Remember that the data must be sorted to use binary search.
In reply to Md Assaduzzaman

Re: Answer the question and discuss if you have any confusion

by Rimon Rimon -
1. Properties of Binary Search Tree.
A Binary Search Tree (BST) is a tree in which all the nodes follow the below-mentioned properties −

The value of the key of the left sub-tree is less than the value of its parent (root) node's key.

The value of the key of the right sub-tree is greater than or equal to the value of its parent (root) node's key.

Thus, BST divides all its sub-trees into two segments; the left sub-tree and the right sub-tree and can be defined as −

left_subtree (keys) < node (key) ≤ right_subtree (keys)



2. Binary search tree is better than linked list or sorted array.
Binary search is an algorithm for the search-problem, and can be utilized in many different settings, including certain kinds of decision procedures for optimization problems.

Binary search requires that the input data maintains a partial ordering (in simple terms, it is sorted in non-decreasing order). The benefit we want out of the algorithm is to access each value at the middle position in constant time. In a linked list, getting the middle position can take [math]O(n)[/math] time. So the time complexity would go from [math]O(\log{n})[/math] to [math]O(n\log{n})[/math].

A data structure such as an array is far more suitable as you can access any member of the array in constant time. Remember that the data must be sorted to use binary search
In reply to Md Assaduzzaman

Re: Answer the question and discuss if you have any confusion

by Tania Ahmed Nipa (201-15-3282) -
Answer of 1:
Some properties are −
The maximum number of nodes at level ‘l’ will be 2l−1 . Here level is the number of nodes on path from root to the node, including the root itself. We are considering the level of root is 1.
Maximum number of nodes present in binary tree of height h is 2h−1 . Here height is the max number of nodes on root to leaf path. Here we are considering height of a tree with one node is 1.
In a binary tree with n nodes, minimum possible height or minimum number of levels arelog2⟮n+1⟯ . If we consider that the height of leaf node is considered as 0, then the formula will be log2⟮n+1⟯−1
A binary tree with ‘L’ leaves has at least log2L+1 number of levels
If a binary tree has 0 or 2 children, then number of leaf nodes are always one more than nodes with two children.

Answer of 2:
Binary search is performed in a sorted array . Even if it is a linked list , the data needs to be in sorted order or else binary search is not possible because we keep shrinking the number of elements in which the number gets searched . If the linked list is not sorted only linear search is possible.
In reply to Md Assaduzzaman

Re: Answer the question and discuss if you have any confusion

by Atikur Mithun -

Answer to the question number :1

Binary search tree is a tree where all the nodes follow the following characteristics -

The value of the left sub-tree key is lower than that of the parent (main) node key.
The value of the key of the right sub-tree is greater than or equal to the value of the root of its parent (root) node.
Thus, Binary Search Tree has divided all its sub-trees into two parts; Left sub-tree and right sub-tree and it can be defined as -left sub-tree (keys) < node (key) ≤ right sub-tree (keys) .

Answer to question number :2

binary search tree is better than linked list or sorted array.

Binary search is an algorithm for the search-problem, and can be utilized in many different settings, including certain kinds of decision procedures for optimization problems.

Binary search requires that the input data maintains a partial ordering (in simple terms, it is sorted in non-decreasing order). The benefit we want out of the algorithm is to access each value at the middle position in constant time. In a linked list, getting the middle position can take [math]O(n)[/math] time. So the time complexity would go from [math]O(\log{n})[/math] to [math]O(n\log{n})[/math].

A data structure such as an array is far more suitable as you can access any member of the array in constant time. Remember that the data must be sorted to use binary search



 


In reply to Md Assaduzzaman

Re: Answer the question and discuss if you have any confusion

by Md.Majedul Haque Tanin -
Answer to the Q. No 01

The value of the left sub-tree key is lower than that of the parent (main) node key.
The value of the key of the right sub-tree is greater than or equal to the value of the root of its parent (root) node.
Thus, Binary Search Tree has divided all its sub-trees into two parts; Left sub-tree and right sub-tree and it can be defined as -left sub-tree (keys) < node (key) ≤ right sub-tree (keys) .

Answer to the Q. No 02


Binary search tree is better than linked list or sorted array because it can be used in many different settings, including an algorithm for search-problems and specific decision-making methods for optimization problems
In reply to Md Assaduzzaman

Re: Answer the question and discuss if you have any confusion

by Anika Nawar -
1. Properties of Binary Search Tree.
A Binary Search Tree (BST) is a tree in which all the nodes follow the below-mentioned properties −

The value of the key of the left sub-tree is less than the value of its parent (root) node's key.

The value of the key of the right sub-tree is greater than or equal to the value of its parent (root) node's key.

Thus, BST divides all its sub-trees into two segments; the left sub-tree and the right sub-tree and can be defined as −

left_subtree (keys) < node (key) ≤ right_subtree (keys)



2. binary search tree is better than linked list or sorted array.
Binary search is an algorithm for the search-problem, and can be utilized in many different settings, including certain kinds of decision procedures for optimization problems.

Binary search requires that the input data maintains a partial ordering (in simple terms, it is sorted in non-decreasing order). The benefit we want out of the algorithm is to access each value at the middle position in constant time. In a linked list, getting the middle position can take [math]O(n)[/math] time. So the time complexity would go from [math]O(\log{n})[/math] to [math]O(n\log{n})[/math].

A data structure such as an array is far more suitable as you can access any member of the array in constant time. Remember that the data must be sorted to use binary search.
In reply to Md Assaduzzaman

Re: Answer the question and discuss if you have any confusion

by Arif Hosen -
Answer to the question no1:
Properties of Binary Search Tree.
A Binary Search Tree (BST) is a tree in which all the nodes follow the below-mentioned properties −
The value of the key of the left sub-tree is less than the value of its parent (root) node's key.
The value of the key of the right sub-tree is greater than or equal to the value of its parent (root) node's key.

Thus, BST divides all its sub-trees into two segments; the left sub-tree and the right sub-tree and can be defined as −
left subtree (keys) < node (key) ≤ right subtree (keys).



Answer to the question no 2:
Binary search tree is better than linked list or sorted array.
Binary search is an algorithm for the search-problem, and can be utilized in many different settings, including certain kinds of decision procedures for optimization problems.
Binary search requires that the input data maintains a partial ordering (in simple terms, it is sorted in non-decreasing order). The benefit we want out of the algorithm is to access each value at the middle position in constant time. In a linked list, getting the middle position can take [math]O(n)[/math] time. So the time complexity would go from [math]O(\log{n})[/math] to [math]O(n\log{n})[/math].
A data structure such as an array is far more suitable as you can access any member of the array in constant time. Remember that the data must be sorted to use binary search.
In reply to Md Assaduzzaman

Re: Answer the question and discuss if you have any confusion

by 201-15-3311 Mehedi -
1. Properties of Binary Search Tree.
A Binary Search Tree (BST) is a tree in which all the nodes follow the below-mentioned properties −

The value of the key of the left sub-tree is less than the value of its parent (root) node's key.

The value of the key of the right sub-tree is greater than or equal to the value of its parent (root) node's key.

Thus, BST divides all its sub-trees into two segments; the left sub-tree and the right sub-tree and can be defined as −

left_subtree (keys) < node (key) ≤ right_subtree (keys)



2. Binary search tree is better than linked list or sorted array.
Binary search is an algorithm for the search-problem, and can be utilized in many different settings, including certain kinds of decision procedures for optimization problems.

Binary search requires that the input data maintains a partial ordering (in simple terms, it is sorted in non-decreasing order). The benefit we want out of the algorithm is to access each value at the middle position in constant time. In a linked list, getting the middle position can take [math]O(n)[/math] time. So the time complexity would go from [math]O(\log{n})[/math] to [math]O(n\log{n})[/math].

A data structure such as an array is far more suitable as you can access any member of the array in constant time. Remember that the data must be sorted to use binary search.
In reply to Md Assaduzzaman

Re: Answer the question and discuss if you have any confusion

by Wahid Tausif -
Answer to the question no(1)
Properties of Binary Search Tree.
A Binary Search Tree (BST) is a tree in which all the nodes follow the below-mentioned properties −

The value of the key of the left sub-tree is less than the value of its parent (root) node's key.

The value of the key of the right sub-tree is greater than or equal to the value of its parent (root) node's key.

Thus, BST divides all its sub-trees into two segments; the left sub-tree and the right sub-tree and can be defined as −

left_subtree (keys) < node (key) ≤ right_subtree (keys)

Answer to the question no(2)

Binary search tree is better than linked list or sorted array.
Binary search is an algorithm for the search-problem, and can be utilized in many different settings, including certain kinds of decision procedures for optimization problems.

Binary search requires that the input data maintains a partial ordering (in simple terms, it is sorted in non-decreasing order). The benefit we want out of the algorithm is to access each value at the middle position in constant time. In a linked list, getting the middle position can take [math]O(n)[/math] time. So the time complexity would go from [math]O(\log{n})[/math] to [math]O(n\log{n})[/math].

A data structure such as an array is far more suitable as you can access any member of the array in constant time. Remember that the data must be sorted to use binary search.
In reply to Md Assaduzzaman

Re: Answer the question and discuss if you have any confusion

by Taslima Jahan Tushi 201-15-3269 -

Answer to the question no.01

The value of the left sub-tree key is lower than that of the parent (main) node key.
The value of the key of the right sub-tree is greater than or equal to the value of the root of its parent (root) node.
Thus, Binary Search Tree has divided all its sub-trees into two parts; Left sub-tree and right sub-tree and it can be defined as -left sub-tree (keys) < node (key) ≤ right sub-tree (keys) .

Answer to the Q. No 02


Binary search tree is better than linked list or sorted array because it can be used in many different settings, including an algorithm for search-problems and specific decision-making methods for optimization problems

In reply to Md Assaduzzaman

Re: Answer the question and discuss if you have any confusion

by Sumia Sarower Trisha 201-15-3474 -


1)Ans:

The properties of Binary Search Tree:

a)The maximum number of nodes at level ‘l’ will be 2l−1 . Here level is the number of nodes on path from root to the node, including the root itself. We are considering the level of root is 1.

b)Maximum number of nodes present in binary tree of height h is 2h−1 . Here height is the max number of nodes on root to leaf path. Here we are considering height of a tree with one node is 1.

c)In a binary tree with n nodes, minimum possible height or minimum number of levels arelog2⟮n+1⟯ . If we consider that the height of leaf node is considered as 0, then the formula will be log2⟮n+1⟯−1.

d)A binary tree with ‘L’ leaves has at least log2L+1 number of levels.

e)If a binary tree has 0 or 2 children, then number of leaf nodes are always one more than nodes with two children.

As binary tree is one kind of tree; it has all properties of tree in graph theory.


2)ANS:

A binary tree has a better time complexity for searching O(log N) but in the worst case can be the same as a linked list O(n). This means searching a binary tree will be faster than searching a linked list. Also, binary trees store values implicity sorted, so sorting operations are trivial.

Binary trees are great because they allow efficient sorting and searching. Their disadvantage is that in the worst case they can degenerate into a linked list in terms of efficiency. For example, inserting already-sorted data into a tree. Another disadvantage is coding complexity. Binary trees are much more complex than linked lists, especially for deletion and memory freeing. Also, to solve the problem of degeneration stated above, a self-balancing tree must be used which creates even more complexity.

Linked lists are simple to implement and have many practical applications, however, they have a lot of limitations. The best search algorithm that can be used on them is a linear search. The best sorting algorithms that can be used are not the best available. For example, any sort that requires random-access cannot be used on a linked list.


1. Properties of Binary Search Tree.

A Binary Search Tree (BST) is a tree in which all the nodes follow the below-mentioned properties −

The value of the key of the left sub-tree is less than the value of its parent (root) node's key.

The value of the key of the right sub-tree is greater than or equal to the value of its parent (root) node's key.

Thus, BST divides all its sub-trees into two segments; the left sub-tree and the right sub-tree and can be defined as −

left_subtree (keys) < node (key) ≤ right_subtree (keys)


2. binary search tree is better than linked list or sorted array.

Binary search is an algorithm for the search-problem, and can be utilized in many different settings, including certain kinds of decision procedures for optimization problems.

Binary search requires that the input data maintains a partial ordering (in simple terms, it is sorted in non-decreasing order). The benefit we want out of the algorithm is to access each value at the middle position in constant time. In a linked list, getting the middle position can take [math]O(n)[/math] time. So the time complexity would go from [math]O(\log{n})[/math] to [math]O(n\log{n})[/math].

A data structure such as an array is far more suitable as you can access any member of the array in constant time. Remember that the data must be sorted to use binary search.

In reply to Md Assaduzzaman

Re: Answer the question and discuss if you have any confusion

by Arnab Saha -
1. Properties of Binary Search Tree.
A Binary Search Tree (BST) is a tree in which all the nodes follow the below-mentioned properties −

The value of the key of the left sub-tree is less than the value of its parent (root) node's key.

The value of the key of the right sub-tree is greater than or equal to the value of its parent (root) node's key.

Thus, BST divides all its sub-trees into two segments; the left sub-tree and the right sub-tree and can be defined as −

left_subtree (keys) < node (key) ≤ right_subtree (keys)



2. Binary search tree is better than linked list or sorted array.
Binary search is an algorithm for the search-problem, and can be utilized in many different settings, including certain kinds of decision procedures for optimization problems.

Binary search requires that the input data maintains a partial ordering (in simple terms, it is sorted in non-decreasing order). The benefit we want out of the algorithm is to access each value at the middle position in constant time. In a linked list, getting the middle position can take [math]O(n)[/math] time. So the time complexity would go from [math]O(\log{n})[/math] to [math]O(n\log{n})[/math].

A data structure such as an array is far more suitable as you can access any member of the array in constant time. Remember that the data must be sorted to use binary search.
In reply to Md Assaduzzaman

Re: Answer the question and discuss if you have any confusion

by Sabbir Hossain Antar -
Answer 01
A Binary Search Tree (BST) is a tree in which all the nodes follow the below-mentioned properties −

The value of the key of the left sub-tree is less than the value of its parent (root) node's key.

The value of the key of the right sub-tree is greater than or equal to the value of its parent (root) node's key.

Thus, BST divides all its sub-trees into two segments; the left sub-tree and the right sub-tree and can be defined as −

left_subtree (keys) < node (key) ≤ right_subtree (keys)


Answer 02
Binary search tree is better than linked list or sorted array.
Binary search is an algorithm for the search-problem, and can be utilized in many different settings, including certain kinds of decision procedures for optimization problems.
Binary search requires that the input data maintains a partial ordering (in simple terms, it is sorted in non-decreasing order). The benefit we want out of the algorithm is to access each value at the middle position in constant time. In a linked list, getting the middle position can take [math]O(n)[/math] time. So the time complexity would go from [math]O(\log{n})[/math] to [math]O(n\log{n})[/math].
A data structure such as an array is far more suitable as you can access any member of the array in constant time. Remember that the data must be sorted to use binary search.
In reply to Md Assaduzzaman

Re: Answer the question and discuss if you have any confusion

by Amir Hamza Shuvo 201-15-3397 -
Properties of Binary Search Tree.
1.0...A Binary Search Tree (BST) is a tree in which all the nodes follow the below-mentioned properties −

The value of the key of the left sub-tree is less than the value of its parent (root) node's key.

The value of the key of the right sub-tree is greater than or equal to the value of its parent (root) node's key.

Thus, BST divides all its sub-trees into two segments; the left sub-tree and the right sub-tree and can be defined as −

left_subtree (keys) < node (key) ≤ right_subtree (keys)



2. Binary search tree is better than linked list or sorted array.
Binary search is an algorithm for the search-problem, and can be utilized in many different settings, including certain kinds of decision procedures for optimization problems.

Binary search requires that the input data maintains a partial ordering (in simple terms, it is sorted in non-decreasing order). The benefit we want out of the algorithm is to access each value at the middle position in constant time. In a linked list, getting the middle position can take [math]O(n)[/math] time. So the time complexity would go from [math]O(\log{n})[/math] to [math]O(n\log{n})[/math].

A data structure such as an array is far more suitable as you can access any member of the array in constant time. Remember that the data must be sorted to use binary search.
In reply to Md Assaduzzaman

Re: Answer the question and discuss if you have any confusion

by Dipta bhowmik15-3425 -
Answer to the question no 1:

In computer science, a binary search tree, also called an ordered or sorted binary tree, is a rooted binary tree whose internal nodes each store a key greater than all the keys in the node's left subtree and less than those in its right subtree.

Binary Search Tree is a node-based binary tree data structure which has the following properties:

1.All nodes of left subtree are less than the root node

2.All nodes of right subtree are more than the root node.

3.The left and right subtree each must also be a binary search tree.

Answer to the question no 2:

Binary search is an algorithm for the search-problem, and can be utilized in many different settings, including certain kinds of decision procedures for optimization problems.



Binary search requires that the input data maintains a partial ordering (in simple terms, it is sorted in non-decreasing order). The benefit we want out of the algorithm is to access each value at the middle position in constant time. In a linked list, getting the middle position can take O(n) time. So the time complexity would go from O(logn) to O(nlogn) .



A data structure such as an array is far more suitable as you can access any member of the array in constant time. Remember that the data must be sorted to use binary search.
In reply to Md Assaduzzaman

Re: Answer the question and discuss if you have any confusion

by Dipta bhowmik15-3425 -
1. Properties of Binary Search Tree.
A Binary Search Tree (BST) is a tree in which all the nodes follow the below-mentioned properties −

The value of the key of the left sub-tree is less than the value of its parent (root) node's key.

The value of the key of the right sub-tree is greater than or equal to the value of its parent (root) node's key.

Thus, BST divides all its sub-trees into two segments; the left sub-tree and the right sub-tree and can be defined as −

left_subtree (keys) < node (key) ≤ right_subtree (keys).

2)ANS:
A binary tree has a better time complexity for searching O(log N) but in the worst case can be the same as a linked list O(n). This means searching a binary tree will be faster than searching a linked list. Also, binary trees store values implicity sorted, so sorting operations are trivial.

Binary trees are great because they allow efficient sorting and searching. Their disadvantage is that in the worst case they can degenerate into a linked list in terms of efficiency. For example, inserting already-sorted data into a tree. Another disadvantage is coding complexity. Binary trees are much more complex than linked lists, especially for deletion and memory freeing. Also, to solve the problem of degeneration stated above, a self-balancing tree must be used which creates even more complexity.

Linked lists are simple to implement and have many practical applications, however, they have a lot of limitations. The best search algorithm that can be used on them is a linear search. The best sorting algorithms that can be used are not the best available. For example, any sort that requires random-access cannot be used on a linked list.
In reply to Md Assaduzzaman

Re: Answer the question and discuss if you have any confusion

by Sabrina Sultana -
1. Properties of Binary Search Tree.
A Binary Search Tree (BST) is a tree in which all the nodes follow the below-mentioned properties −

The value of the key of the left sub-tree is less than the value of its parent (root) node's key.

The value of the key of the right sub-tree is greater than or equal to the value of its parent (root) node's key.

Thus, BST divides all its sub-trees into two segments; the left sub-tree and the right sub-tree and can be defined as −

left_subtree (keys) < node (key) ≤ right_subtree (keys)



2. Binary search tree is better than linked list or sorted array.
Binary search is an algorithm for the search-problem, and can be utilized in many different settings, including certain kinds of decision procedures for optimization problems.

Binary search requires that the input data maintains a partial ordering (in simple terms, it is sorted in non-decreasing order). The benefit we want out of the algorithm is to access each value at the middle position in constant time. In a linked list, getting the middle position can take [math]O(n)[/math] time. So the time complexity would go from [math]O(\log{n})[/math] to [math]O(n\log{n})[/math].

A data structure such as an array is far more suitable as you can access any member of the array in constant time. Remember that the data must be sorted to use binary search.