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 2407
Q:

National Human Rights Commission was formed in the year ?

A) 1992 B) 1993
C) 1994 D) 1991
 
Answer & Explanation Answer: B) 1993

Explanation:

National Human Rights Commission was formed on 12th October 1993.

Report Error

View Answer Report Error Discuss

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

1 2407
Q:

Which invention allowed computers to be smaller?

A) Integrated Circuits B) RAM
C) Vacuum Tubes D) CPU
 
Answer & Explanation Answer: A) Integrated Circuits

Explanation:

IC's (Integrated Circuits) also called as Chips or Microchips whose invention allowed computers to be smaller and smaller.

Report Error

View Answer Report Error Discuss

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

2 2407
Q:

An enumerated power the president has is

A) Nominate officials B) Appoint judges
C) Nominating high offocials D) All of the above
 
Answer & Explanation Answer: D) All of the above

Explanation:

Enumerate specific powers granted to the president, which include the authority to appoint judges, ambassadors, and other high-ranking government officials.

Report Error

View Answer Report Error Discuss

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

1 2406
Q:

In India, some of the Fundamental Rights can be suspended during of

A) Festivals B) Elections
C) Wars D) Floods
 
Answer & Explanation Answer: C) Wars

Explanation:

During any emergency of wars, some of the Fundamental Rights can be suspended that is what mentioned in constitution of India.

Report Error

View Answer Report Error Discuss

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

7 2406
Q:

Condition of decreased oxygen in the blood

A) Hematemesis B) Hypercapnia
C) Hemoptysis D) Hypoxemia
 
Answer & Explanation Answer: D) Hypoxemia

Explanation:

Oxygen deficiency or decreased oxygen levels in the blood is a condition known as Hypoxemia.

 

Hypercapnia means High carbon dioxide levels in the blood.

Report Error

View Answer Report Error Discuss

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

1 2405
Q:

A rotating column of air is called

A) Tornado B) Vortex
C) Airmass D) None of the above
 
Answer & Explanation Answer: A) Tornado

Explanation:

A rotating column of air is called as a Tornado which extends from the thunderstorm to the ground.

Report Error

View Answer Report Error Discuss

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

2 2405
Q:

What is Bull Market?

Answer

Bull market is that market where stock value are expected rise and people will have tendency to sell their stock so as to earn profit out of it. Thus sudden push from the suppliers will gradually niutalise the market.


 

Report Error

View answer Workspace Report Error Discuss

Subject: Finance

0 2405