

 Thread Tools  Search this Thread 
#1
 
 
What is bubble sort in data structure Hello friends, I am aware of the process sorting and some of its type not all. I wanted to know the bubble sorting. I have no ideas about it. I also wanted the code for bubble sorting. I have tried it but I was unable to get the appropriate output. If anyone is having any clue or idea about this query then please let me know so that my concepts are cleared and I can get the appropriate output. 
#2
 
 
Re: What is bubble sort in data structure In this method 0th element is compared with the 1st element. If it is found to be greater than the 1st element then they are interchanged .Then the first element is compared with the 2nd element, if it is found to be greater, then they are interchanged. In this way all the elements are compared with the next element and interchanged if required. This is the first iteration and on completing this iteration the last element gets placed at the last position. 
#3
 
 
Re: What is bubble sort in data structure Similarly in the second iteration the comparisons are made till the last but one element and this time the second largest element gets placed at the second last position in the list. As a result after all the iteration the list becomes a sorted list. You must make sure that the list is sorted and compared properly after the iteration process is over. Many of them mistakes while comparing when iteration is done. 
#4
 
 
Re: What is bubble sort in data structure Code: Declare array AA store elements in to array AA Repeat for i= 0 to i<=3 // for passess Repeat for j=0 to j<=3i // for comparision check if AA[j] >AA[j+1] // for exchanging largest number int k = AA[j] AA[j]=AA[j+1] AA[j+1] =k increment j by 1 repeat step 6 to 9 End of loop increment i by 1 repeat step 5 to 11 end of loop 

Tags: array, array list, bubble sort, data structure, for loop 
Thread Tools  Search this Thread 

Similar Threads for: "What is bubble sort in data structure"  
Thread  Thread Starter  Forum  Replies  Last Post 
What is the use of insertion sort in data structure?  Venugopala  Software Development  3  04012011 02:41 AM 
What do you mean by Merge sort in data structure  fLUTE  Software Development  3  04012011 02:12 AM 
What is the difference between binary tree sort and heap sort in data structure  sRIPRIYA  Software Development  3  04012011 01:25 AM 
what is Quick Sort or partition Exchanger in data structure  Venugopala  Software Development  3  03012011 08:47 AM 
How to use Bubble sort in C# to sort parallel arraylists  Ground 0  Software Development  3  03082009 12:12 PM 