From 2fe9fceca24a59d62d61c3adf923a220692aaeae Mon Sep 17 00:00:00 2001 From: varun jain <98322627+varunnitian@users.noreply.github.com> Date: Wed, 5 Oct 2022 12:24:18 +0530 Subject: [PATCH] Update Bucket-sort.md --- docs/en/Sorting/Bucket-sort.md | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/docs/en/Sorting/Bucket-sort.md b/docs/en/Sorting/Bucket-sort.md index ccd62867..f7f7f3e7 100644 --- a/docs/en/Sorting/Bucket-sort.md +++ b/docs/en/Sorting/Bucket-sort.md @@ -14,10 +14,11 @@ Auxiliary space: O(n) ## Steps -Suppose there is an array **arr** with **n** distinct elements. Given an element **A**, we can find its index by counting the number of elements smaller than **A**. +The bucket sort algorithm works as follows. -1. If the element is at its correct position, simply leave it as it is. -2. Else, we have to find the correct position of **A** by counting the number of elements smaller than it. Another element **B** is replaced to be moved to its correct position. This process continues until we get an element at the original position of **A**. +1. Assume the input array is: +2. +3. Else, we have to find the correct position of **A** by counting the number of elements smaller than it. Another element **B** is replaced to be moved to its correct position. This process continues until we get an element at the original position of **A**. The above-illustrated process constitutes a cycle. Repeat this cycle for every element of the list until the list is sorted.