Skip to content

leninmehedy/java-algorithms

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

69 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Algorithms in Java

This repository contains various algorithm and data structure implementations in Java 8.

Steps

For any given problem follow the steps bellow as you would do in professional settings:

  • Examples: Ask for examples
  • Clarify: Ask questions to clarify input-output and constraints
  • First Solution: Find a brute-force solution and estimate time/space complexity
  • Iterate: Iterate to find improvements and their time/space complexity
  • Approval: Ask if the solution is OK to proceed with
  • Test cases: Think about test cases: Edge cases, Base cases and Regular cases
  • Code: Write the solution. Feel free to add comments in the code. Make it as neat and clean as possible.
  • Verify: verify your code using the tests cases.

Here is the list of algorithm problems and implementations:

Arrays and Strings I

Subarray Problems

Binary Search

Recursion & Backtracking

  • Memoization
  • Auxiliary Buffers
  • Backtracking

Linked List

Stack

  • Stacks as restriction
  • Stack with max
  • Expression and evaluation

Queue

  • Sliding window
  • Queue with Max
  • Dynamic Programming

Arrays and Strings II

  • Max diff
  • 2D arrays

Arrays and Strings III

  • Add/Multiply
  • Special Tricks

Hashtable

  • Hash Table and Hash
  • Hash functions
  • String search

Graph I

Linesweep

  • Skyline problem

Heaps

Sorting

  • Selection algorithm
  • Merge sort
  • Quick sort
  • Stability and large data
  • Special tricks

Bit manipulation

  • Find even occurrences in an array with odd numbers

Graph II

  • Detecting cycles
  • Bipartite Graph
  • Connected Components

Binary Trees

Binary Search Tree

Majority Search

  • Search n/2 majority
  • Search n/k majority

About

Various algorithms in Java

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages