Which of the following sorts is quickest when sorting the
following set: 1 2 3 5 4
1) Quick Sort
2) Bubble Sort
3) Merge Sort
Answer Posted / k.kavitha
1) Quick sort
| Is This Answer Correct ? | 25 Yes | 2 No |
Post New Answer View All Answers
How are portions of a program disabled in demo versions?
How can I use a preprocessorif expression to ?
Why is main function so important?
Explain what is the difference between a free-standing and a hosted environment?
There seem to be a few missing operators ..
What is the time and space complexities of merge sort and when is it preferred over quick sort?
What is the difference between union and structure in c?
What is difference between far and near pointers?
What's a good way to check for "close enough" floating-point equality?
Find the second largest element in an array with minimum no of comparisons and give the minimum no of comparisons needed on an array of size N to do the same.
What is int main () in c?
What is malloc return c?
Explain enumerated types.
Explain what is meant by 'bit masking'?
You have given 2 array. You need to find whether they will
create the same BST or not.
For example:
Array1:10 5 20 15 30
Array2:10 20 15 30 5
Result: True
Array1:10 5 20 15 30
Array2:10 15 20 30 5
Result: False
One Approach is Pretty Clear by creating BST O(nlogn) then
checking two tree for identical O(N) overall O(nlogn) ..we
need there exist O(N) Time & O(1) Space also without extra
space .Algorithm ??
DevoCoder
guest
Posted 3 months ago #
#define true 1
#define false 0
int check(int a1[],int a2[],int n1,int n2)
{
int i;
//n1 size of array a1[] and n2 size of a2[]
if(n1!=n2) return false;
//n1 and n2 must be same
for(i=0;i