Search⌘ K

Introduction

Explore the fundamentals of sorting, how it organizes data in ascending or descending order, and the differences between internal and external sorting techniques. Understand common sorting algorithms like selection sort, insertion sort, bubble sort, quicksort, heap sort, and merge sort. Learn to implement comparison functions to manage sorting logic effectively in Go.

What is sorting?

Sorting involves organizing elements in ascending or descending order. For example, we sort playing cards by value to make it easier to find the ones we need. Understanding sorting algorithms is the first step towards understanding algorithm analysis. Many sorting algorithms have been developed and analyzed.

Example

When we visit a library, the books are organized into streams (“Algorithms,” “Operating Systems,” “Networking,” and so on). Sorting arranges data ...