# What is the difference between bubble sort and pick pick?

The main difference between bubble sort and selection sort is that bubble sort operates by repeatedly changing adjacent elements if they are in the wrong order, while selection sorts an array by repeatedly finding the least element of the unsorted part and placing that at the beginning of the array.

Sorting is the method of arranging data in an organized order. Helps to find data elements quickly. Classification algorithms are useful in multiple fields such as machine learning and big data analytics to manipulate large data sets. There are various sorting algorithms. Bubble sort and selection sort are two of them.

### Key Areas Covered

1. What is Bubble Sort
– Definition, Functionality
2. What is selection selection?
– Definition, Functionality
3. What is the difference between Bubble Sort and Pick Pick
– Key Differences Comparison

### Key terms

Algorithm, Big Data, Bubble Sort, Machine Learning, Pick Selection

## What is Bubble Sort

Bubble sort is a sorting algorithm, which sorts elements in increasing order. Repeatedly compare adjacent items. And, if the element on the left is larger than the element on the right, the elements are swapped.

An example is the following.

5 8 1 6 9 2

Consider 5 and 8. It is not necessary to interchange the two numbers as 5 1; instead, we exchanged two items. Now the list is as follows.

5 1 8 6 9 2

Now consider 8 and 6. Since 8 > 6, we swap those two numbers. The list is as follows.

5 1 6 8 9 2

Now consider 8 and 9. We should not swap the numbers as 8 < 9. Then consider 9 and 2. We should swap the two values ​​as 9 > 2. After completing the first iteration, the list appears below.

5 1 6 8 2 9

The largest item is in the rightmost position. Now, we just have to consider 5 1 6 9 2. We can compare 5 and 1. Since 5 > 1, we swap the values. Then, as before, we can follow the same procedure. The list after completing the iteration is as follows.

1 5 6 2 8 9

Now 8 and 9 are the largest items in the list, but they’re already sorted. Now we need to consider 1 5 6 2. This process continues and finally we can get an ordered list.

## What is selection selection?

Selection sort is a sorting algorithm that sorts items in increasing order. After finding the smallest element in the unsorted part of the array, it swaps that element with the first position in the list.

An example is the following.

7 8 5 4 9 2

We take the minimum value to be 7. We check the value 8. It is not less than 7. So, we check 5. It is less than 7. Now, the minimum value is 5. Now, consider 4. It is less than the minimum value (5) . So now the minimum value is 4. Next, we consider the number 9. It is not less than the current minimum value (4). So we move on to the next element, which is 2. It is less than the current minimum value (4). Now the minimum value is 2. We can swap 7 and 2. Now the list is as follows.

2 8 5 4 9 7

Now, 2 is already sorted, and it’s the smallest number in the list. The rest is the unranked list. Now we must classify 8 5 4 9 7. We consider 8 as the minimum value. The value 5 is less than the minimum value (8). So now the minimum value is 5. So the value 4 is less than the minimum value. Now the minimum value is 4. So 9 is not less than the minimum value 4. Therefore, we consider the next element 7. It is not less than the minimum value 4. Now the minimum is 4. Therefore, we exchange the value 4 and the value 8 (1 S t element in the list). Now the list is as follows.

2 4 5 8 9 7

Now 2 and 4 are ordered. We can sort 5 8 9 7. We take 5 as the minimum value and repeat the above process and get a sorted list at the end.

## Difference Between Bubble Sort and Selection Sort

### Definition

Bubble sort is a simple sort algorithm that continuously loops through the list and compares adjacent pairs to sort the items. In contrast, pick by pick is a sort algorithm that takes the smallest value (considering ascending order) in the list and moves it to the appropriate position in the array. So, this is the main difference between bubble sort and selection sort.

### functionality

Bubble sort compares adjacent elements and swaps accordingly, while selection sort selects the smallest element from the unsorted sub-array and places it at the next position in the sorted sub-array.

### Efficiency

Also, another difference between bubble sort and pick sort is that pick sort is efficient as compared to bubble sort.

### Speed

Also, speed is another difference between bubble type and pick type. Pick sorting is faster compared to bubble sorting.

### Method

Also, another difference between bubble sort and selection sort is that bubble sort uses item swapping while selection sort uses item selection.

### conclusion

In short, the main difference between bubble sort and selection sort is that bubble sort operates by repeatedly swapping adjacent items if they are in the wrong order. In contrast, selection sort sorts an array by repeatedly finding the least element of the unsorted part and placing that at the beginning of the array.

##### Reference:

1. “Bubble sort.” GeeksforGeeks, August 30, 2018, Available here.
2. “Selection by selection.” GeeksforGeeks, September 4, 2018, Available here.

##### Courtesy image:

1. “Bubble-sort-example-300px” By Swfung8 – Own work (CC BY-SA 3.0) via Commons Wikimedia
2. “Selection-Sort-Animation” By Joestape89 (CC BY-SA 3.0) via Commons Wikipedia