diff --git a/arrays/c-or-cpp/count-inversions.cpp b/algorithms/CPlusPlus/Arrays/count-inversions.cpp similarity index 100% rename from arrays/c-or-cpp/count-inversions.cpp rename to algorithms/CPlusPlus/Arrays/count-inversions.cpp diff --git a/arrays/c-or-cpp/dutch-flag-algo.cpp b/algorithms/CPlusPlus/Arrays/dutch-flag-algo.cpp similarity index 100% rename from arrays/c-or-cpp/dutch-flag-algo.cpp rename to algorithms/CPlusPlus/Arrays/dutch-flag-algo.cpp diff --git a/arrays/c-or-cpp/left-rotation.cpp b/algorithms/CPlusPlus/Arrays/left-rotation.cpp similarity index 100% rename from arrays/c-or-cpp/left-rotation.cpp rename to algorithms/CPlusPlus/Arrays/left-rotation.cpp diff --git a/arrays/c-or-cpp/max-subarray-sum.cpp b/algorithms/CPlusPlus/Arrays/max-subarray-sum.cpp similarity index 100% rename from arrays/c-or-cpp/max-subarray-sum.cpp rename to algorithms/CPlusPlus/Arrays/max-subarray-sum.cpp diff --git a/arrays/c-or-cpp/shift-negatives.cpp b/algorithms/CPlusPlus/Arrays/shift-negatives.cpp similarity index 100% rename from arrays/c-or-cpp/shift-negatives.cpp rename to algorithms/CPlusPlus/Arrays/shift-negatives.cpp diff --git a/graphs/c-or-cpp/bellman-ford.cpp b/algorithms/CPlusPlus/Graphs/bellman-ford.cpp similarity index 100% rename from graphs/c-or-cpp/bellman-ford.cpp rename to algorithms/CPlusPlus/Graphs/bellman-ford.cpp diff --git a/graphs/c-or-cpp/kruskal-algorithm.cpp b/algorithms/CPlusPlus/Graphs/kruskal-algorithm.cpp similarity index 100% rename from graphs/c-or-cpp/kruskal-algorithm.cpp rename to algorithms/CPlusPlus/Graphs/kruskal-algorithm.cpp diff --git a/linked-lists/c-or-cpp/all-possible-insertion.cpp b/algorithms/CPlusPlus/Linked-Lists/all-possible-insertion.cpp similarity index 100% rename from linked-lists/c-or-cpp/all-possible-insertion.cpp rename to algorithms/CPlusPlus/Linked-Lists/all-possible-insertion.cpp diff --git a/linked-lists/c-or-cpp/circular.cpp b/algorithms/CPlusPlus/Linked-Lists/circular.cpp similarity index 100% rename from linked-lists/c-or-cpp/circular.cpp rename to algorithms/CPlusPlus/Linked-Lists/circular.cpp diff --git a/linked-lists/c-or-cpp/doubly.cpp b/algorithms/CPlusPlus/Linked-Lists/doubly.cpp similarity index 100% rename from linked-lists/c-or-cpp/doubly.cpp rename to algorithms/CPlusPlus/Linked-Lists/doubly.cpp diff --git a/linked-lists/c-or-cpp/merge.cpp b/algorithms/CPlusPlus/Linked-Lists/merge.cpp similarity index 100% rename from linked-lists/c-or-cpp/merge.cpp rename to algorithms/CPlusPlus/Linked-Lists/merge.cpp diff --git a/linked-lists/c-or-cpp/reverse.cpp b/algorithms/CPlusPlus/Linked-Lists/reverse.cpp similarity index 100% rename from linked-lists/c-or-cpp/reverse.cpp rename to algorithms/CPlusPlus/Linked-Lists/reverse.cpp diff --git a/linked-lists/c-or-cpp/singly.cpp b/algorithms/CPlusPlus/Linked-Lists/singly.cpp similarity index 100% rename from linked-lists/c-or-cpp/singly.cpp rename to algorithms/CPlusPlus/Linked-Lists/singly.cpp diff --git a/multiplication/c-or-cpp/karatsuba.cpp b/algorithms/CPlusPlus/Multiplication/karatsuba.cpp similarity index 100% rename from multiplication/c-or-cpp/karatsuba.cpp rename to algorithms/CPlusPlus/Multiplication/karatsuba.cpp diff --git a/queues/c-or-cpp/circular-queue-linked-list.cpp b/algorithms/CPlusPlus/Queues/circular-queue-linked-list.cpp similarity index 100% rename from queues/c-or-cpp/circular-queue-linked-list.cpp rename to algorithms/CPlusPlus/Queues/circular-queue-linked-list.cpp diff --git a/queues/c-or-cpp/queue-linked-list.cpp b/algorithms/CPlusPlus/Queues/queue-linked-list.cpp similarity index 100% rename from queues/c-or-cpp/queue-linked-list.cpp rename to algorithms/CPlusPlus/Queues/queue-linked-list.cpp diff --git a/algorithms/CPlusPlus/README.md b/algorithms/CPlusPlus/README.md new file mode 100644 index 00000000..3370934a --- /dev/null +++ b/algorithms/CPlusPlus/README.md @@ -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) + diff --git a/searching/c-or-cpp/binary-search.cpp b/algorithms/CPlusPlus/Searching/binary-search.cpp similarity index 100% rename from searching/c-or-cpp/binary-search.cpp rename to algorithms/CPlusPlus/Searching/binary-search.cpp diff --git a/searching/c-or-cpp/interpolation-search.cpp b/algorithms/CPlusPlus/Searching/interpolation-search.cpp similarity index 100% rename from searching/c-or-cpp/interpolation-search.cpp rename to algorithms/CPlusPlus/Searching/interpolation-search.cpp diff --git a/searching/c-or-cpp/jump-search.cpp b/algorithms/CPlusPlus/Searching/jump-search.cpp similarity index 100% rename from searching/c-or-cpp/jump-search.cpp rename to algorithms/CPlusPlus/Searching/jump-search.cpp diff --git a/searching/c-or-cpp/linear-search.cpp b/algorithms/CPlusPlus/Searching/linear-search.cpp similarity index 100% rename from searching/c-or-cpp/linear-search.cpp rename to algorithms/CPlusPlus/Searching/linear-search.cpp diff --git a/searching/c-or-cpp/sqrt-monotonic-binary-search.cpp b/algorithms/CPlusPlus/Searching/sqrt-monotonic-binary-search.cpp similarity index 100% rename from searching/c-or-cpp/sqrt-monotonic-binary-search.cpp rename to algorithms/CPlusPlus/Searching/sqrt-monotonic-binary-search.cpp diff --git a/sorting/c-or-cpp/3way_quick_sort.cpp b/algorithms/CPlusPlus/Sorting/3way_quick_sort.cpp similarity index 100% rename from sorting/c-or-cpp/3way_quick_sort.cpp rename to algorithms/CPlusPlus/Sorting/3way_quick_sort.cpp diff --git a/sorting/c-or-cpp/bubble-sort.cpp b/algorithms/CPlusPlus/Sorting/bubble-sort.cpp similarity index 100% rename from sorting/c-or-cpp/bubble-sort.cpp rename to algorithms/CPlusPlus/Sorting/bubble-sort.cpp diff --git a/sorting/c-or-cpp/bucket-sort.cpp b/algorithms/CPlusPlus/Sorting/bucket-sort.cpp similarity index 100% rename from sorting/c-or-cpp/bucket-sort.cpp rename to algorithms/CPlusPlus/Sorting/bucket-sort.cpp diff --git a/sorting/c-or-cpp/comb-sort.cpp b/algorithms/CPlusPlus/Sorting/comb-sort.cpp similarity index 100% rename from sorting/c-or-cpp/comb-sort.cpp rename to algorithms/CPlusPlus/Sorting/comb-sort.cpp diff --git a/sorting/c-or-cpp/counting-sort.cpp b/algorithms/CPlusPlus/Sorting/counting-sort.cpp similarity index 100% rename from sorting/c-or-cpp/counting-sort.cpp rename to algorithms/CPlusPlus/Sorting/counting-sort.cpp diff --git a/sorting/c-or-cpp/heap-sort.cpp b/algorithms/CPlusPlus/Sorting/heap-sort.cpp similarity index 100% rename from sorting/c-or-cpp/heap-sort.cpp rename to algorithms/CPlusPlus/Sorting/heap-sort.cpp diff --git a/sorting/c-or-cpp/insertion-sort.cpp b/algorithms/CPlusPlus/Sorting/insertion-sort.cpp similarity index 100% rename from sorting/c-or-cpp/insertion-sort.cpp rename to algorithms/CPlusPlus/Sorting/insertion-sort.cpp diff --git a/sorting/c-or-cpp/quick-sort.cpp b/algorithms/CPlusPlus/Sorting/quick-sort.cpp similarity index 100% rename from sorting/c-or-cpp/quick-sort.cpp rename to algorithms/CPlusPlus/Sorting/quick-sort.cpp diff --git a/sorting/c-or-cpp/radix-sort.cpp b/algorithms/CPlusPlus/Sorting/radix-sort.cpp similarity index 100% rename from sorting/c-or-cpp/radix-sort.cpp rename to algorithms/CPlusPlus/Sorting/radix-sort.cpp diff --git a/sorting/c-or-cpp/selection-sort.cpp b/algorithms/CPlusPlus/Sorting/selection-sort.cpp similarity index 100% rename from sorting/c-or-cpp/selection-sort.cpp rename to algorithms/CPlusPlus/Sorting/selection-sort.cpp diff --git a/sorting/c-or-cpp/shell-sort.cpp b/algorithms/CPlusPlus/Sorting/shell-sort.cpp similarity index 100% rename from sorting/c-or-cpp/shell-sort.cpp rename to algorithms/CPlusPlus/Sorting/shell-sort.cpp diff --git a/stacks/c-or-cpp/balanced-parenthesis.cpp b/algorithms/CPlusPlus/Stacks/balanced-parenthesis.cpp similarity index 100% rename from stacks/c-or-cpp/balanced-parenthesis.cpp rename to algorithms/CPlusPlus/Stacks/balanced-parenthesis.cpp diff --git a/strings/c-or-cpp/rabin-karp.cpp b/algorithms/CPlusPlus/Strings/rabin-karp.cpp similarity index 100% rename from strings/c-or-cpp/rabin-karp.cpp rename to algorithms/CPlusPlus/Strings/rabin-karp.cpp diff --git a/strings/c-or-cpp/sequence.cpp b/algorithms/CPlusPlus/Strings/sequence.cpp similarity index 100% rename from strings/c-or-cpp/sequence.cpp rename to algorithms/CPlusPlus/Strings/sequence.cpp diff --git a/strings/c-or-cpp/string-reverse.cpp b/algorithms/CPlusPlus/Strings/string-reverse.cpp similarity index 100% rename from strings/c-or-cpp/string-reverse.cpp rename to algorithms/CPlusPlus/Strings/string-reverse.cpp diff --git a/strings/c-or-cpp/string-tokeniser.cpp b/algorithms/CPlusPlus/Strings/string-tokeniser.cpp similarity index 100% rename from strings/c-or-cpp/string-tokeniser.cpp rename to algorithms/CPlusPlus/Strings/string-tokeniser.cpp diff --git a/trees/c-or-cpp/build-binary-tree.cpp b/algorithms/CPlusPlus/Trees/build-binary-tree.cpp similarity index 100% rename from trees/c-or-cpp/build-binary-tree.cpp rename to algorithms/CPlusPlus/Trees/build-binary-tree.cpp diff --git a/trees/c-or-cpp/count-and-sum-of-nodes-in-binary-tree.cpp b/algorithms/CPlusPlus/Trees/count-and-sum-of-nodes-in-binary-tree.cpp similarity index 100% rename from trees/c-or-cpp/count-and-sum-of-nodes-in-binary-tree.cpp rename to algorithms/CPlusPlus/Trees/count-and-sum-of-nodes-in-binary-tree.cpp diff --git a/trees/c-or-cpp/level-order-traversal.cpp b/algorithms/CPlusPlus/Trees/level-order-traversal.cpp similarity index 100% rename from trees/c-or-cpp/level-order-traversal.cpp rename to algorithms/CPlusPlus/Trees/level-order-traversal.cpp diff --git a/trees/c-or-cpp/pre-in-post-traversal.cpp b/algorithms/CPlusPlus/Trees/pre-in-post-traversal.cpp similarity index 100% rename from trees/c-or-cpp/pre-in-post-traversal.cpp rename to algorithms/CPlusPlus/Trees/pre-in-post-traversal.cpp diff --git a/arrays/c-or-cpp/array.cpp b/arrays/c-or-cpp/array.cpp deleted file mode 100644 index 2d4b4425..00000000 --- a/arrays/c-or-cpp/array.cpp +++ /dev/null @@ -1,22 +0,0 @@ -#include -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; -} diff --git a/arrays/c-or-cpp/data-before-sort.cpp b/arrays/c-or-cpp/data-before-sort.cpp deleted file mode 100644 index b90a5092..00000000 --- a/arrays/c-or-cpp/data-before-sort.cpp +++ /dev/null @@ -1,36 +0,0 @@ -#include -#include - - 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+1]) - { - temp=a[j]; - a[j]=a[j+1]; - a[j+1]=temp; - } - } - } - cout<<"\nData after sorting: "; - for(j=0;j<10;j++) - { - cout< -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 =" < 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; -} diff --git a/arrays/c-or-cpp/variable-declaration.cpp b/arrays/c-or-cpp/variable-declaration.cpp deleted file mode 100644 index beff7d45..00000000 --- a/arrays/c-or-cpp/variable-declaration.cpp +++ /dev/null @@ -1,26 +0,0 @@ -#include -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; -}