Forum discussion on Binary Search Tree

binary tree

binary tree

by Arnob Sarker -
Number of replies: 0

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.