/classical-algorithm

Classical algorithms Implemented in Java

Primary LanguageJava

Classical Algorithms Implemented in Java

Introduction

This repository contains demo implementations of several classical algorithms in Java.

Table of Contents

  • Sorting
  • Hash Table
  • Tree & Graph
  • Binary Search Tree (Regular)
  • Trie
  • 0-1 Knapsack

Sorting

  • Folder: sorting
  • Description: Bubble Sort, Selection Sort, Insertion Sort, Quick Sort, Merge Sort, Heap Sort
  • Test Codes: Main.java

Hash Table

  • Folder: hashtable
  • Description: Demo implementation of a hash table using arrays
  • Major Operations: add a new item, get an existing item, remove an existing item
  • Test Codes: Main.java

Tree & Graph

  • Folder: tree-graph
  • Description: Demo implementation of trees (binary and N-ary) and graphs using adjacency list
  • Major Operations: Binary Tree (preorder/inorder/postorder tree walk), N-ary Tree (postorder/DFS/BFS tree walk), Graph (DFS/BFS traversal, graph reversal)
  • Test Codes: Main.java

Binary Search Tree (Regular)

  • Folder: bst
  • Description: Demo implementation of regular binary search tree
  • Major Operations: existence check, add a new item, remove an existing item, successor, predecessor, inorder tree walk
  • Test Codes: Main.java

Trie

  • Folder: trie
  • Description: Demo implementation of a trie
  • Major Operations: add a new word, find a word, remove a word, trie traversal
  • Test Codes: Main.java

0-1 Knapsack

  • Folder: knapsack
  • Description: Solution ot 0-1 knapsack problem
  • Test Codes: Main.java