java-ds-algorithms icon indicating copy to clipboard operation
java-ds-algorithms copied to clipboard

Data Structures and Algorithms in Java

Data Structures and Algorithms in Java

Build Status Test Coverage

Trying out various DS and Algorithms for learning purposes and to refresh my Java skills.

All with their corresponding tests. Go to tests root directory

Data Structures:

  • Prefix Tree (Trie)
  • Singly Linked List
  • Stack
  • Queue
  • Dynamic Array
  • Multi Stack in Array
  • HashTable
  • Binary Search Tree
  • Undirected Graph
  • Priority Queue using min-heap

Algorithms:

Trees

  • Build a minimum height tree from an unsorted/sorted array
  • Build list of lists that each contain the tree nodes per height level
  • Check if tree is BST
  • Find the in-order successor of a node in a tree
  • Recursively calculate height and balance of tree in one pass
  • Autocomplete a word using a Trie

Arrays

  • In-place matrix rotation
  • Nullify rows and columns in matrix

Stacks and Queues

  • Find minimum value in Stack
  • Stack of Stacks
  • Queue via Stacks
  • Sort stack by using another stack

Sorting

  • Quick Sort
  • Merge Sort
  • Bubble Sort

Strings

  • String has unique characters
  • Check if string is permutation of another
  • URLify string
  • Reverse string
  • Check if string is permutation of a palindrome
  • Check if string is palindrome
  • String sanitizer
  • Check if strings have more than one edit
  • Basic string compression

Linked Lists

  • Remove duplicate values
  • Find a the start of a loop in a linked list
  • Find Kth to last element (unknown list size)
  • Partition list in place
  • Check if list is palindrome
  • Find intersection of two lists