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

Define distributed query and linked server?

561


Is arraylist better than array?

473


What is static array?

465


What is binary tree in discrete mathematics?

484


Define hashing?

581






Differentiate between singly and doubly linked lists?

511


Does arraylist have a tostring?

499


What is bubble sort used for?

460


What is Jagged Arrays?

553


Can map contain duplicate keys?

466


What is the best data structure and algorithm to implement cache?

525


Does hashmap allow null keys?

472


What are the advantages of linked list over an array?

551


What are the disadvantages of sequential storage?

732


What is difference between stack and queue?

494