Write programs for Bubble Sort, Quick sort

Answer Posted / srinivsa

void bubbleSort(int numbers[], int array_size)
{
int i, j, temp;

for (i = (array_size - 1); i >= 0; i--)
{
for (j = 1; j <= i; j++)
{
if (numbers[j-1] > numbers[j])
{
temp = numbers[j-1];
numbers[j-1] = numbers[j];
numbers[j] = temp;
}
}
}
}

Is This Answer Correct ?    57 Yes 17 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

Can we modify final arraylist?

515


Can arraylist be empty?

454


Which is the parent class of printerstatereasons class?

468


How many sorting are there in data structure?

487


Is arraylist a collection?

518






What is sorted map?

494


How remove all from arraylist?

483


What is sequential sorting?

513


Explain the principle of quicksort. What is its complexity?

583


What is example of data?

523


How to initialize Dictionary using collection initialize?

571


How do I start preparing for placement?

489


State the properties of b tree.

513


Why do we need linked list?

444


Explain extended binary tree.

504