Search icon CANCEL
Subscription
0
Cart icon
Your Cart (0 item)
Close icon
You have no products in your basket yet
Save more on your purchases! discount-offer-chevron-icon
Savings automatically calculated. No voucher code required.
Arrow left icon
Explore Products
Best Sellers
New Releases
Books
Videos
Audiobooks
Learning Hub
Newsletter Hub
Free Learning
Arrow right icon
timer SALE ENDS IN
0 Days
:
00 Hours
:
00 Minutes
:
00 Seconds
Arrow up icon
GO TO TOP
Data Structures and Program Design Using Python

You're reading from   Data Structures and Program Design Using Python A Self-Teaching Introduction to Data Structures and Python

Arrow left icon
Product type Paperback
Published in Aug 2024
Publisher Mercury_Learning
ISBN-13 9781836640738
Length 394 pages
Edition 1st Edition
Languages
Arrow right icon
Authors (3):
Arrow left icon
Mercury Learning and Information Mercury Learning and Information
Author Profile Icon Mercury Learning and Information
Mercury Learning and Information
D. Malhotra D. Malhotra
Author Profile Icon D. Malhotra
D. Malhotra
N. Malhotra N. Malhotra
Author Profile Icon N. Malhotra
N. Malhotra
Arrow right icon
View More author details
Toc

Table of Contents (16) Chapters Close

Preface
1. Acknowledgments
2. Chapter 1: Introduction to Data Structures FREE CHAPTER 3. Chapter 2: Introduction to Python 4. Chapter 3: Arrays/Lists 5. Chapter 4: Linked Lists 6. Chapter 5: Queues 7. Chapter 6: Searching and Sorting 8. Chapter 7: Stacks 9. Chapter 8: Trees 10. Chapter 9: Multi-Way Search Trees 11. Chapter 10: Hashing 12. Chapter 11: Files 13. Chapter 12: Graphs 14. Index
Appendix: Answers to Multiple Choice Questions

8.4BINARY SEARCH TREE

A Binary Search Tree (BST) is a variant of a binary tree. The special property of a binary search tree is that all the nodes in the left sub-tree have a value less than that of the root node. Similarly, all the nodes in the right sub-tree have a value more than that of the root node. Hence, the binary search tree is also known as an ordered binary tree, because all the nodes in a binary search tree are ordered. The left and the right sub-trees are also binary search trees, and thus the same property is applicable on every sub-tree in the binary search tree. Figure 8.14 represents a binary search tree in that all the keys are ordered.

In Figure 8.14, the root node is 50. The left sub-tree of the root node consists of the nodes 19, 7, 32, 25, and 43. We can see that all these nodes have smaller values than the root node, and hence it constitutes the left sub-tree. Similarly, the right sub-tree of the root node consists of the nodes 75, 87, 80, and 99. Here also,...

lock icon The rest of the chapter is locked
CONTINUE READING
83
Tech Concepts
36
Programming languages
73
Tech Tools
Icon Unlimited access to the largest independent learning library in tech of over 8,000 expert-authored tech books and videos.
Icon Innovative learning tools, including AI book assistants, code context explainers, and text-to-speech.
Icon 50+ new titles added per month and exclusive early access to books as they are being written.
Data Structures and Program Design Using Python
Register for a free Packt account to unlock a world of extra content!
A free Packt account unlocks extra newsletters, articles, discounted offers, and much more. Start advancing your knowledge today.
Unlock this book and the full library FREE for 7 days
Get unlimited access to 7000+ expert-authored eBooks and videos courses covering every tech area you can think of
Renews at $19.99/month. Cancel anytime
Modal Close icon
Modal Close icon