Searching in a Binary Search Tree
Read OriginalThis technical article details the process of searching for a value in a Binary Search Tree (BST). It explains the core properties of a BST and provides a step-by-step walkthrough of the search algorithm, which runs in O(log N) time on average. The article contrasts recursive and iterative implementations, discussing their respective time and space complexities (O(log N) vs O(1) space), and includes code examples for a TreeNode structure.
Comments
No comments yet
Be the first to share your thoughts!
Browser Extension
Get instant access to AllDevBlogs from your browser
Top of the Week
1
Using A Hidden Submit Button To Ensure Unnamed Submissions
Ben Nadel
•
2 votes
2
Agentic AI and Security
Martin Fowler
•
2 votes
3
Springs and Bounces in Native CSS
Josh Comeau
•
2 votes
4
uv+just for testing multiple Python versions
Daniel Feldroy
•
2 votes
5
Importing vs fetching JSON
Jake Archibald
•
2 votes
6
ServiceNow and Microsoft Copilot
Marius Sandbu
•
1 votes
7
The Learning Loop and LLMs
Martin Fowler
•
1 votes
8
🧠 Build an Agent Chat that Remembers — Persisting Conversations with Microsoft Agent Framework
Bruno Capuano
•
1 votes