Skip to Main Content
Data Structures Using C, 2nd Edition by Pearson
book

Data Structures Using C, 2nd Edition by Pearson

by A. K. Sharma
May 2024
Intermediate to advanced content levelIntermediate to advanced
521 pages
14h 12m
English
Pearson India
Content preview from Data Structures Using C, 2nd Edition by Pearson
114 Data Structures Using C
loop and inner For loop. The inner For loop makes a pass on the list. If during the pass, any exchange(s)
is made then it is recorded in a variable called flag, i.e., flag is set to false. The outer while loop keeps
track of the flag. As soon as the flag informs that no exchange(s) took place during the current pass
indicating that the list is now sorted, the algorithm stops.
Fig. 3.14 Second pass of the bubble sort
8 9 10 11 19 12 13 20
8 9 10 11 12 19 13 20
8 9 10 11 12 13 19 20
Fig. 3.13 First pass of bubble sort on a list of numbers
8 20 9 10 11 19 12 13
8 9 20 10 11 19 12 13
8 9 10 20 11 19 12 13
8 9 10 11 20
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Start your free trial

You might also like

Data Structures Using C

Data Structures Using C

Samir Kumar Bandyopadhyay, Kashi Nath Dey
Intermediate C Programming, 2nd Edition

Intermediate C Programming, 2nd Edition

Yung-Hsiang Lu, George K. Thiruvathukal

Publisher Resources

ISBN: 9781299831582