Algs-4-Golang is Golang port of the Java code in textbook Algorithms, 4th Edition
by Robert Sedgewick and Kevin Wayne.
It uses go module feature, make sure golang version >= 1.13.
Algs-4-Golang has clear structure.
abstract: API(interface) for abstract data structure.impl: Implementation(source code & test cases) of abstract data structure.utils: Useful tools to support test and debug.
Walk through impl, implemented algorithms organized in 6 sub-files corresponding to 6 chapters in Algs4 textbook.
impl/fundamentalsimpl/sortingimpl/searchingimpl/graphsimpl/stringsimpl/context
Test cases in a examples file. Here is a simple usage to test interface Stack stated in abstract/stack.go
go run impl/fundamentals/examples/stack.go LinkedStack < data/tobe.txt
| Abstract Data Structure | Implementation |
|---|---|
| Bag | LinkedBag ResizingArrayBag |
| Stack | LinkedStack ResizeArrayStack |
| Queue | LinkedQueue ResizingArrayQueue |
| Union-find | QuickFindUF QuickUnionUF QuickUnionSizeUF QuickUnionRankUF QuickUnionCompressedUF QuickUnionCompressedUF2 |
| Abstract Data Structure | Implementation |
|---|---|
| Sorter(basic) | Selection Insertion Advanced Insertion Shell |
| Sorter(advanced) | Merge MergeBU Advanced Merge Quick ThreeWayQuick AdvancedQuick Heap |
| Abstract Data Structure | Implementation |
|---|---|
| SortedSymbolTable | BinarySearchST bstST bstST_NotRecursive |
| SymbolTable | SequentialSearchST HashTableST |
| Traverse | PreOrder InOrder PostOrder |