Questions

Q:

Write a c program for quick sort.

Answer

#include<stdio.h>

void quicksort(int [10],int,int);

int main(){
  int x[20],size,i;

  printf("Enter size of the array: ");
  scanf("%d",&size);

  printf("Enter %d elements: ",size);
  for(i=0;i<size;i++)
    scanf("%d",&x[i]);

  quicksort(x,0,size-1);

  printf("Sorted elements: ");
  for(i=0;i<size;i++)
    printf(" %d",x[i]);

  return 0;
}

void quicksort(int x[10],int first,int last){
    int pivot,j,temp,i;

     if(first<last){
         pivot=first;
         i=first;
         j=last;

         while(i<j){
             while(x[i]<=x[pivot]&&i<last)
                 i++;
             while(x[j]>x[pivot])
                 j--;
             if(i<j){
                 temp=x[i];
                  x[i]=x[j];
                  x[j]=temp;
             }
         }

         temp=x[pivot];
         x[pivot]=x[j];
         x[j]=temp;
         quicksort(x,first,j-1);
         quicksort(x,j+1,last);

    }
}

Output:
Enter size of the array: 5
Enter 5 elements: 3 8 0 1 2
Sorted elements: 0 1 2 3 8

Report Error

View answer Workspace Report Error Discuss

Subject: Programming

0 2760
Q:

Who is the new president and CEO of Nokia?

Answer

Rajeev Suri

Report Error

View answer Workspace Report Error Discuss

2 2759
Q:

What is the relationship between Resistivity and Conductivity?

Answer

Resistivity :


Resistivity is a measure of the resistance to the flow of electrons. 


Conductivity :


Conductivity is just the inverse of resistivity, σ = 1/ρ, where σ is conductivity and ρ is resistivity.


 


Example:


Think of a pipe and water, the bigger the pipe, the easier water can flow and thus the lower the resistance. 

Report Error

View answer Workspace Report Error Discuss

Subject: Physics Exam Prep: AIEEE , Bank Exams , CAT , GATE
Job Role: Analyst , Bank Clerk , Bank PO , IT Trainer

3 2759
Q:

The commercial and marketing arm of ISRO is

A) Antrix Corporation Limited B) ISRO Satelliet Corporation
C) Space Applications Center D) None
 
Answer & Explanation Answer: A) Antrix Corporation Limited

Explanation:
Report Error

View Answer Report Error Discuss

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

8 2759
Q:

Which of the following is the lightest computer?

A) Desktop B) Tablet
C) Laptop D) Ultrabook
 
Answer & Explanation Answer: B) Tablet

Explanation:

The lightest computer is the tablet.

Report Error

View Answer Report Error Discuss

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

3 2759
Q:

Which of the following Articles of Indian Constitution guarantees freedom to press?

A) Article 16 B) Article 19
C) Article 22 D) Article 31
 
Answer & Explanation Answer: B) Article 19

Explanation:
Report Error

View Answer Report Error Discuss

Filed Under: Indian Politics

1 2759
Q:

What are the Various Register in 8085?

Answer

Accumulator register, Temporary register, Instruction register, Stack Pointer, Program Counter are the various registers in 8085

Report Error

View answer Workspace Report Error Discuss

Subject: Hardware

0 2758
Q:

Standing on your toes as in ballet, is an example of

A) plantar extension B) plantar flexion
C) adduction D) dorsiflexion
 
Answer & Explanation Answer: B) plantar flexion

Explanation:
Report Error

View Answer Report Error Discuss

Filed Under: English
Exam Prep: AIEEE , Bank Exams , CAT , GRE , TOEFL
Job Role: Analyst , Bank Clerk , Bank PO , IT Trainer

1 2758