CodeNewbie Community 🌱

Cover image for Sorting Algorithms
Novice
Novice

Posted on

Sorting Algorithms

Introduction

What is the need to sort things?

Let us say we want to find a word in a dictionary. But there is an exception that the words are not sorted in alphabetical order.

This would require us to scan each and every page of the dictionary, which would take huge effort and time. This is the reason why sorting objects are important. It tremendously helps in searching for items quickly.

There are various ways in which we can sort items. In Computer Science, we make use of various algorithms to sort objects. These algorithms are also known as sorting algorithms. Let’s see what they mean.

Introduction to Sorting Algorithms

A Sorting Algorithm is used to rearrange a given array or list elements according to a comparison operator on the elements. The comparison operator is used to decide the new order of elements in the respective data structure.

For example: The below list of characters is sorted in increasing order of their ASCII values. That is, the character with lesser ASCII value will be placed first than the character with higher ASCII value.


   "computerscience"    ---->    "ccceeeimnoprstu"
Enter fullscreen mode Exit fullscreen mode

In this series of Sorting Algorithms, we will take a look on the various sorting algorithms used in Computer Science, how they work, and what are their efficiencies and limits.

Top comments (0)