Skip to Main Content
Beginning Java Data Structures and Algorithms
book

Beginning Java Data Structures and Algorithms

by James Cutajar
July 2018
Beginner content levelBeginner
202 pages
5h 4m
English
Packt Publishing
Content preview from Beginning Java Data Structures and Algorithms

Binary Search Tree Operations

Binary search trees are normal binary trees in which data is organized in an ordered manner. Consider the same problem we encountered in the previous section, of the school keeping a student's records by using the passport numbers as a key. Figure 3.10 shows an example of how you can organize the data in a binary tree.

Note how at each node the left child has a key which is less than its own. On the other hand, the right child has a larger key. Shown in the diagram, the root node has a left child containing a key of a smaller value than the root key. On the other hand, the right child has a key of a larger value than the root.

This rule is repeated through the entire tree. In a binary search tree, the left child ...

Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Start your free trial

You might also like

Java 9 Data Structures and Algorithms

Java 9 Data Structures and Algorithms

Debasish Ray Chawdhuri
Object-Oriented Data Structures Using Java, 4th Edition

Object-Oriented Data Structures Using Java, 4th Edition

Nell Dale, Daniel T. Joyce, Chip Weems

Publisher Resources

ISBN: 9781789537178Supplemental Content