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
How to find 3rd element from end in a linked list in one pass?
Traverse the given tree using Inorder, Preorder and Postorder traversals. Inorder : D H B E A F C I G J Preorder: A B D H E C F G I J Postorder: H D E B F I J G C A
Why would we use dynamically allocated arrays vs vectors?
Define heap order property?
Why do we need sorting?
What do you mean by structure property in a heap?
Is arraylist a collection?
In what order the elements of a hashset are retrieved?
What are the pre-requisite for the collection to perform binary search?
What is a vector element?
What is array traversing?
What is difference between list and linked list?
What do you mean by primary clustering?
how to display Singly Linked List from First to Last?
How does a selection sort work for an array?