Various passes of bubble sort, Data Structure & Algorithms

Assignment Help:

Q. Show the various passes of bubble sort on the unsorted given list 11, 15, 2, 13, 6          

Ans:

The given data is as follows:-

Pass 1:-    

11   15   2     13   6

11   15   2     13   6

11   2     15   13   6

11   2     13   15   6

11   2     13   6     [15]

Pass 2:-           

11   2   13   6       15

2     11   13   6     15

2     11   13   6     15

2     11   6     [13 15]

Pass 3:- 

2     11   6   13   15

2     11   6     13   15

2     6     [11 13   15]

Pass 4:- 

2     6     11   13   15

2     [6    11   13   15]

Therefore, the sorted array becomes:-

2     6     11   13   15


Related Discussions:- Various passes of bubble sort

Sequential files, Data records are stored in some particular sequence e.g.,...

Data records are stored in some particular sequence e.g., order of arrival value of key field etc. Records of sequential file cannot be randomly accessed i.e., to access the n th

Explain insertion procedure into a b-tree, Ans: I nsertion into the B...

Ans: I nsertion into the B-tree: 1.  First search is made for the place where the new record must be positioned. As soon as the keys are inserted, they are sorted into th

Functions for inserting and deleting at either of the end, Q. Develop a rep...

Q. Develop a representation for a list where insertions and deletions can be done at either end. Such a structure is known as a Deque (Double ended queue). Write functions for inse

Determine yiq colour model, Determine YIQ Colour Model Whereas an RGB m...

Determine YIQ Colour Model Whereas an RGB monitor requires separate signals for the red, green, and blue components of an image, a television monitor uses a single composite si

Sparse matrix, what are the disadvantages of sparse matrix?

what are the disadvantages of sparse matrix?

Complexity, Complexity : How do the resource needs of a program or algorith...

Complexity : How do the resource needs of a program or algorithm scale (the growth of resource requirements as a function of input). In other words, what happens with the performan

Hw7, Handout 15 COMP 264: Introduction to Computer Systems (Section 001) Sp...

Handout 15 COMP 264: Introduction to Computer Systems (Section 001) Spring 2013 R. I. Greenberg Computer Science Department Loyola University Water TowerCampus, Lewis Towers 524 82

Stack, Explain in detail the algorithmic implementation of multiple stacks....

Explain in detail the algorithmic implementation of multiple stacks.

Program to implementing stack using linked lists, include include i...

include include include /* Definition of structure node */ typedef struct node { int data; struct node *next; } ; /* Definition of push function */

Recursion, differences between direct and indirect recursion

differences between direct and indirect recursion

Write Your Message!

Captcha
Free Assignment Quote

Assured A++ Grade

Get guaranteed satisfaction & time on delivery in every assignment order you paid with us! We ensure premium quality solution document along with free turntin report!

All rights reserved! Copyrights ©2019-2020 ExpertsMind IT Educational Pvt Ltd