Data structure - What is Bubble Sort and Quick sort?

What is Bubble Sort and Quick sort?

Bubble Sort: - The simplest sorting algorithm. It takes two array elements at a time, compares them and swaps their positions if element on left is greater than right. Divides the array elements in two halves or partitions. On dividing, the quick sort procedure is recursively called to sort the two halves. A “pivot” is used as the center point and elements less than the pivot are moved to the left or before the pivot and elements greater than pivot are moved to the right.

What is Bubble Sort and Quick sort?

Bubble Sort: The simplest sorting algorithm. It involves the sorting the list in a repetitive fashion. It compares two adjacent elements in the list, and swaps them if they are not in the designated order. It continues until there are no swaps needed. This is the signal for the list that is sorted. It is also called as comparison sort as it uses comparisons.

Quick Sort: The best sorting algorithm which implements the ‘divide and conquer’ concept. It first divides the list into two parts by picking an element a ’pivot’. It then arranges the elements those are smaller than pivot into one sub list and the elements those are greater than pivot into one sub list by keeping the pivot in its original place.
Data structure - What is the difference between a stack and a Queue?
Stack and a Queue - Stack – Represents the collection of elements in Last In First Out order.......
Data structure - Can a stack be described as a pointer? Explain
Stack as a pointer - A stack is represented as a pointer. The reason is that, it has a head pointer which points to the top of the stack........
Data structure - What is the recursion?
Recursion - Recursion is an approach in which a function calls itself with an argument......
Post your comment
Discussion Board
This is worng
It lists the attributes of insert sort undeer the first listing of bubble sort.
MH 06-20-2014