diff --git a/Binary_Tree b/Binary_Tree index 7c33453..8ccbe07 100644 --- a/Binary_Tree +++ b/Binary_Tree @@ -1,33 +1,33 @@ -A binary tree is a structure comprising nodes, where each node has the following 3 components: +//A binary tree is a structure comprising nodes, where each node has the following 3 components: - Data element: Stores any kind of data in the node - Left pointer: Points to the tree on the left side of node - Right pointer: Points to the tree on the right side of the node + // Data element: Stores any kind of data in the node + // Left pointer: Points to the tree on the left side of node + //// Right pointer: Points to the tree on the right side of the node -As the name suggests, the data element stores any kind of data in the node. -The left and right pointers point to binary trees on the left and right side of the node respectively. +//As the name suggests, the data element stores any kind of data in the node. +//The left and right pointers point to binary trees on the left and right side of the node respectively. -If a tree is empty, it is represented by a null pointer. +//If a tree is empty, it is represented by a null pointer. -The following image explains the various components of a tree. +//The following image explains the various components of a tree. -enter image description here +//enter image description here -Commonly-used terminologies +//Commonly-used terminologies - Root: Top node in a tree - Child: Nodes that are next to each other and connected downwards - Parent: Converse notion of child - Siblings: Nodes with the same parent - Descendant: Node reachable by repeated proceeding from parent to child - Ancestor: Node reachable by repeated proceeding from child to parent. - Leaf: Node with no children - Internal node: Node with at least one child - External node: Node with no children + // Root: Top node in a tree + // Child: Nodes that are next to each other and connected downwards + // Parent: Converse notion of child + // Siblings: Nodes with the same parent + // Descendant: Node reachable by repeated proceeding from parent to child + // Ancestor: Node reachable by repeated proceeding from child to parent. + // Leaf: Node with no children + // Internal node: Node with at least one child + // External node: Node with no children -Structure code of a tree node +//Structure code of a tree node -In programming, trees are declared as follows: +//In programming, trees are declared as follows: struct node { diff --git a/DFS_Graphs_using_adjacency_list b/DFS_Graphs_using_adjacency_list index 11c62d3..abf54ef 100644 --- a/DFS_Graphs_using_adjacency_list +++ b/DFS_Graphs_using_adjacency_list @@ -1,4 +1,5 @@ //dfs of a graph complexity o(V+E) +//Algorithm #include using namespace std; //Adjacency list and visited list diff --git a/Island_Using_DFS.cpp b/Island_Using_DFS.cpp index 928b52c..78c9adc 100644 --- a/Island_Using_DFS.cpp +++ b/Island_Using_DFS.cpp @@ -1,3 +1,4 @@ +//Imp Algorithm #include #include diff --git a/Top 10 Algorithms and Data Structures for Competitive Programming b/Top 10 Algorithms and Data Structures for Competitive Programming index 034eb47..45424e2 100644 --- a/Top 10 Algorithms and Data Structures for Competitive Programming +++ b/Top 10 Algorithms and Data Structures for Competitive Programming @@ -1,4 +1,4 @@ - +IMP Algorithm Top 10 Algorithms and Data Structures for Competitive Programming In this post “Important top 10 algorithms and data structures for competitive coding “. diff --git a/Tree_DFS_Pre_Post_In_Order_Traversal.cpp b/Tree_DFS_Pre_Post_In_Order_Traversal.cpp index 7ee8e90..d0f6a44 100644 --- a/Tree_DFS_Pre_Post_In_Order_Traversal.cpp +++ b/Tree_DFS_Pre_Post_In_Order_Traversal.cpp @@ -1,4 +1,5 @@ /* +Algorithm Time complexity : o(n) Space complexity : Best,average case -> o(log(n)) & Worst -> o(n) */ diff --git a/Tree_Traversal_levelorder.cpp b/Tree_Traversal_levelorder.cpp index b1d3418..16a2c31 100644 --- a/Tree_Traversal_levelorder.cpp +++ b/Tree_Traversal_levelorder.cpp @@ -1,4 +1,5 @@ /* +Imp Algorithm Time complexity : o(n) Space complexity : Best -> o(1) & Worst -> o(n) */