First off a binary search tree is binary tree that has a left subtree of nodes that contains values less than the value of the node while the right subtree consists of a node greater than the value of the node. I find its a very applicable model because it accounts for much faster searches. There were many instances of BST's which we've encountered such as nested lists. The useful aspect of a BST seems to be that as opposed to iterating and finding the midpoint of list, the BST begins at the midpoint and the algorithm is based on either traversing right or left. I don't see much of a difference in implementing a BST as opposed to sorting a list, perhaps when referring to larger values it may be apparent that one has better performance.
BSTs seem to also attribute qualities similar to precedent methods as insertion, sorting, searching and delete. The following is an example of a BST:
The task of sorting consists of taking data and arranging it in some sort of predetermined order. Searching consists of trying to find a particular piece of data from the total set of data. As one might expect, searching is easier once the data have been sorted.
没有评论:
发表评论