I'm no expert on this, so I may be mistaken, but I believe there's a mistake in your Binary Search Tree diagram.
Shouldn't the 20 be to the left of the 21, rather than the left of the 38?
You are right. Everything to the right of 21 should be greater (or equal to, if the tree contains duplicates) than 21.
Good catch!
Oh, I'm so sorry! It was a typo. It was 30 instead of 20 in my initial thread. Thank you for noticing! Fixed it! :)
Are you sure you want to hide this comment? It will become hidden in your post, but will still be visible via the comment's permalink.
Hide child comments as well
Confirm
For further actions, you may consider blocking this person and/or reporting abuse
We're a place where coders share, stay up-to-date and grow their careers.
I'm no expert on this, so I may be mistaken, but I believe there's a mistake in your Binary Search Tree diagram.
Shouldn't the 20 be to the left of the 21, rather than the left of the 38?
You are right. Everything to the right of 21 should be greater (or equal to, if the tree contains duplicates) than 21.
Good catch!
Oh, I'm so sorry! It was a typo. It was 30 instead of 20 in my initial thread. Thank you for noticing! Fixed it! :)