Various passes of bubble sort, Data Structure & Algorithms

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

Posted Date: 7/11/2012 1:30:08 AM | Location : United States







Related Discussions:- Various passes of bubble sort, Assignment Help, Ask Question on Various passes of bubble sort, Get Answer, Expert's Help, Various passes of bubble sort Discussions

Write discussion on Various passes of bubble sort
Your posts are moderated
Related Questions
In order to get the contents of a Binary search tree in ascending order, one has to traverse it in In-order


Example 1:  Following are Simple sequence of statements Statement 1;  Statement 2; ... ... Statement k; The entire time can be found out through adding the times for

Construct G for α, n, and W given as command line parameters. Throw away edges that have an asymmetric relation between nodes. That is, if A is connected to B, but B is not connect

Q. Suggest a method of implementing two stacks in one array such that as long as space is there in an array, you should be capable to add an element in either stack. Using proposed

Declaring a two dimensional array   A two dimensional array is declared same to the way we declare a one-dimensional array except that we state the number of elements in both di


What is binary search?   Binary search is most useful when list is sorted. In binary search, element present in middle of the list is determined. If key (the number to search)

Speed cameras read the time a vehicle passes a point (A) on road and then reads time it passes a second point (B) on the same road (points A and B are 100 metres apart). Speed of t

implement multiple stacks ina single dimensional array. write algorithams for various stack operation for them.