#### 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
Everyday Data Structures
Credits
www.PacktPub.com
Customer Feedback
Preface
Free Chapter
Data Types: Foundational Structures
Arrays: Foundational Collections
Lists: Linear Collections
Stacks: LIFO Collections
Queues: FIFO Collections
Dictionaries: Keyed Collections
Sets: No Duplicates
Structs: Complex Types
Trees: Non-Linear Structures
Heaps: Ordered Trees
Graphs: Values with Relationships
Sorting: Bringing Order Out Of Chaos
Searching: Finding What You Need

## Selection sort

A selection sort can be described as an in-place comparison. This algorithm divides a collection or list of objects into two parts. The first is a subset of objects that have already been sorted, ranging from 0 to i, where i is the next object to be sorted. The second is a subset of objects that have not been sorted, ranging from i to n, where n is the length of the collection.

The selection sort algorithm works by taking the smallest or largest value in a collection and placing it at the beginning of the unsorted subarray by swapping it with the object at the current index. For example, consider ordering a collection in ascending order. At the outset, the sorted subarray will consist of 0 members, while the unsorted subarray will consist of all the members in the set. The selection sort algorithm will find the smallest member in the unsorted subarray and place it at the beginning of the unsorted subarray.

At this point, the sorted subarray consists of one member, while the...