Fix spelling (#27828)

Fixed "to to" to "to", "letfmost" to "leftmost", "definiton" to "definition"
pull/29843/head
Jurica Zuanović 2019-03-07 22:23:16 +01:00 committed by Randell Dawson
parent 6ca11755a2
commit 3a7a57c67b
1 changed files with 2 additions and 2 deletions

View File

@ -32,7 +32,7 @@ The BST is built on the idea of the <a href='https://guide.freecodecamp.org/algo
Initially an empty tree without any nodes is created. The variable/identifier which must point to the root node is initialized with a `NULL` value.
#### Search
You always start searching the tree at the root node and go down from there. You compare the data in each node with the one you are looking for. If the compared node doesn't match then you either proceed to the right child or the left child, which depends on the outcome of the following comparison: If the node that you are searching for is lower than the one you were comparing it with, you proceed to to the left child, otherwise (if it's larger) you go to the right child. Why? Because the BST is structured (as per its definition), that the right child is always larger than the parent and the left child is always lesser.
You always start searching the tree at the root node and go down from there. You compare the data in each node with the one you are looking for. If the compared node doesn't match then you either proceed to the right child or the left child, which depends on the outcome of the following comparison: If the node that you are searching for is lower than the one you were comparing it with, you proceed to the left child, otherwise (if it's larger) you go to the right child. Why? Because the BST is structured (as per its definition), that the right child is always larger than the parent and the left child is always lesser.
###### Breadth-first search (BFS)
Breadth first search is an algorithm used to traverse a BST. It begins at the root node and travels in a lateral manner (side to side), searching for the desired node. This type of search can be described as O(n) given that each node is visited once and the size of the tree directly correlates to the length of the search.
@ -76,7 +76,7 @@ Where `n` is the number of nodes in the BST.
### Implementation of BST
Here's a definiton for a BST node having some data, referencing to its left and right child nodes.
Here's a definition for a BST node having some data, referencing to its left and right child nodes.
```c
struct node {