-
Bubble Sort
-
Array: [64, 34, 25, 12, 22, 11, 90]
-
- Sorted Array: [{arr.join(", ")}]
-
-
- )
-}
-```
-
-## Explanation
-
-In the above example, we have an array of numbers `[64, 34, 25, 12, 22, 11, 90]`. We are using the bubble sort algorithm to sort the array in ascending order. The bubble sort algorithm compares each pair of adjacent items and swaps them if they are in the wrong order. The algorithm repeats this process until the array is sorted. The sorted array is `[11, 12, 22, 25, 34, 64, 90]`. The time complexity of the bubble sort is O(n
-
Selection Sort
-
Array: [64, 25, 12, 22, 11]
-
- Sorted Array: [{arr.join(", ")}]
-
-
- )
-}
-```
-
-In the above example, we have an array of numbers `[64, 25, 12, 22, 11]`. We are using the selection sort algorithm to sort the array in ascending order. The selection sort algorithm divides the input list into two parts: the sublist of items already sorted and the sublist of items remaining to be sorted. It repeatedly finds the minimum element from the unsorted part and puts it at the beginning of the unsorted part. The algorithm maintains two subarrays in a given array. The subarray which is already sorted and the remaining subarray which is unsorted. In every iteration of selection sort, the minimum element from the unsorted subarray is picked and moved to the sorted subarray. The sorted array is `[11, 12, 22, 25, 64]`. The time complexity of the selection sort is O(n^2) and the space complexity is O(1).
-
-:::
-
-## Conclusion
-
-In this article, we learned about the selection sort algorithm. Selection sort is an in-place comparison sorting algorithm that divides the input list into two parts: the sublist of items already sorted and the sublist of items remaining to be sorted. It repeatedly finds the minimum element from the unsorted part and puts it at the beginning of the unsorted part. The algorithm maintains two subarrays in a given array. The subarray which is already sorted and the remaining subarray which is unsorted. In every iteration of selection sort, the minimum element from the unsorted subarray is picked and moved to the sorted subarray. The time complexity of the selection sort is O(n^2) and the space complexity is O(1). Selection sort is a stable sorting algorithm.
\ No newline at end of file
diff --git a/docs/dsa/arrays/bucket-sort.md b/docs/dsa/arrays/bucket-sort.md
deleted file mode 100644
index 8067ac6d2..000000000
--- a/docs/dsa/arrays/bucket-sort.md
+++ /dev/null
@@ -1,204 +0,0 @@
----
-id: bucket-sort
-title: Bucket sort
-sidebar_label: Bucket sort
-tags:
- - DSA
- - Python
- - C++
- - Java
- - Sorting
-
-description: "Thsi page containes Bucket Sort, with codes in python, java and c++ "
----
-
-### Introduction to Bucket Sort
-
-Bucket sort is a comparison sorting algorithm that distributes elements into a number of "buckets." Each bucket is then sorted individually, either using another sorting algorithm or recursively applying the bucket sort. Finally, the sorted buckets are combined to form the final sorted array. Bucket sort is particularly useful for uniformly distributed data.
-
-### Steps of Bucket Sort
-
-1. **Create Buckets**: Initialize an empty array of buckets.
-2. **Distribute Elements**: Distribute the elements of the input array into the appropriate buckets.
-3. **Sort Buckets**: Sort each bucket individually.
-4. **Concatenate Buckets**: Concatenate all sorted buckets to form the final sorted array.
-
-### Pseudocode
-
-```text
-function bucketSort(array, bucketSize):
- if length(array) == 0:
- return array
-
- // Determine minimum and maximum values
- minValue = min(array)
- maxValue = max(array)
-
- // Initialize buckets
- bucketCount = floor((maxValue - minValue) / bucketSize) + 1
- buckets = array of empty lists of size bucketCount
-
- // Distribute input array values into buckets
- for i from 0 to length(array) - 1:
- bucketIndex = floor((array[i] - minValue) / bucketSize)
- append array[i] to buckets[bucketIndex]
-
- // Sort each bucket and concatenate them
- sortedArray = []
- for i from 0 to bucketCount - 1:
- sort(buckets[i]) // You can use any sorting algorithm
- append buckets[i] to sortedArray
-
- return sortedArray
-```
-
-### Implementation in Python, C++, and Java
-
-#### Python Implementation
-
-```python
-def bucket_sort(numbers, size=5):
- if len(numbers) == 0:
- return numbers
-
- # Determine minimum and maximum values
- min_value = min(numbers)
- max_value = max(numbers)
-
- # Initialize buckets
- bucket_count = (max_value - min_value) // size + 1
- buckets = [[] for _ in range(bucket_count)]
-
- # Distribute input array values into buckets
- for number in numbers:
- bucket_index = (number - min_value) // size
- buckets[bucket_index].append(number)
-
- # Sort each bucket and concatenate them
- sorted_numbers = []
- for bucket in buckets:
- sorted_numbers.extend(sorted(bucket))
-
- return sorted_numbers
-
-# Example usage
-data = [42, 32, 33, 52, 37, 47, 51]
-sorted_data = bucket_sort(data)
-print(sorted_data) # Output: [32, 33, 37, 42, 47, 51, 52]
-```
-
-#### C++ Implementation
-
-```cpp
-#include