Skip to content

Basic algorithms implementation with Go programming language

Notifications You must be signed in to change notification settings

outdead/go-algorithms

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

23 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Algorithms in golang

Implementation of basic algorithms and data structures with Go programming language. Tests and benchmarks are included

Data structures

Sort algorithms

Search algorithms

Math

Run benchmarks

To start benchmarks is needed to use the standard utility go test. It allows to execute the following commands:

go test -run=- -bench=. -benchmem
go test -run=- -bench=. -benchmem > benchmarks.txt

Script bench.sh allows to run tests without visiting the directory with the package:

./bench.sh $1 $2

where $1 is the name of the package, for example sort/bubblesort, And $2 an optional value - if it's not specified, the result is written to file benchmarks.txt. If parameter is set, result of execution is output to the console. For example:

./bench.sh sort/heapsort false
./bench.sh sort/heapsort

is equivalent to the following commands:

go test github.com/ganelon13/go-algorithms/sort/heapsort -run=- -bench=. -benchmem
go test github.com/ganelon13/go-algorithms/sort/heapsort -run=- -bench=. -benchmem > sort/heapsort/benchmarks.txt

Under the control of the Windows operating system script bench.sh can be executed provided that the system has a unix terminal emulator installed, for example cygwin. Then the following command format is available from cmd:

echo ./bench.sh sort/bubblesort false | bash

Materials used

https://youtu.be/eqWzZGNO_XM?list=PLrCZzMib1e9pDxHYzmEzMmnMMUK-dz0_7
https://rosettacode.org/wiki/Sorting_algorithms

About

Basic algorithms implementation with Go programming language

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published