Book Image

Java 9 Data Structures and Algorithms

By : Debasish Ray Chawdhuri
Book Image

Java 9 Data Structures and Algorithms

By: Debasish Ray Chawdhuri

Overview of this book

Java 9 Data Structures and Algorithms covers classical, functional, and reactive data structures, giving you the ability to understand computational complexity, solve problems, and write efficient code. This book is based on the Zero Bug Bounce milestone of Java 9. We start off with the basics of algorithms and data structures, helping you understand the fundamentals and measure complexity. From here, we introduce you to concepts such as arrays, linked lists, as well as abstract data types such as stacks and queues. Next, we’ll take you through the basics of functional programming while making sure you get used to thinking recursively. We provide plenty of examples along the way to help you understand each concept. You will also get a clear picture of reactive programming, binary searches, sorting, search trees, undirected graphs, and a whole lot more!
Table of Contents (19 chapters)
Java 9 Data Structures and Algorithms
Credits
About the Author
About the Reviewer
www.PacktPub.com
Customer Feedback
Preface
Index

Summary


In this chapter, we saw a collection of searchable and modifiable data structures. All of these allowed you to insert new elements or delete elements while still remaining searchable and that too quite optimally. We saw binary search trees in which a search follows the paths of the tree from the root. Binary search trees can be modified optimally while still remaining searchable if they are of the self-balancing type. We studied two different kinds of self-balancing trees: AVL trees and red-black trees. Red-black trees are less balanced than AVL trees, but they involve a fewer number of rotations than AVL trees. In the end, we went through the hash table, which is a different kind of searchable structure. Although the worst case complexity of search or insertion is O(n), hash tables provide constant time search and average time insertion (O(lg n)) in most cases. If a hash table does not keep growing, the average insertion and deletion operations will also be constant time.

In the...