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
Q. Draw a B-tree of order 3 for the sequence of keys written below: 2, 4, 9, 8, 7, 6, 3, 1, 5, 10

HSV Colour Model Instead of a set of colour primaries, the HSV model uses colour descriptions that have a more intuitive appeal to a user. To give a colour specification, a use

Best - Fit Method: - This method obtains the smallest free block whose  size is greater than or equal to get such a block by traversing the whole free list follows.

Normally a potential y satisfies y r = 0 and 0 ³ y w - c vw -y v . Given an integer K³0, define a K-potential to be an array y that satisfies yr = 0 and K ³ y w - c vw -y v

Implementing abstract data types A course in data structures and algorithms is hence a course in implementing abstract data types. It may seem that we are paying a lot of atten

This algorithm inputs number of hours of sunshine recorded every day for a week (7 days). Output is the highest value for hours of sunshine and average (mean) value for numbers of

Problem 1. You are asked to store Names of all 100 students of class A in your Learning Centre. Which data type will you use? What is its syntax? Explaining the data typ

Create a Money data structure that is made up of amount and currency. (a) Write a constructor for this data structure (b) Create accessors for this data structure (c) Writ

Link list representation of a circular queue is more efficient as it employs space more competently, of course with the added cost of storing the pointers. Program 7 gives the link

By taking an appropriate example explain how a general tree can be represented as a Binary Tree.                                                                    C onversio