Trees 6 recursive add

  Рет қаралды 9,690

RobEdwards

RobEdwards

Күн бұрын

Пікірлер: 12
@daleoking1
@daleoking1 7 жыл бұрын
Hello. Great videos first of all. Second: when you add a new node_Object, you increment the size of the tree(currentSize++) correct? So in this case the field variable currentSize represents the number of nodes in the tree and not the height right?!
@markforest6035
@markforest6035 7 жыл бұрын
Right because the currentSize++ established only at the end of the function , and its represent the number of all nodes in the tree.
@guillermoperez8250
@guillermoperez8250 6 жыл бұрын
Awesome. Just one typo: the overloaded method should be private, otherwise the counter will never be run. Also, making the insert position public doesn't sound like a good idea because people would mess it up.
@markforest6035
@markforest6035 7 жыл бұрын
Great video , Thanks you !
@tonysmiah
@tonysmiah 5 жыл бұрын
Can someone please confirm if this code compiles? Because it's a void return method, why are we returning a recursive add method? Thanks
@Shu-gm2xx
@Shu-gm2xx 5 жыл бұрын
Remove the return your code will run...
@mtushar
@mtushar 3 жыл бұрын
the add method returns null, so returning a add() call returns the return of it which is null when the recursive stack terminates.
@karenjang5201
@karenjang5201 6 жыл бұрын
why do you use return for either "return add(obj, node.right)" or "return add(obj, node.left) in the 2nd method? It is void method, so I thought you can call it without return
@guillermoperez8250
@guillermoperez8250 6 жыл бұрын
I think he uses return to prevent next lines to be executed. And eventually, you'll always be returning null. Because the actual insertion returns null. The calls you mention return what the recursive call returns... and that will always be null if the insertion succeded.
@ahmidahmid9303
@ahmidahmid9303 5 жыл бұрын
@@guillermoperez8250 no he is returning void not null
@MichaelSalo
@MichaelSalo 4 жыл бұрын
Hammer time at 2:37
@ahmidahmid9303
@ahmidahmid9303 5 жыл бұрын
thanks
Trees 7 Contains
5:17
RobEdwards
Рет қаралды 7 М.
Trees 11 Coding Rotations
12:32
RobEdwards
Рет қаралды 24 М.
黑天使被操控了#short #angel #clown
00:40
Super Beauty team
Рет қаралды 61 МЛН
Understanding B-Trees: The Data Structure Behind Modern Databases
12:39
Trees 8 Remove
11:17
RobEdwards
Рет қаралды 10 М.
Binary Tree Algorithms for Technical Interviews - Full Course
1:48:53
freeCodeCamp.org
Рет қаралды 748 М.
Trees 10 Rotations
8:14
RobEdwards
Рет қаралды 39 М.
AVL Trees & Rotations (Self-Balancing Binary Search Trees)
20:38
Back To Back SWE
Рет қаралды 365 М.
Red Black Tree 5 checking violations in the tree
13:42
RobEdwards
Рет қаралды 10 М.
Fast Inverse Square Root - A Quake III Algorithm
20:08
Nemean
Рет қаралды 5 МЛН