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
It is a naturally occurring sorting method exemplified through a card player arranging the cards dealt to him. He picks up the cards like they are dealt & added them into the neede

Define the term array. An array is a way to reference a series of memory locations using the same name. Each memory location is represented by an array element. An  array eleme

The time needed to delete a node x from a doubly linked list having n nodes is O (1)

Illustrate the intervals in mathematics Carrier set of a Range of T is the set of all sets of values v ∈ T such that for some start value s ∈ T and end value e ∈ T, either s ≤

Explain the Arrays in Ruby Ruby arrays are dynamic arrays which expand automatically whenever a value is stored in a location beyond current end of the array. To the programmer

Use a random number generator to create 10 numbers between 1 and 1000 and store them in 2 different arrays.  The first array should contain the numbers as they are generated.  The

Almost Complete Binary Tree :-A binary tree of depth d is an almost whole binary tree if: 1.Any node and at level less than d-1 has two children. 2. for any node and in the tree wi


Write a program for reversing the Linked list

Do you have a library solution for this problem?