Skip to content

danielandefors/data-structures-java

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

63 Commits
 
 
 
 
 
 
 
 

Repository files navigation

Data Structures (and Algorithms) in Java

... and other stuff that I've created for fun (mostly).

Data Structures

Notable data structures.

  • AVL Tree
  • Red Black Tree
  • Hash Table
  • Heaps, stacks, and queues

Graphs

Are fun.

// Create a directed graph
DiGraph g = AdjacencyList.createDiGraph(8);

// Insert edges
g.insert(1, 2);
g.insert(1, 5);
g.insert(2, 3);
g.insert(2, 4);
g.insert(3, 4);
g.insert(3, 7);
g.insert(4, 5);
g.insert(4, 6);
g.insert(5, 6);
g.insert(6, 7);

// Check if the graph has any cycles
assertTrue(g.acyclic());

// Get the topological order
int[] order = g.getTopologicalOrder();
assertArrayEquals(new int[] { 1, 2, 3, 4, 5, 6, 7, 0 }, order);

About

Data Structures and Algorithms in Java

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages