Find Node in Binary Search Tree - Part 1: Recursive Solution

  Рет қаралды 2,234

Phyley CS

Phyley CS

Күн бұрын

Пікірлер: 3
@haythemoldaccount7953
@haythemoldaccount7953 3 жыл бұрын
Hello, thank you for the video, I was wondering if it were possible to make the function int instead of Node* and just return root->key instead of root ? thank you
@PhyleyCS
@PhyleyCS 3 жыл бұрын
Hi, glad you liked it! The point of the function is to return the pointer to the node with a given key (or nullptr if there's no such node), so you actually already know what the key is. The problem with returning the key is that it does not seem useful and it is not clear what should be returned if the key is not in the tree. If what you want is to just know whether the key is present in the tree, you can return a bool instead of Node *.
@haythemoldaccount7953
@haythemoldaccount7953 3 жыл бұрын
@@PhyleyCS oohhhh okay silly me lol, I can't believe that slipped my mind, that makes a lot more sense haha. thanks
Binary Tree Algorithms for Technical Interviews - Full Course
1:48:53
freeCodeCamp.org
Рет қаралды 736 М.
Sigma Kid Mistake #funny #sigma
00:17
CRAZY GREAPA
Рет қаралды 14 МЛН
كم بصير عمركم عام ٢٠٢٥😍 #shorts #hasanandnour
00:27
hasan and nour shorts
Рет қаралды 11 МЛН
Миллионер | 3 - серия
36:09
Million Show
Рет қаралды 2,2 МЛН
The hidden beauty of the A* algorithm
19:22
Polylog
Рет қаралды 902 М.
AVL Trees & Rotations (Self-Balancing Binary Search Trees)
20:38
Back To Back SWE
Рет қаралды 354 М.
American was shocked by 7 Slavic countries word differences!!
15:29
World Friends
Рет қаралды 852 М.
Delete a node from Binary Search Tree
18:27
mycodeschool
Рет қаралды 1,1 МЛН
Binary search tree - Implementation in C/C++
18:36
mycodeschool
Рет қаралды 1,3 МЛН
C++ vs Rust: which is faster?
21:15
fasterthanlime
Рет қаралды 405 М.
Towers of Hanoi: A Complete Recursive Visualization
21:13
Reducible
Рет қаралды 494 М.
Sigma Kid Mistake #funny #sigma
00:17
CRAZY GREAPA
Рет қаралды 14 МЛН