Coder Social home page Coder Social logo

ngadde / algorithms-1 Goto Github PK

View Code? Open in Web Editor NEW

This project forked from jpa99/algorithms

1.0 1.0 3.0 7.43 MB

A collection of various useful algorithms and data structures along with their Java implementations.

License: MIT License

Java 100.00%

algorithms-1's Introduction

Algorithms

This respository is a collection of various useful algorithms and data structures along with their Java implementations, intended for educational use. This is a work in progress, so some algorithms may not be included. All files that have been added have been tested extensively and should be accurate, readable, and efficient. Feel free to suggest any algorithms that you'd like to see implemented in the future. Don't hesitate to contact me with any questions, concerns, or feedback (my contact information is at the bottom of this file). If you found this repository helpful, I'd love to know :)

Table of Contents

Graph

  • Graph Traversal
    • Breadth-First Search
    • Depth First Search
  • Shortest Path
    • Dijkstra's Algorithm
    • Bellman-Ford
    • Floyd-Warshall
    • Johnson's Algorithm
  • Minimum Spanning Tree
    • Kruskal's Algorithm
    • Prim's Algorithm
  • Network Flow
    • Karger's Algorithm
    • Push-Relabel
    • Edmonds-Karp
    • Ford-Fulkerson
  • Tarjan's Algorithm
  • Topological Sort
  • Strongly Connected Components

Dynamic Programming

  • 0-1 Knapsack
  • Edit (Levenshtein) Distance
  • Longest Increasing Subsequence
  • Longest Common Subsequence
  • Maximum Subset Sum

Sorting

  • Timsort
  • Radix Sort
  • Counting Sort
  • Quicksort
  • Heapsort
  • Mergesort
  • Insertion Sort
  • Bubble Sort
  • Selection Sort
  • Bogosort

Searching

  • Linear
  • Binary
  • ith Order Statistic
    • Sort Select
    • Randomized Select
    • Heapselect
    • Quickselect

Strings

  • String Searching
    • Aho-Corasick
    • Z Algorithm
    • Knuth-Morris-Pratt
    • Boyer-Moore
    • Rabin-Karp
    • Brute Force

Math/Number Theory

  • Fibonacci
    • Binet's Formula
    • Iterative
    • Recursive (DP)
    • Matrix Exponentiation
    • Fast Doubling
  • Euclid's Algorithm
  • Fast Fourier Transform
  • Primality Testing
    • Naive
    • Sieve of Erastothenes
    • Miller-Rabin
  • Karatsuba's Algorithm
  • Fast Exponentiation
  • Strassen's Algorithm

Computational Geometry

  • Convex Hull
    • Graham Scan
    • Jarvis March

Optimization

  • Naive Optimization
  • Simplex (LP)
  • Simulated Annealing
  • Genetic Algorithms
  • Combinatoric Algorithms

Miscellaneous

  • Fisher-Yates Shuffle
  • Kadane's Algorithm
  • Subarray Inversions

Data Structures

  • Graph
  • Tree
  • Binary Tree
  • Fenwick Tree (Binary Indexed Tree)
  • Red-Black Tree
  • AVL Tree
  • B-Tree
  • Suffix Tree
  • Trie
  • Hash Table
  • Hash Map
  • Stack
  • Queue
  • List
  • LinkedList

Interesting math problems that can be solved computationally; full problem set available here. The Project Euler folder contains the full inventory of problems I've implemented with it's own table of contents here.

Competitive programming style problems from previous competitions. The Google Code Jam folder contains the full inventory of problems I've implemented with it's own table of contents here.

Algorithmic problems from past USA Computing Olympiad contests, check out the full problem database. The USACO folder contains the full inventory of problems I've implemented with it's own table of contents here.

Additional Resources

If you're interested in expanding your knowledge of algorithms, I've included a list of resources that you can take a look at.

Books

Some helpful books to formally introduce algorithims:

  • Introduction to Algorithms (CLRS) by Cormen, Leiserson, Rivest, and Stein - Standard text for introductory algorithms courses; proof-based, very rigorous, comprehensive explanations.
  • The Art of Computer Programming by Knuth - Extremely high level, incredibly detailed text; should be used primarily as a reference.
  • Algorithms Unlocked by Cormen - More accessible, beginner-friendly text; read this if you find CLRS too daunting.
  • Algorithm Design by Kleinberg and Tardos - Great introductory book, probably better suited for beginners than CLRS; great explanations of graph theoretic algorithms and analyses.
  • Algorithms by Sedgewick - Excellent book, very comparable to Algorithm Design by Kleinberg and Tardos in terms of accessibility; offers very good implementations of key algorithms in Java.
  • The Algorithm Design Manual by Skiena - Perhaps a different flavor of algorithms books, Skiena introduces algorithms and problem types but doesn't delve into as much rigor as some of the above texts.
  • Introduction to Algorithms: A Creative Approach by Manber - Very light, not as proof-heavy as industry standard texts like CLRS but still very informative; provides excellent algorithmic intuition.
  • Algorithms by Dasgupta, Papadimitriou, Vazirani - Good, very readable, beginner-friendly algorithms textbook; used for decades at Berkeley and UCSD.

