-
-
Notifications
You must be signed in to change notification settings - Fork 5.7k
feat: add tests for binary search trees #1769
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
feat: add tests for binary search trees #1769
Conversation
2877788
to
eb71e2e
Compare
@anandfresh
anandfresh
Jan 15, 2025
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.
Just a shorthand recommendation.
Checking for if(found) {
will check for not null and not undefined .
So no need to explicitly use if (found !== null) {
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.
The search return value can only be null
or a Node
, hence the implicit check.
search(val) { if (this.value === val) { return this } else if (val < this.value && this.left !== null) { return this.left.search(val) } else if (val > this.value && this.right !== null) { return this.right.search(val) } return null }
1d252d7
into
TheAlgorithms:master
Uh oh!
There was an error while loading. Please reload this page.
Open in Gitpod know more
Describe your change:
Checklist:
Example:
UserProfile.js
is allowed butuserprofile.js
,Userprofile.js
,user-Profile.js
,userProfile.js
are notFixes: #{$ISSUE_NO}
.