Questions

Q:

Write a c program for merge sort.

Answer

#include
#define MAX 50

void mergeSort(int arr[],int low,int mid,int high);
void partition(int arr[],int low,int high);

int main(){
  
    int merge[MAX],i,n;

    printf("Enter the total number of elements: ");
    scanf("%d",&n);

    printf("Enter the elements which to be sort: ");
    for(i=0;i<n;i++){
         scanf("%d",&merge[i]);
    }

    partition(merge,0,n-1);

    printf("After merge sorting elements are: ");
    for(i=0;i<n;i++){
         printf("%d ",merge[i]);
    }

   return 0;
}

void partition(int arr[],int low,int high){

    int mid;

    if(low<high){
         mid=(low+high)/2;
         partition(arr,low,mid);
         partition(arr,mid+1,high);
         mergeSort(arr,low,mid,high);
    }
}

void mergeSort(int arr[],int low,int mid,int high){

    int i,m,k,l,temp[MAX];

    l=low;
    i=low;
    m=mid+1;

    while((l<=mid)&&(m<=high)){

         if(arr[l]<=arr[m]){
             temp[i]=arr[l];
             l++;
         }
         else{
             temp[i]=arr[m];
             m++;
         }
         i++;
    }

    if(l>mid){
         for(k=m;k<=high;k++){
             temp[i]=arr[k];
             i++;
         }
    }
    else{
         for(k=l;k<=mid;k++){
             temp[i]=arr[k];
             i++;
         }
    }
  
    for(k=low;k<=high;k++){
         arr[k]=temp[k];
    }
}


Sample output:

Enter the total number of elements: 5
Enter the elements which to be sort: 2 5 0 9 1
After merge sorting elements are: 0 1 2 5 9

Report Error

View answer Workspace Report Error Discuss

Subject: Programming

0 2513
Q:

Project Time Management - Processes

Describe the Inputs, Tools and Techniques, Outputs of Activity Duration Estimating ?

Answer

I. Inputs



  • Enterprise environmental factors

  • Organizational process assets

  • Project scope statement

  • Activity list

  • Activity attributes

  • Activity resource requirements

  • Resource calendars

  • Project management plan


               - Risk register


               - Activity cost estimates


II. Tools and Techniques



  • Expert judgment

  • Analogous  estimating

  • Parametric estimating

  • Three-point estimates 

  • Reserve analysis


III. Outputs



  • Activity duration estimates

  • Activity attributes (updates)

Report Error

View answer Workspace Report Error Discuss

0 2513
Q:

In the following question, a sentence has been given in Direct/Indirect speech. Out of the four alternatives suggested, select the one which best express the same sentence in Indirect/Direct speech.

Vicky said, "I clean my teeth daily."

A) Vicky said he cleans his teeth daily. B) Vicky says he cleans his teeth daily.
C) Vicky said that he cleaned his teeth daily. D) Vicky said that he used to clean his teeth daily.
 
Answer & Explanation Answer: C) Vicky said that he cleaned his teeth daily.

Explanation:
Report Error

View Answer Report Error Discuss

Filed Under: English
Exam Prep: Bank Exams

1 2513
Q:

Which country ropes in space technology to track border management?

A) Russia B) Japan
C) India D) China
 
Answer & Explanation Answer: C) India

Explanation:

India ropes in space technology to track border management.

Report Error

View Answer Report Error Discuss

Filed Under: General Awareness
Exam Prep: AIEEE , Bank Exams , CAT
Job Role: Analyst , Bank Clerk , Bank PO

0 2513
Q:

Hub works on which layer?

A) Network layer B) Physical layer
C) Data link layer D) All of the above
 
Answer & Explanation Answer: B) Physical layer

Explanation:

Hub works on layer 1 i.e, physical layer.

Report Error

View Answer Report Error Discuss

Filed Under: Computer
Exam Prep: AIEEE , Bank Exams , CAT
Job Role: Analyst , Bank Clerk , Bank PO

3 2513
Q:

Gases in the atmosphere and their percentages?

Answer

The air around us is a mixture of gases, mainly nitrogen and oxygen, but containing much smaller amounts of water and other gases.


Earth's atmosphere is composed of many gases. Their percentages by volume is given by::


 
78% Nitrogen,


21% Oxygen,


0.9% Argon, and


0.03% Carbon dioxide 


And very small percentages of other elements.


 

Report Error

View answer Workspace Report Error Discuss

Subject: General Science Exam Prep: AIEEE , Bank Exams , GATE
Job Role: Analyst , Bank Clerk , Bank PO

1 2512
Q:

ISRO got approval for SSLV. It's stands for

A) Small Satellite Launch Vehicle B) Small Scale Limited Vehicles
C) Secondary Scaling Ltd Vehicles D) None of the above
 
Answer & Explanation Answer: A) Small Satellite Launch Vehicle

Explanation:
Report Error

View Answer Report Error Discuss

Filed Under: General Awareness
Exam Prep: AIEEE , Bank Exams , CAT
Job Role: Analyst , Bank Clerk , Bank PO

0 2512
Q:

Separation of judiciary from executive is enjoined by

A) Preamble B) Judicial decision
C) Directive Principle D) Seventh schedule
 
Answer & Explanation Answer: C) Directive Principle

Explanation:
Report Error

View Answer Report Error Discuss

Filed Under: Indian Politics
Exam Prep: AIEEE , Bank Exams , CAT
Job Role: Analyst , Bank Clerk , Bank PO

0 2512