Skip to content

Patch 2 #521

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 3 commits into
base: dev
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
48 changes: 48 additions & 0 deletions Quick Sort
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
#include<stdio.h>
void quicksort(int number[25],int first,int last){
int i, j, pivot, temp;

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

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

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

}
}

int main(){
int i, count, number[25];

printf("How many elements are u going to enter?: ");
scanf("%d",&count);

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

quicksort(number,0,count-1);

printf("Order of Sorted elements: ");
for(i=0;i<count;i++)
printf(" %d",number[i]);

return 0;
}
31 changes: 31 additions & 0 deletions c++ fibonachchi
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
#include <iostream>  

using namespace std;  

int main() {  

  int n1=0,n2=1,n3,i,number;    

 cout<<"Enter the number of elements: ";    

 cin>>number;    

 cout<<n1<<" "<<n2<<" "; //printing 0 and 1    

 for(i=2;i<number;++i) //loop starts from 2 because 0 and 1 are already printed    

 {    

  n3=n1+n2;    

  cout<<n3<<" ";    

  n1=n2;    

  n2=n3;    

 }    

   return 0;  

   }