Skip to content

QueenieCplusplus/DataStructure_Search

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

14 Commits
 
 
 
 
 
 

Repository files navigation

Binary Search Tree

搜索樹(二元搜索樹)

Binary Search Tree is for a static set of ids. That is, we make no additons to or deletions from the set. Only searches are performed.

A sorted file can be searched using a Binary Tree.

                          if
                         /  \
                       do    return
                          for 
                         /  \
                       do    while

To find an optimal binary search tree for a given static file, we shall decide on a cost measure for this tree.

When searching for an id at level q, function search makes q iteratins of the for loop.