# Bubble Sort

# Introduction

It is a basic algorithm to sort numbers in an array in an **ascending order**.

# How It Works

For Ascending:

- It iterates through the array form index 0. It will check if the number at index
`i`

is**greater than**number at index`i+1`

and swaps it. Then it moves to check for next position till its at the end of the array length. For Descending: - It iterates through the array form index 0. It will check if the number at index
`i`

is**lesser than**number at index`i+1`

and swaps it. Then it moves to check for next position till its at the end of the array length. For Descending:

We will do ascending only.