Book Image

Everyday Data Structures

By : William Smith
Book Image

Everyday Data Structures

By: William Smith

Overview of this book

Explore a new world of data structures and their applications easily with this data structures book. Written by software expert William Smith, you?ll learn how to master basic and advanced data structure concepts. ? Fully understand data structures using Java, C and other common languages ? Work through practical examples and learn real-world applications ? Get to grips with data structure problem solving using case studies
Table of Contents (20 chapters)
Everyday Data Structures
Credits
About the Author
About the Reviewer
www.PacktPub.com
Customer Feedback
Preface
Free Chapter
1
Data Types: Foundational Structures

Bucket sort


Bucket sort, also known as bin sort, is a type of distribution sorting algorithm. Distribution sorts are algorithms that scatter the original values into any sort of intermediate structures that are then ordered, gathered, and merged into the final output structure. It is important to note that, although bucket sort is considered a distribution sort, most implementations typically leverage a comparison sort to order the contents of the buckets. This algorithm sorts values by distributing them throughout an array of arrays that are called buckets. Elements are distributed based on their value and the range of values assigned to each bucket. For example, if one bucket inclusively accepts a range of values from 5 to 10, and the original set consists of 3, 5, 7, 9, and 11, the values 5, 7, and 9 would be placed in this hypothetical bucket.

Once all of the values have been distributed to their respective buckets, the buckets themselves are then ordered by recursively calling the bucket...