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
1. For the ER diagram you created in assignment, the artefact of the conceptual database design, map the ER model into the relational model according to how it was designed in the

Explain the Interfaces in Ruby Recall that in object-oriented programming, an interface is a collection of abstract operations that cannot be instantiated. Even though Ruby i

When writing a code for a program that basically answers Relative Velocity questions how do you go at it? How many conditions should you go through?

#What is the pointer

Instructions : You have to design a doubly linked list container. The necessary classes and their declarations are given below The main() function for testing the yo

draw a flowchart which prints all the even numbers between 1-50

/* The program accepts matrix like input & prints the 3-tuple representation of it*/ #include void main() { int a[5][5],rows,columns,i,j; printf("enter the order of

Q. Explain the basic concept of the primitive data structures.                                             Ans. The concept of P r i m i t i ve Data

Example: Insertion of a key 33 into a B-Tree (w/split) Step 1: Search first node for key closet to 33. Key 30 was determined. Step 2: Node pointed through key 30, is se

Q.1 What is an algorithm? What are the characteristics of a good algorithm? Q.2 How do you find the complexity of an algorithm? What is the relation between the time and space c