Migrate C++ codes to new directory structure (#226)
* move cpp files for arrays * move cpp files for Graph algorithms * move cpp files for Linked-List algorithms * move cpp files for Multiplication algorithms * move cpp files for Queue algorithms * move cpp files for Searching algorithms * move cpp files for Sorting algorithms * move cpp files for Stack algorithms * move cpp files for String algorithms * move cpp files for Tree algorithms * Update index readme with C++ codes * cleanup non-standard cpp codes * rename algorithm/C++ to algorithm/CPlusPluspull/229/head
parent
e27ca2ba39
commit
a9745378c6
|
@ -0,0 +1,58 @@
|
|||
# C++
|
||||
|
||||
## Arrays
|
||||
1. [Count Inversions](Arrays/count_inversions.cpp)
|
||||
2. [Dutch Flag Algorithm](Arrays/dutch-flag-algo.cpp)
|
||||
3. [Left Rotation](Arrays/left-rotation.cpp)
|
||||
4. [Max Subarray Sum](Arrays/max-subarray-sum.cpp)
|
||||
5. [Shift Negatives](Arrays/shift-negatives.cpp)
|
||||
|
||||
## Graphs
|
||||
1. [Bellman Ford Algorithm](Graphs/bellmam-ford.cpp)
|
||||
2. [kruskal Algorithm](Graphs/kruskal-algorithm.cpp)
|
||||
|
||||
|
||||
## Multiplication
|
||||
1. [Karatsuba](Multiplication/karatsuba.cpp)
|
||||
|
||||
## Linked Lists
|
||||
1. [All possible insertions](Linked-Lists/all-possible-insertions.cpp)
|
||||
2. [Singly linked lists](Linked-Lists/singly.cpp)
|
||||
3. [doubley linked lists](Linked-Lists/doubly.cpp)
|
||||
4. [Circular linked lists](Linked-Lists/circular.cpp)
|
||||
5. [Reversing a linked lists](Linked-Lists/reverse.cpp)
|
||||
|
||||
## Searching
|
||||
1. [Linear Search](Searching/linear-search.cpp)
|
||||
2. [Jump Search](Searching/jump-search.cpp)
|
||||
3. [Binary Search](Searching/binary-search.cpp)
|
||||
4. [Finding squareroot using Binary search](Searching/sqrt-monotonic-binary-search.cpp)
|
||||
|
||||
## Stacks
|
||||
1. [Balancing Parenthesis](Stacks/balanced-parenthesis.cpp)
|
||||
|
||||
## Sorting
|
||||
1. [Bubble Sort](Sorting/bubble-sort.cpp)
|
||||
2. [Insertion Sort](Sorting/insertion-sort.cpp)
|
||||
3. [Quicksort](Sorting/quick-sort.cpp)
|
||||
4. [Selection Sort](Sorting/selection-sort.cpp)
|
||||
5. [3 way Quick Sort](Sorting/3way_quick_sort.cpp)
|
||||
6. [Bucket Sort](Sorting/bucket-sort.cpp)
|
||||
7. [Comb Sort](Sorting/comb-sort.cpp)
|
||||
8. [Counting Sort](Sorting/counting-sort.cpp)
|
||||
9. [heap Sort](Sorting/heap-sort.cpp)
|
||||
10. [Radix Sort](Sorting/radix-sort.cpp)
|
||||
11. [Shell Sort](Sorting/shell-sort.cpp)
|
||||
|
||||
## Strings
|
||||
1. [Rabin-Karp pattern search algo](Strings/rabin-karp.cpp)
|
||||
2. [All subsequence of a string (Recursion) ](Strings/sequence.cpp)
|
||||
3. [String reversal](Strings/string-reverse.cpp)
|
||||
4. [String tokanisation](Strings/string-tokeniser.cpp)
|
||||
|
||||
## Trees
|
||||
1. [Creating Binary Tree](Trees/build-binary-tree.cpp)
|
||||
2. [Counting and finding sum of all the nodes in BST](Trees/count-and-sum-of-nodes-in-binary-tree.cpp)
|
||||
3. [Level Order Traversal](Trees/level-order-traversal.cpp)
|
||||
4. [Depth first Traversal](Trees/pre-in-post-traversal.cpp)
|
||||
|
|
@ -1,22 +0,0 @@
|
|||
#include <iostream>
|
||||
using namespace std;
|
||||
|
||||
int main() {
|
||||
int numbers[5];
|
||||
|
||||
cout << "Enter 5 numbers: " << endl;
|
||||
|
||||
// store input from user to array
|
||||
for (int i = 0; i < 5; ++i) {
|
||||
cin >> numbers[i];
|
||||
}
|
||||
|
||||
cout << "The numbers are: ";
|
||||
|
||||
// print array elements
|
||||
for (int n = 0; n < 5; ++n) {
|
||||
cout << numbers[n] << " ";
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
|
@ -1,36 +0,0 @@
|
|||
#include<iostream.h>
|
||||
#include<conio.h>
|
||||
|
||||
void main()
|
||||
{
|
||||
int i,a[10],temp,j;
|
||||
clrscr();
|
||||
cout<<"Enter any 10 num in array: \n";
|
||||
for(i=0;i<=10;i++)
|
||||
{
|
||||
cin>>a[i];
|
||||
}
|
||||
cout<<"\nData before sorting: ";
|
||||
for(j=0;j<10;j++)
|
||||
{
|
||||
cout<<a[j];
|
||||
}
|
||||
for(i=0;i<=10;i++)
|
||||
{
|
||||
for(j=0;j<=10-i;j++)
|
||||
{
|
||||
if(a[j]>a[j+1])
|
||||
{
|
||||
temp=a[j];
|
||||
a[j]=a[j+1];
|
||||
a[j+1]=temp;
|
||||
}
|
||||
}
|
||||
}
|
||||
cout<<"\nData after sorting: ";
|
||||
for(j=0;j<10;j++)
|
||||
{
|
||||
cout<<a[j];
|
||||
}
|
||||
getch();
|
||||
}
|
|
@ -1,21 +0,0 @@
|
|||
#include <iostream>
|
||||
using namespace std;
|
||||
|
||||
int main() {
|
||||
int divisor, dividend,quotient,remainder;
|
||||
|
||||
cout << "Enter dividend:" ;
|
||||
cin >> dividend;
|
||||
|
||||
cout << "Enter divisor:";
|
||||
cin >> divisor;
|
||||
|
||||
quotient =dividend/divisor;
|
||||
remainder=dividend%divisor;
|
||||
|
||||
cout << "Quotien =" <<quotient << endl;
|
||||
cout << "remainder=" <<remainder ;
|
||||
|
||||
|
||||
return 0;
|
||||
}
|
|
@ -1,20 +0,0 @@
|
|||
#include <stdio.h>
|
||||
|
||||
int main() {
|
||||
int a,b,c;
|
||||
|
||||
/* Input 3 numbers from user*/
|
||||
printf("Enter three numbers: ");
|
||||
scanf("%d%d%d", &a ,&b ,&c);
|
||||
|
||||
if (a > b && a > c)
|
||||
printf("%d is the largest. ", a);
|
||||
else if (b > a && b > c)
|
||||
printf("%d is the largest. ", b);
|
||||
else if (c > a && c > b)
|
||||
printf("%d is the largest. ", c);
|
||||
else
|
||||
printf("Values are not unique");
|
||||
|
||||
return 0;
|
||||
}
|
|
@ -1,26 +0,0 @@
|
|||
#include <iostream>
|
||||
using namespace std;
|
||||
|
||||
// Variable declaration
|
||||
extern int a,b;
|
||||
extern int c;
|
||||
extern float f;
|
||||
|
||||
int main(){
|
||||
//Variable definition
|
||||
int a,b;
|
||||
int c;
|
||||
float f;
|
||||
|
||||
//actual initialization
|
||||
a=10;
|
||||
b=20;
|
||||
c= a + b;
|
||||
|
||||
cout << c << endl ;
|
||||
|
||||
f=70.0/3.0;
|
||||
cout << f << endl;
|
||||
|
||||
return 0;
|
||||
}
|
Loading…
Reference in New Issue