Skip to content

Commit 96ca32e

Browse files
author
Raven G. Duran
committed
Documentation Update : BST Insert
1 parent c0f4e67 commit 96ca32e

File tree

1 file changed

+27
-2
lines changed

1 file changed

+27
-2
lines changed

documentation.md

+27-2
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ Documentation
22
========
33

44
This is the documentation for the source code. I'll update it from time to time if I found bugs or things that
5-
needs to be discussed.
5+
need to be discussed.
66

77
#### Node Structure
88
```C
@@ -22,4 +22,29 @@ The node is composed of 1 value and 3 pointers: (This is a bit self-explanatory,
2222

2323
There are also 2 global pointer variables used in the whole program:
2424
* tRoot : Points to the root of the whole tree
25-
* tLeaf : Points to the last inserted leaf in the tree
25+
* tLeaf : Points to the last inserted leaf in the tree
26+
27+
#### BST Insertion like functions
28+
```C
29+
struct node* newNode(int value,struct node *parent);
30+
struct node* insertN(struct node *root,int value,struct node *parent);
31+
```
32+
33+
The two functions are the core in creating a BST like structure.
34+
* newNode function : This function creates a basic node. Paremeters:
35+
** value : The value you want to put to the node.
36+
** parent : The parent of the Node (Can also be NULL).
37+
* insertN function : This inserts a new node properly into the tree. Parameters:
38+
** root : Pointer to the root of the tree of where to insert the new node.
39+
** value : The value you want to insert.
40+
** parent : The parent of the new node you are inserting. (A bit redundant, but this helps a lot in tracking trees)
41+
42+
If you want a more thorough explanation of the BST functions,
43+
then you can go to this link: [Binary Search Tree Operations Explanation (Bisaya)](http://pastebin.com/DCkF4JAn)
44+
45+
46+
47+
48+
49+
50+

0 commit comments

Comments
 (0)