filmov
tv
Insertion in Binary Tree based on parent node | Custom comparator in Apex | Apex Data Structures
Показать описание
Hello Trailblazers, In this tutorial we're going to see how we can insert a new node in binary tree recursively based on the parent node. We're going to refer the code we created in our previous tutorial and add a new insertData() method which is going to accept the new data, the parent data and a comparator class. Then it's going to compare if the parent data is equal to the data of any node in the binary tree or not, in case we find such a node, we're going to consider that node as our parent node and we'll link the new node as a child of the parent node. If not, we'll return NULL which means the node cannot be inserted in our binary tree.
Chapters:
0:00 Introduction
1:00 Insert Data Method Explanation
5:14 Insert Data Recursive Method Explanation
20:55 Revision
22:40 Use case: If the parent node is not found anywhere
24:00 Comparator class
24:50 IntegerCompare class
26:16 Code Execution
28:35 Possible use case
29:40 Wrapping Up
30:12 Time Complexity Analysis
31:42 Resources
Chapters:
0:00 Introduction
1:00 Insert Data Method Explanation
5:14 Insert Data Recursive Method Explanation
20:55 Revision
22:40 Use case: If the parent node is not found anywhere
24:00 Comparator class
24:50 IntegerCompare class
26:16 Code Execution
28:35 Possible use case
29:40 Wrapping Up
30:12 Time Complexity Analysis
31:42 Resources