A personal learning record.
All algorithms are Implemented in GO.
http://www.algorithmsilluminated.org/
go run cmd/closest_pair/closest_pair.go
shows
5.0990195135927845
go run cmd/sort/quick_sort.go
shows
Testcase 1:
25 comparisons (choose first as pivot)
31 comparisons (choose last as pivot)
24 comparisons (median of 3)
22 comparisons (random pivot)
Testcase 2:
620 comparisons (choose first as pivot)
573 comparisons (choose last as pivot)
507 comparisons (median of 3)
649 comparisons (random pivot)
go run cmd/random_selection/random_selection.go
shows
5469
4715
go run cmd/deterministic_selection/deterministic_selection.go
shows
5469
4715
go run cmd/scc/scc.go
shows top 5 SCC size
[3 3 3 0 0]
[3 3 2 0 0]
[3 3 1 1 0]
[7 1 0 0 0]
[6 3 2 1 0]
go run cmd/test_heap/test_heap.go
shows a sorted order
1
3
4
5
7
10
100
go run cmd/dijkstra_shortest_path/dijkstra_shortest_path.go
shows the shortest-path distances from vertex 1 to every other vertex
vertices: 1, shortest path: 0
vertices: 2, shortest path: 1
vertices: 3, shortest path: 2
vertices: 4, shortest path: 3
vertices: 5, shortest path: 4
vertices: 6, shortest path: 4
vertices: 7, shortest path: 3
vertices: 8, shortest path: 2
go run .\cmd\median_maintenance\median_maintenace.go
shows the last digits of all kth medians (one by one compute the median of array)
9335 (from 29335)
2408 (from 46842408)