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 2497
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 2496
Q:

Which of the following countries is associated with 'Glorious Revolution'?

A) France B) Russia
C) USA D) England
 
Answer & Explanation Answer: D) England

Explanation:

After the deaths of  Cromwell monarchy was restored and Charles II was made king of England. He and his successor, James II tried to assert the superiority of the monarchy. But feelings against this kind of rule had grown too strong. In 1688, a group of politicians invited William of Orange, the husband of James II's daughter, Mary, and rulers of Holland, to become king. Without firing a shot, William reached London and James II fled to France. The throne was granted to William and Mary Jointly. This event is known as the 'Glorious Revolution' . This revolution marked the triumph of parliament over the monarchy.

Report Error

View Answer Report Error Discuss

Filed Under: World History

1 2496
Q:

Tides in the sea are caused by 

A) Effect of Sun B) Effect of Moon
C) Combined effect of Moon and Sun D) Gravitational Force of Earth and Sun
 
Answer & Explanation Answer: C) Combined effect of Moon and Sun

Explanation:
Report Error

View Answer Report Error Discuss

Filed Under: World Geography

0 2496
Q:

Which of the following equals one atomic mass unit?

A) one-twelfth the mass of one carbon-12 atom B) the mass of one electron
C) one-sixth the mass of one helium-4 atom D) the mass of one carbon-12 atom
 
Answer & Explanation Answer: A) one-twelfth the mass of one carbon-12 atom

Explanation:

One atomic mass unit (AMU) is equal to the one-twelfth the mass of one carbon-12 atom.

Report Error

View Answer Report Error Discuss

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

1 2496
Q:

Which is not a benefit of burning garbage for fuel?

A) It creates more space for farming B) It produces methane that can be used like natural gas
C) It partially addresses the solid waste disposal problem D) It provides biomass energy
 
Answer & Explanation Answer: A) It creates more space for farming

Explanation:

Garbage burning is common in rural areas, but it poses health concerns and hazards to the environment. It especially affects people with sensitive respiratory systems, as well as children and the elderly.

 

Benefits ::

  • It produces methane that can be used like natural gas.
  • It partially addresses the solid waste disposal problem.
  • It provides biomass energy.

 

Hence, it creates more space for farming is not the benefit of the burning garbage.

Report Error

View Answer Report Error Discuss

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

2 2496
Q:

What is the Budgetary allocation to the Pradhan Mantri Gram Sadak Yojana in 2019?

A) Rs 25,000 Crores B) Rs 19,000 Crores
C) Rs 15, 000 Crores D) Rs 28, 000 Crores
 
Answer & Explanation Answer: B) Rs 19,000 Crores

Explanation:

In 2019, the Budgetary allocation to the Pradhan Mantri Gram Sadak Yojana was Rs 19,000 Crores.

Report Error

View Answer Report Error Discuss

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

4 2496
Q:

In the following question, out of the given four alternatives, select the one which is opposite in meaning of the given word.

Vagrant

A) Idle B) Roving
C) Settled D) Wanderer
 
Answer & Explanation Answer: C) Settled

Explanation:
Report Error

View Answer Report Error Discuss

Filed Under: English
Exam Prep: Bank Exams

0 2495