0% found this document useful (0 votes)
21 views9 pages

Sorting Algorithm Lect4

Sorting

Uploaded by

ahmadsahak688
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
21 views9 pages

Sorting Algorithm Lect4

Sorting

Uploaded by

ahmadsahak688
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 9

Data structure

Elham Rezaie
CONTENTS
1 Sorting algorithm

2 implementation
What is Bubble Sort in C++?
• Bubble Sort in C++, is one of the popular sorting techniques, that we
use in data structures. The logical arranging of data is known as
sorting. Using the algorithm of bubble sort we can sort any linear
data structure
• The logical sorting order can be ascending or descending.
• This is a simple sorting algorithm but it is not the best.
Steps to implement bubble sort
1. Linearly Traverse array from left
2. If the rst item is greater than the 2nd item in the array, swap them.
• That is, arr[i] > arr[i+1], then swap
3. Now, compare the next two elements.
4. We will repeat all the previous steps until the given array is sorted.
Thanks
Study hard and Make
progress every day

Elham Rezaie

You might also like