Courses

More courses avilable here

  • Algorithms on Coursera, taught by Wayne and Sedgewick (Princeton) - This online course goes hand in hand with Sedgewick's algorithms textbook, very good practical resource if you're using that book or you're familiar with Java.
  • Algorithms on Coursera, taught by Roughgarden (Stanford) - More conceptual course, prioritizes mathematical analysis over implementation details.
  • Introduction to Algorithms on MIT OCW, taught by Leiserson and Demaine (MIT) - This is a good counterpart to Cormen's text since it's taught by the L in CLRS; very rigorous, detailed course.
  • Design and Analysis of Algorithms on MIT OCW, taught by Demaine, Devadas, and Lynch (MIT) - Intermediate algorithms course; goes in-depth on a handful of topics/probelms, should only be taken after introductory courses.
  • Data Structures in Java on Coursera, taught by Porter, Alvarado, and Minnes (UCSD) - Good explanation of Java data structures including comparisons and performance analyses.
  • Advanced Algorithms on MIT OCW, taught by Goemans (MIT) - Graduate level course, focuses largely on advanced data structures, graph theoretic algorithms, computational geometry, and number theoretic algorithms. Useful as a reference for exploring specific topics in-depth.
  • Randomized Algorithms on MIT OCW, taught by Karger (MIT) - Graduate level course, explores randomized algorithms which aren't often covered comprehensively in many introductory algorithms texts/courses. Requires solid background in linear algebra, probabilty theory, and statistics.
  • Advanced Data Structures on MIT OCW, taught by Demaine (MIT) - Graduate level course, explores very advanced data structures and operations on them.
  • Advanced Algorithms taught by Nelson (Harvard) - Very challenging problem sets; lectures assume broad knowledge about algorithms.
  • Introduction to Programming Contests taught by Park (Stanford) - Good list of competitve programming algorithms and strategies for problem solving. Excellent resource for practice problems.

Websites

Websites that offer detailed explanations and complexity analyses for some of the above algorithims:

  • Topcoder Algorithms Tutorials - Phenomenal resource taught by competitive programming legends. Lots of challenging algorithms deconstructed and numerous applications demonstrated with Topcoder problems.
  • GeeksforGeeks - Almost every well known algorithm is explained on this site with implementations, however some explanations are occasionally cursory/lacking in detail/unclear.
  • IOI Syllabus - Detailed list of topics covered by the IOI.
  • E-maxx - Translated from Russian to English, very good list of useful algorithms and impelmentations along with explanations; widely used within the competitive programming community.
  • Algorithms Discussion - Codeforces blog post containing diverse array of algorithms (including less common techniques) and links to explanations/implementations.
  • 500 Data Structures and Algorithms - Collection of software engineering interview questions and solutions.
  • Beehyve - Crowdsourced collection of algorithms and data structures and other topics in computer science as well as community discussions
  • VisuAlgo - Great animations to help visiualize tricky algorithms and data structures

Online Judges

Competitive programming websites and online judges which offer a plethora of interesting algorithmic problems for all skill levels:

  • Topcoder - Elite programming competitions; monetary prizes attract significant talent, makning this platform one of the most competitive. Very broad range of problems from beginner-friendly to extremely challenging. Challenge period avilable to win extra points by reading others' code and calling them out for incorrect solutions.
  • Codeforces - On par with Topcoder, Codeforces offers longer, albeit similar problems, with similar styles. Only disadvantage is that competition times are often inconvenient if you live in the US.
  • Google Code Jam - Annual competition sponsored by Google, very fun problems (in my personal opinion).
  • USACO - USACO Training Gateway is an excellent segway into the world of competitive programming, offers great explanations and a good progression of problems to introduce algorithmic concepts.
  • HackerRank - Platform of choice for most technical recruiters, HackerRank offers both short (1-3 hours) and long (2-7 days) competitions with consistent editorials, wrapped in a great UI.
  • CodeChef - Indian based platform, offering contests of varying lengths as well.
  • LeetCode - Offers light, fast interview-style problems rather than heavy algorithmic challenges. Excellent resource for preparing for software engineering interviews.
  • HackerEarth - Similar to LeetCode, not as competitive, offers fun 1v1 challenges.
  • Project Euler - Mathematical and number theoretic problems that require both mathematical insight and programming skill to solve; around 600 problems currently available.
  • Sphere Online Judge (SPOJ) - Perhaps the best known online judge; very fast, accurate checkers and a diverse array of problems; diverse probelms for all levels; used by many competitive programmers to hone their skills.
  • UVa Online Judge - Very large database of contest problems including ACM-ICPC, geared towards more advanced programmers.
  • Timus Online Judge - Russian online judge offering unique types of problems.
  • Peking University Online Judge (POJ) - Used by Peking University ICPC team, good resource.
  • Kattis - Good, reliable online judge used by ACM-ICPC.

Developed By

Add me to Linkedin

algorithms-1's People

Contributors

jpa99 avatar

Stargazers

 avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.