8

Sorting Arrays—Selection, Bubble, Insertion, Merge and Quick Sorts

Sorting Arrays Sorting Arrays

Contents

  • A fundamental operation—sorting array contents to create an ordered list
  • Five sorting algorithms—bubble, selection, insertion, merge and quick sorts
  • Recursion
  • Sorting algorithm efficiency
8.1 INTRODUCTION

In Chapter 6, we saw that an ordered array can use the efficient binary search method. If the data are initially unordered, how can they be sorted into order? This chapter addresses sorting operations, examines in detail five algorithms (from many that exist) and compares their efficiency with the Big-O expression for each.

8.2 GENERAL PRINCIPLES ...

Get Introducing Data Structures with Java now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.