- Notifications
You must be signed in to change notification settings - Fork0
DataStructure, Algorithm, Design Patterns in Golang
License
skshahriarahmedraka/DataStructure-Algorithm-DesignPatterns-in-Golang
Folders and files
Name | Name | Last commit message | Last commit date | |
---|---|---|---|---|
Repository files navigation
1. Math -2. String Manipulation -3. Conversions & input -4. Data structure -5. Tree Data Structure -6. Graph Data Structure -7. Algorithm -8. Sorting Algorithm -9. Searching Algorithm -10. Tree Algorithm -11. Graph Algorithm -12. Dynamic programming -13. Cryptography/Ciphers (encryptions) -14. Design Pattern
1. Math (Read)
Heap:
Binary HeapWhy is Binary Heap Preferred over BST for Priority Queue?Binomial HeapFibonacci HeapHeap SortK’th Largest Element in an arraySort an almost sorted array/Tournament Tree (Winner Tree) and Binary Heap
https://en.wikipedia.org/wiki/List_of_data_structures
complete binary tree
full binary tree
Linked List Advantages
What is Data Structure
Heap Data Structure
Types of Trees in Data Structure
AVL Tree in Data Structure
B Tree in Data Structure
B+ Tree in Data Structure
Arrays in Data Structure
Graph in Data Structure
Graph Representation
Breadth First Search
Depth Limited Search
Pointers in Data Structure
Types of Graph in Data Structure
Tree Traversal in Data StructureTree Traversal Techniques
Splay Tree in Data StructureSpanning Tree AlgorithmSparse Matrix in Data Structure
Skip List Data Structure
Kruskal’s AlgorithmPrim’s AlgorithmBFS VS DFSBCNFSkip List
Trees and Tree Algorithms
7.1. Objectives7.2. Examples of Trees7.3. Vocabulary and Definitions7.4. List of Lists Representation7.5. Nodes and References7.6. Parse Tree7.7. Tree Traversals7.8. Priority Queues with Binary Heaps7.9. Binary Heap Operations7.10. Binary Heap Implementation7.10.1. The Structure Property7.10.2. The Heap Order Property7.10.3. Heap Operations7.11. Binary Search Trees7.12. Search Tree Operations7.13. Search Tree Implementation7.14. Search Tree Analysis7.15. Balanced Binary Search Trees7.16. AVL Tree Performance7.17. AVL Tree Implementation7.18. Summary of Map ADT Implementations7.19. Summary7.20. Key Terms7.21. Discussion Questions7.22. Programming Exercises
Introduction, DFS and BFS :
Graph and its representationsBreadth First Traversal for a GraphDepth First Traversal for a GraphApplications of Depth First SearchApplications of Breadth First TraversalGraph representations using set and hashFind Mother Vertex in a GraphTransitive Closure of a Graph using DFSFind K cores of an undirected GraphIterative Depth First SearchCount the number of nodes at given level in a tree using BFSCount all possible paths between two verticesMinimum initial vertices to traverse whole matrix with given conditionsShortest path to reach one prime to other by changing single digit at a timeWater Jug problem using BFSCount number of trees in a forestBFS using vectors & queue as per the algorithm of CLRSLevel of Each node in a Tree from source nodeConstruct binary palindrome by repeated appending and trimmingTranspose graphPath in a Rectangle with CirclesHeight of a generic tree from parent arrayBFS using STL for competitive codingDFS for a n-ary tree (acyclic graph) represented as adjacency listMaximum number of edges to be added to a tree so that it stays a Bipartite graphA Peterson Graph ProblemImplementation of Graph in JavaScriptPrint all paths from a given source to a destination using BFSMinimum number of edges between two vertices of a GraphCount nodes within K-distance from all nodes in a setBidirectional SearchMinimum edge reversals to make a rootBFS for Disconnected GraphMove weighting scale alternate under given constraintsBest First Search (Informed Search)Number of pair of positions in matrix which are not accessibleMaximum product of two non-intersecting paths in a treeDelete Edge to minimize subtree sum differenceFind the minimum number of moves needed to move from one cell of matrix to anotherMinimum steps to reach target by a Knight | Set 1Minimum number of operation required to convert number x into yMinimum steps to reach end of array under constraintsFind the smallest binary digit multiple of given numberRoots of a tree which give minimum heightStepping NumbersClone an Undirected GraphSum of the minimum elements in all connected components of an undirected graphCheck if two nodes are on same path in a treeA matrix probability questionFind length of the largest region in Boolean MatrixIterative Deepening Search(IDS) or Iterative Deepening Depth First Search(IDDFS)
Graph Cycle :
Detect Cycle in a Directed GraphDetect cycle in an undirected graphDetect cycle in a direct graph using colorsAssign directions to edges so that the directed graph remains acyclicDetect a negative cycle in a Graph | (Bellman Ford)Cycles of length n in an undirected and connected graphDetecting negative cycle using Floyd WarshallCheck if there is a cycle with odd weight sum in an undirected graphCheck if a graphs has a cycle of odd lengthClone a Directed Acyclic GraphCheck loop in array according to given constraintsDisjoint Set (Or Union-Find) | Set 1Union-Find Algorithm | Set 2Union-Find Algorithm | (Union By Rank and Find by Optimized Path Compression)Magical Indices in an array
Topological Sorting :
Topological SortingAll topological sorts of a Directed Acyclic GraphKahn’s Algorithm for Topological SortingMaximum edges that can be added to DAG so that is remains DAGLongest path between any pair of verticesLongest Path in a Directed Acyclic GraphLongest Path in a Directed Acyclic Graph | Set 2Topological Sort of a graph using departure time of vertexGiven a sorted dictionary of an alien language, find order of characters
Minimum Spanning Tree :
Prim’s Minimum Spanning Tree (MST))Applications of Minimum Spanning Tree ProblemPrim’s MST for Adjacency List RepresentationKruskal’s Minimum Spanning Tree AlgorithmBoruvka’s algorithm for Minimum Spanning TreeMinimum cost to connect all citiesSteiner TreeReverse Delete Algorithm for Minimum Spanning TreeTotal number of Spanning Trees in a GraphMinimum Product Spanning Tree
BackTracking :
Find if there is a path of more than k length from a sourceTug of WarThe Knight-Tour ProblemRat in a Mazen-Queen’s Problemm Coloring ProblemHamiltonian CyclePermutation of numbers such that sum of two consecutive numbers is a perfect square
Shortest Paths :
Dijkstra’s shortest path algorithmDijkstra’s Algorithm for Adjacency List RepresentationBellman–Ford AlgorithmFloyd Warshall AlgorithmJohnson’s algorithm for All-pairs shortest pathsShortest Path in Directed Acyclic GraphShortest path with exactly k edges in a directed and weighted graphDial’s AlgorithmPrinting paths in Dijsktra’s AlgorithmShortest path of a weighted graph where weight is 1 or 2Multistage Graph (Shortest Path)Shortest path in an unweighted graphMinimize the number of weakly connected nodesBetweenness Centrality (Centrality Measure)Comparison of Dijkstra’s and Floyd–Warshall algorithmsKarp’s minimum mean (or average) weight cycle algorithm0-1 BFS (Shortest Path in a Binary Weight Graph)Find minimum weight cycle in an undirected graphMinimum Cost Path with Left, Right, Bottom and Up moves allowedMinimum edges to reverse to make path from a src to a destFind Shortest distance from a guard in a Bank
Connectivity :
Find if there is a path between two vertices in a directed graphConnectivity in a directed graphArticulation Points (or Cut Vertices) in a GraphBiconnected ComponentsBiconnected graphBridges in a graphEulerian path and circuitFleury’s Algorithm for printing Eulerian Path or CircuitStrongly Connected ComponentsTransitive closure of a graphFind the number of islandsFind the number of Islands | Set 2 (Using Disjoint Set)Count all possible walks from a source to a destination with exactly k edgesEuler Circuit in a Directed GraphCount the number of non-reachable nodesFind the Degree of a Particular vertex in a GraphCheck if a given graph is tree or notMinimum edges required to add to make Euler CircuitEulerian Path in undirected graphFind if there is a path of more than k lengthLength of shortest chain to reach the target wordPrint all paths from a given source to destinationFind minimum cost to reach destination using trainFind if an array of strings can be chained to form a circle | Set 1Find if an array of strings can be chained to form a circle | Set 2Tarjan’s Algorithm to find strongly connected ComponentsNumber of loops of size k starting from a specific nodePaths to travel each nodes using each edge (Seven Bridges of Königsberg)Number of cyclic elements in an array where we can jump according to valueNumber of groups formed in a graph of friendsMinimum cost to connect weighted nodes represented as arrayCount single node isolated sub-graphs in a disconnected graphCalculate number of nodes between two vertices in an acyclic Graph by Disjoint Union methodDynamic Connectivity | Set 1 (Incremental)Check if a graph is strongly connected | Set 1 (Kosaraju using DFS)Check if a given directed graph is strongly connected | Set 2 (Kosaraju using BFS)Check if removing a given edge disconnects a graphFind all reachable nodes from every node present in a given setConnected Components in an undirected graphk’th heaviest adjacent node in a graph where each vertex has weight
Maximum Flow :
Ford-Fulkerson Algorithm for Maximum Flow ProblemFind maximum number of edge disjoint paths between two verticesFind minimum s-t cut in a flow networkMaximum Bipartite MatchingChannel Assignment ProblemPush Relabel- Set 1-IntroductionPush Relabel- Set 2- ImplementationKarger’s Algorithm- Set 1- Introduction and ImplementationKarger’s Algorithm- Set 2 – Analysis and ApplicationsDinic’s algorithm for Maximum FlowMax Flow Problem Introduction
STL Implementation of Algorithms :
Kruskal’s Minimum Spanning Tree using STL in C++Prim’s Algorithm using Priority Queue STLDijkstra’s Shortest Path Algorithm using STLDijkstra’s Shortest Path Algorithm using set in STLGraph implementation using STL for competitive programming | Set 2 (Weighted graph)
Hard Problems :
Graph Coloring (Introduction and Applications)Greedy Algorithm for Graph ColoringTraveling Salesman Problem (TSP) ImplementationTravelling Salesman Problem (Naive and Dynamic Programming)Travelling Salesman Problem (Approximate using MST)Vertex Cover Problem | Set 1 (Introduction and Approximate Algorithm)K Centers Problem | Set 1 (Greedy Approximate Algorithm)Erdos Renyl Model (for generating Random Graphs)Clustering Coefficient in Graph TheoryChinese Postman or Route Inspection | Set 1 (introduction)Hierholzer’s Algorithm for directed graph
Misc :
Number of triangles in an undirected GraphNumber of triangles in directed and undirected GraphCheck whether a given graph is Bipartite or notSnake and Ladder ProblemMinimize Cash Flow among a given set of friends who have borrowed money from each otherBoggle (Find all possible words in a board of characters)Hopcroft Karp Algorithm for Maximum Matching-IntroductionHopcroft Karp Algorithm for Maximum Matching-ImplementationMinimum Time to rot all orangesFind same contents in a list of contactsHypercube GraphCheck for star graphOptimal read list for a given number of daysPrint all jumping numbers smaller than or equal to a given valueFibonacci Cube GraphBarabasi Albert Graph (for Scale Free Models)Construct a graph from given degrees of all verticesDegree Centrality (Centrality Measure)Katz Centrality (Centrality Measure)Mathematics | Graph theory practice questions2-Satisfiability (2-SAT) ProblemDetermine whether a universal sink exists in a directed graphNumber of sink nodes in a graphLargest subset of Graph vertices with edges of 2 or more colorsNetworkX : Python software package for study of complex networksGenerate a graph using Dictionary in PythonCount number of edges in an undirected graphTwo Clique Problem (Check if Graph can be divided in two Cliques)Check whether given degrees of vertices represent a Graph or TreeFinding minimum vertex cover size of a graph using binary searchStable Marriage ProblemSum of dependencies in a graph
- [Rabin-Karp Algorithm ](./10.Algorithm/Rabin-Karp Algorithm.go)Link list
Heapheapify
SortingMarge sortQuick sort
Divide and conquerKnapsackHuffman codingPrims and kuskalsDijkstraGreedyMulti stage graphFloyd warshallBelmanfordDynamic programmingGraphHamiltonian cycleRobin karp
Binary treeBinary search treeAVL treeB tree and B+ treeDFSBFS
Hashing
Tower of hanoi
Single source shortest path
- Selection Sort
- Bubble Sort
- Insertion Sort
- Merge Sort Sort
- Quick Sort
- Heap sort
- Counting Sort
- Radix Sort
- Bucket Sort
- ShellSort
- TimSort
- Comb Sort
- Pigeonhole Sort
- Cycle Sort
- Cocktail Sort
- Strand Sort
- Bitonic Sort
- Pancake sorting
- Binary Insertion Sort
- BogoSort or Permutation Sort
- Gnome Sort
- Sleep Sort – The King of Laziness / Sorting while Sleeping
- Structure Sorting (By Multiple Rules) in C++
- Stooge Sort
- Tag Sort (To get both sorted and original)
- Tree Sort
- Cartesian Tree Sorting
- Odd-Even Sort / Brick Sort
- QuickSort on Singly Linked List
- QuickSort on Doubly Linked List
- 3-Way QuickSort (Dutch National Flag)
- Merge Sort for Linked Lists
- Merge Sort for Doubly Linked List
- 3-way Merge Sort
- Linear Search
- Binary Search in Array using Recurtion
- Binary Search in Array using loop
- Binary Search
- Interpolation Search
Dynamic programming : 80
0-1 knapsack problem - 6
Equal sum partition
Count of subset sum
Minimum subset sum diff
Target sum
# of subset & genis
Unbound knapsack problem - 5
Fibonacci - 7
Longest common subsequence (LCS) - 15
Longest increasing subsequence (LIS) - 10
Kadane’s algorithm - 6
Matrix chain multiplication - 7
DP on trees - 4
DP on grid - 14
Others - 5
- Creational Patterns
- Abstract Factory -Provides an interface for creating families of releated objects
- Builder -Builds a complex object using simple objects
- Factory Method -Defers instantiation of an object to a specialized function for creating instances
- Object Pool -Instantiates and maintains a group of objects instances of the same type
- Singleton -Restricts instantiation of a type to one object
- Abstract Factory -Provides an interface for creating families of releated objects
- Structural Patterns
- Bridge -Decouples an interface from its implementation so that the two can vary independently
- Composite -Encapsulates and provides access to a number of different objects
- Decorator -Adds behavior to an object, statically or dynamically
- Facade -Uses one type as an API to a number of others
- Flyweight -Reuses existing instances of objects with similar/identical state to minimize resource usage
- Proxy -Provides a surrogate for an object to control it's actions
- Bridge -Decouples an interface from its implementation so that the two can vary independently
- Behavioral Patterns
- Chain of Responsibility -Avoids coupling a sender to receiver by giving more than object a chance to handle the request
- Command -Bundles a command and arguments to call later
- Mediator -Connects objects and acts as a proxy
- Memento -Generate an opaque token that can be used to go back to a previous state
- Observer -Provide a callback for notification of events/changes to data
- Registry -Keep track of all subclasses of a given class
- State -Encapsulates varying behavior for the same object based on its internal state
- Strategy -Enables an algorithm's behavior to be selected at runtime
- Template -Defines a skeleton class which defers some methods to subclasses
- Visitor -Separates an algorithm from an object on which it operates
- Chain of Responsibility -Avoids coupling a sender to receiver by giving more than object a chance to handle the request
- Synchronization Patterns
- Condition Variable -Provides a mechanism for threads to temporarily give up access in order to wait for some condition
- Lock/Mutex -Enforces mutual exclusion limit on a resource to gain exclusive access
- Monitor -Combination of mutex and condition variable patterns
- Read-Write Lock -Allows parallel read access, but only exclusive access on write operations to a resource
- Semaphore -Allows controlling access to a common resource
- Condition Variable -Provides a mechanism for threads to temporarily give up access in order to wait for some condition
- Concurrency Patterns
- N-Barrier -Prevents a process from proceeding until all N processes reach to the barrier
- Bounded Parallelism -Completes large number of independent tasks with resource limits
- Broadcast -Transfers a message to all recipients simultaneously
- Coroutines -Subroutines that allow suspending and resuming execution at certain locations
- Generators -Yields a sequence of values one at a time
- Reactor -Demultiplexes service requests delivered concurrently to a service handler and dispatches them syncronously to the associated request handlers
- Parallelism -Completes large number of independent tasks
- Producer Consumer -Separates tasks from task executions
- N-Barrier -Prevents a process from proceeding until all N processes reach to the barrier
- Messaging Patterns
- Fan-In -Funnels tasks to a work sink (e.g. server)
- Fan-Out -Distributes tasks among workers (e.g. producer)
- Futures & Promises -Acts as a place-holder of a result that is initially unknown for synchronization purposes
- Publish/Subscribe -Passes information to a collection of recipients who subscribed to a topic
- Push & Pull -Distributes messages to multiple workers, arranged in a pipeline
- Fan-In -Funnels tasks to a work sink (e.g. server)
- Stability Patterns
- Bulkheads -Enforces a principle of failure containment (i.e. prevents cascading failures)
- Circuit-Breaker -Stops the flow of the requests when requests are likely to fail
- Deadline -Allows clients to stop waiting for a response once the probability of response becomes low (e.g. after waiting 10 seconds for a page refresh)
- Fail-Fast -Checks the availability of required resources at the start of a request and fails if the requirements are not satisfied
- Handshaking -Asks a component if it can take any more load, if it can't, the request is declined
- Steady-State -For every service that accumulates a resource, some other service must recycle that resource
- Bulkheads -Enforces a principle of failure containment (i.e. prevents cascading failures)
- Profiling Patterns
- Timing Functions -Wraps a function and logs the execution
- Timing Functions -Wraps a function and logs the execution
- Idioms
- Functional Options -Allows creating clean APIs with sane defaults and idiomatic overrides
- Functional Options -Allows creating clean APIs with sane defaults and idiomatic overrides
- Anti-Patterns
- Cascading Failures -A failure in a system of interconnected parts in which the failure of a part causes a domino effect
- Cascading Failures -A failure in a system of interconnected parts in which the failure of a part causes a domino effect
About
DataStructure, Algorithm, Design Patterns in Golang
Topics
Resources
License
Uh oh!
There was an error while loading.Please reload this page.
Stars
Watchers
Forks
Releases
Packages0
Uh oh!
There was an error while loading.Please reload this page.