├── Headers ├── Queue.hpp ├── binary-tree.hpp ├── find.hpp ├── graph.hpp ├── heap.hpp ├── list.hpp ├── mst.hpp ├── o-bst.hpp ├── point.hpp └── stack.hpp ├── LICENSE ├── README.md ├── ROBOTS.TXT ├── pendings ├── src ├── Data-Structures │ ├── binary-tree.cpp │ ├── graph-2.cpp │ ├── graphs-1.cpp │ ├── graphs.cpp │ ├── list.cpp │ ├── queue.cpp │ ├── readme.md │ └── stack.cpp ├── divide-and-conquer │ └── merge-sort.cc ├── dynamic-standard-problems │ ├── Hackerrank-1.cpp │ ├── coin-change-modified.cpp │ ├── coin-change.cpp │ └── travelling-salesman-problem.cpp ├── graph-1.cpp ├── graph-2.cpp ├── graph-3.cpp ├── graph-5.cpp ├── graphs-4.cpp ├── greedy-standard-problems │ └── huffman-coding.py ├── heap.cpp ├── mathematics │ └── readme ├── miscellaneous │ └── neighbor.cpp ├── resources.md ├── sort-1-merge-sort.cpp ├── sort-2-quick-sort.cpp ├── sort-3-bubble-sort.cpp └── trie.cpp └── travis.yaml /Headers/Queue.hpp: -------------------------------------------------------------------------------- 1 | 2 | -------------------------------------------------------------------------------- /Headers/binary-tree.hpp: -------------------------------------------------------------------------------- 1 | 2 | -------------------------------------------------------------------------------- /Headers/find.hpp: -------------------------------------------------------------------------------- 1 | 2 | -------------------------------------------------------------------------------- /Headers/graph.hpp: -------------------------------------------------------------------------------- 1 | 2 | -------------------------------------------------------------------------------- /Headers/heap.hpp: -------------------------------------------------------------------------------- 1 | 2 | -------------------------------------------------------------------------------- /Headers/list.hpp: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | -------------------------------------------------------------------------------- /Headers/mst.hpp: -------------------------------------------------------------------------------- 1 | 2 | -------------------------------------------------------------------------------- /Headers/o-bst.hpp: -------------------------------------------------------------------------------- 1 | 2 | -------------------------------------------------------------------------------- /Headers/point.hpp: -------------------------------------------------------------------------------- 1 | 2 | -------------------------------------------------------------------------------- /Headers/stack.hpp: -------------------------------------------------------------------------------- 1 | 2 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) 2019 Jishan Shaikh 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # :paperclip: lib-algo 2 | A C++ library with implementation of basic algorithms, data structures, constants at lower complexities. Useful for Competitive Programming and System Programming. 3 | 4 | # Sections 5 | - [To do and Progress](https://github.com/Jishanshaikh4/lib-algo/blob/master/README.md#to-do-and-progress) 6 | - [Contributions](https://github.com/Jishanshaikh4/lib-algo/blob/master/README.md#contributions) 7 | - [License](https://github.com/Jishanshaikh4/lib-algo/blob/master/README.md#license). 8 | 9 | ## To do and Progress 10 | - Sorting (Merge, Quick, Radix, Heap, Bucket?) (NOT DONE YET) 11 | - Advanced Sorting (Randomized, approximated, distributed Data Structures) (NOT DONE YET) 12 | - Searching (Binary, etc.)(NOT DONE YET) 13 | - Graph Algorithms (DFS, BFS, and their variations, MST, Connected Components) (NOT DONE YET) 14 | - Data Structures as abstract data types (Tree, Graph, and their variations) (NOT DONE YET) 15 | - Puzzles implemented in C++ (NOT DONE YET) 16 | 17 | ## Contributions 18 | I'm willing to accept contributions from open source developers. What you have to do is simply fork this repository, made changes to it, and leave a pull request. Anybody can contribute to this repository following industry ethics. 19 | 20 | ## License 21 | This library is licensed under MIT Licence. You can not use, re-modify, distribute, etc. for commercial purposes. Read more about licence [here](https://en.wikipedia.org/wiki/MIT_License). 22 | 23 | Copyright 2018-Present. Jishan Shaikh. 24 | 25 | MIT License 26 | 27 | https://en.wikipedia.org/wiki/MIT_License 28 | 29 | ![](https://upload.wikimedia.org/wikipedia/commons/f/f8/License_icon-mit-88x31-2.svg) 30 | -------------------------------------------------------------------------------- /ROBOTS.TXT: -------------------------------------------------------------------------------- 1 | ROBOTS.TXT 2 | -------------------------------------------------------------------------------- /pendings: -------------------------------------------------------------------------------- 1 | s 2 | ss 3 | -------------------------------------------------------------------------------- /src/Data-Structures/binary-tree.cpp: -------------------------------------------------------------------------------- 1 | 2 | -------------------------------------------------------------------------------- /src/Data-Structures/graph-2.cpp: -------------------------------------------------------------------------------- 1 | 2 | -------------------------------------------------------------------------------- /src/Data-Structures/graphs-1.cpp: -------------------------------------------------------------------------------- 1 | 2 | -------------------------------------------------------------------------------- /src/Data-Structures/graphs.cpp: -------------------------------------------------------------------------------- 1 | 2 | -------------------------------------------------------------------------------- /src/Data-Structures/list.cpp: -------------------------------------------------------------------------------- 1 | 2 | -------------------------------------------------------------------------------- /src/Data-Structures/queue.cpp: -------------------------------------------------------------------------------- 1 | 2 | -------------------------------------------------------------------------------- /src/Data-Structures/readme.md: -------------------------------------------------------------------------------- 1 | https://github.com/Jishanshaikh4/lib-algo 2 | -------------------------------------------------------------------------------- /src/Data-Structures/stack.cpp: -------------------------------------------------------------------------------- 1 | 2 | -------------------------------------------------------------------------------- /src/divide-and-conquer/merge-sort.cc: -------------------------------------------------------------------------------- 1 | 2 | -------------------------------------------------------------------------------- /src/dynamic-standard-problems/Hackerrank-1.cpp: -------------------------------------------------------------------------------- 1 | 2 | -------------------------------------------------------------------------------- /src/dynamic-standard-problems/coin-change-modified.cpp: -------------------------------------------------------------------------------- 1 | 2 | -------------------------------------------------------------------------------- /src/dynamic-standard-problems/coin-change.cpp: -------------------------------------------------------------------------------- 1 | 2 | -------------------------------------------------------------------------------- /src/dynamic-standard-problems/travelling-salesman-problem.cpp: -------------------------------------------------------------------------------- 1 | 2 | -------------------------------------------------------------------------------- /src/graph-1.cpp: -------------------------------------------------------------------------------- 1 | 2 | -------------------------------------------------------------------------------- /src/graph-2.cpp: -------------------------------------------------------------------------------- 1 | 2 | -------------------------------------------------------------------------------- /src/graph-3.cpp: -------------------------------------------------------------------------------- 1 | 2 | -------------------------------------------------------------------------------- /src/graph-5.cpp: -------------------------------------------------------------------------------- 1 | 2 | -------------------------------------------------------------------------------- /src/graphs-4.cpp: -------------------------------------------------------------------------------- 1 | 2 | -------------------------------------------------------------------------------- /src/greedy-standard-problems/huffman-coding.py: -------------------------------------------------------------------------------- 1 | import os 2 | 3 | def Huffman(s): 4 | p = s 5 | # Code in python 6 | print(p) 7 | 8 | s = "Secret Text" 9 | Huffman(s) 10 | 11 | -------------------------------------------------------------------------------- /src/heap.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | int main(){ 4 | ios_base::sync_with_stdio(0); 5 | std::cin.tie(0); 6 | std::cout << "robots.txt" << "\n"; 7 | return 0; 8 | } 9 | -------------------------------------------------------------------------------- /src/mathematics/readme: -------------------------------------------------------------------------------- 1 | This branch will consider holding important lib-math source files and headers; that should be in an algorithmic library. 2 | -------------------------------------------------------------------------------- /src/miscellaneous/neighbor.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | using namespace std; 4 | 5 | int main(){ 6 | int t; 7 | cin >> t; 8 | while(t--){ 9 | int n, tempsum; 10 | cin >> n; 11 | vector a(n); 12 | vector temp; 13 | vector maxarray; 14 | for(int i=0; i> a[i]; 16 | } 17 | int maxsum = 0; 18 | for(int i=0; i maxsum){ 28 | maxsum = tempsum; 29 | int length = temp.size(); 30 | for(int m=0; m