-
Notifications
You must be signed in to change notification settings - Fork 174
Add Trees Structure #682 #780
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Changes from all commits
39fe7d6
61d9cc3
0497cf2
86ab09f
d7fc3b3
aa9edb9
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,94 @@ | ||
| { | ||
| "meta": { | ||
| "structure": "trees", | ||
| "structure_name": "Trees" | ||
| }, | ||
| "categories": { | ||
| "Creating Basic Tree Objects":{ | ||
| "structure_of_node": "What data structure do you create the tree node with?", | ||
| "information_inside_node": "Information stored inside of a node", | ||
| "create_node_class": "Creating the node class or struct", | ||
| "create_a_node_object": "Creating an object of the node class or struct", | ||
| "create_tree_class": "Creating the tree class", | ||
| "create_a_tree_object": "Creating an object of the tree class", | ||
| "create_node_for_tst": "Creating a node for a ternary search tree (TST)", | ||
| "create_n_ary_trees": "Creating N-ary trees", | ||
| "create_btree_node": "Creating a node for a B-tree", | ||
| "create_btree": "Creating a B-tree", | ||
| "create_b+tree_node": "Creating a node for a B+ tree", | ||
| "create_b+tree": "Creating a B+ tree" | ||
|
Comment on lines
+13
to
+19
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Similarly there might be multiple kinds of trees in the language (like Java seems to have a billion of them). Maybe these could be |
||
| }, | ||
| "Depth-First Traversals":{ | ||
| "inorder_tree_traversal": "Inorder Tree Traversal", | ||
| "preorder_tree_traversal": "Pre-order Tree Traversal", | ||
| "postorder_tree_traversal": "Post-order Tree Traversal", | ||
| "tst_tree_traversal": "Ternary Search Tree (TST) Traversal", | ||
| "n_ary_tree_level_order_traversal": "N-ary Tree Level Order Traversal using DFS", | ||
| "btree_traversal": "B-tree Traversal" | ||
|
Comment on lines
+22
to
+27
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Would traversals change algorithms depending on the type of tree? I can see depth-first and breadth-first being different from each other, but not necessarily a different language function depending on the type of tree. Does that make sense? Unless you know of any other examples, maybe the category should be "Traversals" and then concepts could be " |
||
| }, | ||
| "Breadth-First Traversals":{ | ||
| "level_order_tree_traversal_recursion": "Level Order Tree Traversal using recursion", | ||
| "level_order_tree_traversal_queues": "Level Order Tree Traversal using queues", | ||
| "n_ary_tree_level_order_traversal": "N-ary Tree Level Order Traversal using BFS" | ||
| }, | ||
| "Balancing Trees":{ | ||
| "is_balanced_binary_tree": "Check if a binary tree is height-balanced", | ||
| "balance_factor_of_node": "Finding the balance factor of a node in an AVL tree", | ||
| "right_rotation_avl_tree": "Right rotation in an AVL tree", | ||
| "left_rotation_avl_tree": "Left rotation in an AVL tree", | ||
| "left_right_rotation_avl_tree": "Left-Right rotation in an AVL tree", | ||
| "right_left_rotation_avl_tree": "Right-Left rotation in an AVL tree", | ||
| "rebalance_avl_tree": "Rebalancing an AVL tree after insertion or deletion", | ||
| "is_red_black_tree": "Check if a binary tree is a valid Red-Black tree" | ||
| }, | ||
| "Insertions": { | ||
| "insert_node_in_tree": "Inserting a new node in a binary tree", | ||
| "insert_node_in_bst": "Inserting a node with a given value in a binary search tree", | ||
| "insert_node_in_avl_tree": "Inserting a node with a given value in an AVL tree", | ||
| "insert_node_in_red_black_tree_black_parent": "Inserting a node in a Red-Black tree when the parent is black", | ||
| "insert_node_in_red_black_tree_red_parent_and_uncle": "Inserting a node in a Red-Black tree when the parent and uncle are red", | ||
| "insert_node_in_red_black_tree_red_parent_and_black_uncle": "Inserting a node in a Red-Black tree when the parent is red and uncle is black", | ||
| "insert_node_in_tst": "Inserting a word in a ternary search tree (TST)", | ||
| "insert_node_in_btree": "Inserting an element in a B-tree", | ||
| "insert_node_in_parent_b+tree": "Inserting an element in a parent node of a B+ tree", | ||
| "insert_node_in_leaf_b+tree": "Inserting an element in a leaf node of a B+ tree" | ||
|
Comment on lines
+45
to
+54
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Similar to traversals, would an insert really be different depending on the type of tree? Behind the scenes, yes, if you were implementing the algorithm. But here we just want to be a language reference, and I imagine (unless you know otherwise), this is probably just one type of insert. Same for Deletions. |
||
| }, | ||
| "Deletions":{ | ||
| "delete_node_binary_tree": "Deleting a node with a given value from a binary tree", | ||
| "delete_leaf_node_bst": "Deleting a leaf node from a binary search tree", | ||
| "delete_node_with_single_child_bst": "Deleting a node with a single child from a binary search tree", | ||
| "delete_node_with_both_children_bst": "Deleting a node with both children from a binary search tree", | ||
| "delete_node_avl_tree": "Deleting a node with a given value from an AVL tree", | ||
| "delete_black_node_red_sibling_red_black_tree": "Deleting a black node with a red sibling node from a Red-Black tree", | ||
| "delete_black_node_black_sibling_black_children_red_black_tree": "Deleting a black node with a black sibling node that has black children from a Red-Black tree", | ||
| "delete_black_node_black_sibling_far_red_child_red_black_tree": "Deleting a black node with a black sibling node that has a far red child from a Red-Black tree", | ||
| "delete_black_node_black_sibling_near_red_child_red_black_tree": "Deleting a black node with a black sibling node that has a near red child from a Red-Black tree", | ||
| "delete_node_in_tst": "Deleting a word from a ternary search tree (TST)", | ||
| "delete_node_in_btree": "Deleting an element from a B-tree", | ||
| "delete_node_in_b+tree": "Deleting an element from a B+ tree" | ||
| }, | ||
| "Search":{ | ||
| "search_value_in_binary_tree": "Searching for a value in a binary tree", | ||
| "search_value_in_bst_recursion": "Searching for a value in a binary search tree using recursion", | ||
| "search_value_in_bst_iteration": "Searching for a value in a binary search tree using iteration", | ||
| "search_word_in_tst": "Searching for a word in a ternary search tree (TST)", | ||
| "search_element_in_btree": "Searching for an element in a B-tree", | ||
| "search_element_in_b+tree": "Searching for an element in a B+ tree" | ||
| }, | ||
| "Find":{ | ||
| "find_minimum_value_in_bst": "Finding the minimum value in a binary search tree", | ||
| "find_maximum_value_in_bst": "Finding the maximum value in a binary search tree", | ||
| "find_height_of_tree": "Finding the height of a tree", | ||
| "find_depth_of_node": "Finding the depth of a node in a tree", | ||
| "find_lca_binary_tree": "Finding the lowest common ancestor (LCA) of two nodes in a binary tree", | ||
| "find_lca_bst": "Finding the lowest common ancestor (LCA) of two nodes in a binary search tree", | ||
| "find_kth_smallest_element_bst": "Finding the k-th smallest element in a binary search tree", | ||
| "find_kth_largest_element_bst": "Finding the k-th largest element in a binary search tree", | ||
| "find_diameter_of_tree": "Finding the diameter of a tree", | ||
| "find_level_of_node": "Finding the level of a node in a tree", | ||
| "find_parent_node_btree": "Finding the parent node of a given node in a B-tree", | ||
| "find_predecessor_successor_bst": "Finding the predecessor and successor of a given node in a binary search tree" | ||
| } | ||
|
Comment on lines
+70
to
+91
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. It seems "search" and "find" are kind of similar. Could this be one category? |
||
|
|
||
| } | ||
| } | ||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Since this is a language reference tool, we wouldn't create the tree/node classes, we would be using whatever pre-existing tree class(es) that exists in whatever language. So this might just be
name_of_tree_classandinstantiate_tree_object(as a tree probably has some type of generic object attached to it in Java/C++/Rust/etc.).Maybe rework this part so it's not implying you're custom-making your own trees.