/algorithms

Implementation of various algorithms in Java

Primary LanguageJava

Algorithms

Implementation of various algorithms in Java, with cost analysis.

  • Union Find - Dynamic connectivity
    • Quick Find
    • Quick Union
    • Quick Union with improvements
  • Three Sum Problem
    • Brute force
    • Using sorting and search
  • Binary Search
    • Bitonic array search
  • Sorting
    • Selection Sort
    • Insertion Sort
    • Shell Sort
    • Merge Sort
    • Quick Sort
    • 3-way Partitioning
  • Knuth Shuffle

More on analysis of algorithms.

Implementation of Data Structures and Problems solved

  • Stack
    • Using linked lists
    • Using array
    • With max
  • Queue
    • Using linked lists
    • Using array
  • Queue using two stacks
  • Dequeue
  • Randomized Queue
    • Using linked lists
    • Using array
  • Intersection of two arrays
  • Pattern Recognition: Collinear points
  • Finding kth top element
  • Binary Search Tree(BST)
  • 1D Range Count

Usage

To compile:

javac -d bin -classpath lib/algs4.jar src/**/*.java

To execute:

java -cp bin Main

Some of these questions can be found in Algorithms and Data Structures course in Coursera by Princeton University.