gsv

package module
Version: v0.12.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Oct 18, 2017 License: MIT Imports: 9 Imported by: 0

README

GolangSortingVisualization

Codacy Badge Coverage Status Build Status Go Report Card codebeat badge

this sorting visualization is not intended to recommend any algorithm, if you need a recommendation go somewhere else.

if you like, feel free to add more Sorting Algorithm examples. Many thanks to all contributors.

Sorting Algorithms

BogoSort

Bogo Sort Animation

BubbleSort

Bubble Sort Animation

CocktailSort

Cocktail Sort Animation

CombSort

Comb Sort Animation

CountingSort

Counting Sort Animation

CycleSort

Cycle Sort Animation

GnomeSort

Gnome Sort Animation

HeapSort

Heap Sort Animation

InsertionSort

Insertion Sort Animation

MergeSort

Merge Sort Animation

OddEvenSort

OddEven Sort Animation

PancakeSort

Pancake Sort Animation

QuickSort

Quick Sort Animation

ShellSort

Shell Sort Animation

SelectionSort

Selection Sort Animation

StoogeSort

Stooge Sort Animation

HowTo

./start.sh
$ go run gsv.go --help
Usage of gsv:
  -algo="bubble": Select sorting algorithm all/bogo/[bubble]/comb/counting/gnome/insertion/oddEven/selection/sleep
  -count=30: number of values
  -fps=10: frames per second
  -max=9: highest value
  -mode=1: visualization mode
  -vis="stdout": Select output: [stdout]/gif

License

MIT

Documentation

Index

Constants

This section is empty.

Variables

View Source
var Count int
View Source
var Fps int
View Source
var Max int
View Source
var Mode int

Functions

func BogoSort

func BogoSort(arr []int, frameGen FrameGen)

BogoSort is an implementation of https://en.wikipedia.org/wiki/Bogosort

func BubbleSort

func BubbleSort(arr []int, frameGen FrameGen)

BubbleSort is an implementation of https://en.wikipedia.org/wiki/Bubble_sort

func CocktailSort

func CocktailSort(arr []int, frameGen FrameGen)

CocktailSort is an implementation of https://en.wikipedia.org/wiki/Cocktail_shaker_sort

func CombSort

func CombSort(arr []int, frameGen FrameGen)

CombSort is an implementation of https://en.wikipedia.org/wiki/Comb_sort

func CountingSort

func CountingSort(arr []int, frameGen FrameGen)

CountingSort is an implementation of https://en.wikipedia.org/wiki/Counting_sort

func CycleSort added in v0.11.0

func CycleSort(arr []int, frameGen FrameGen)

CycleSort is an implementation of https://en.wikipedia.org/wiki/Cycle_sort

func GnomeSort

func GnomeSort(arr []int, frameGen FrameGen)

GnomeSort is an implementation of https://en.wikipedia.org/wiki/Gnome_sort

func HeapSort added in v0.10.0

func HeapSort(arr []int, frameGen FrameGen)

HeapSort https://en.wikipedia.org/wiki/Heapsort

func InsertionSort

func InsertionSort(arr []int, frameGen FrameGen)

InsertionSort is an implementation of https://en.wikipedia.org/wiki/Insertion_sort

func MergeSort added in v0.9.1

func MergeSort(arr []int, frameGen FrameGen)

MergeSort is an implementation of https://en.wikipedia.org/wiki/Merge_sort

func OddEvenSort

func OddEvenSort(arr []int, frameGen FrameGen)

OddEvenSort is an implementation of https://en.wikipedia.org/wiki/Odd–even_sort

func PancakeSort added in v0.12.0

func PancakeSort(arr []int, frameGen FrameGen)

PancakeSort is an implementation of https://en.wikipedia.org/wiki/Pancake_sorting

func QuickSort added in v0.9.1

func QuickSort(arr []int, frameGen FrameGen)

QuickSort is an implementation of https://en.wikipedia.org/wiki/Quicksort

func SelectionSort

func SelectionSort(arr []int, frameGen FrameGen)

SelectionSort is an implementation of https://en.wikipedia.org/wiki/Selection_sort

func ShellSort added in v0.10.0

func ShellSort(arr []int, frameGen FrameGen)

ShellSort is an implementation of https://en.wikipedia.org/wiki/Shellsort

func SleepSort

func SleepSort(arr []int, frameGen FrameGen)

SleepSort is an implementation of the SleepSort Algorithm - NOT ON WIKIPEDIA

func StoogeSort

func StoogeSort(arr []int, frameGen FrameGen)

StoogeSort is an implementation of https://en.wikipedia.org/wiki/Stooge_sort

func WriteGif

func WriteGif(name string, g *gif.GIF)

func WriteStdout

func WriteStdout(arr []int)

Types

type FrameGen

type FrameGen func([]int)

func (FrameGen) AddFrame

func (fg FrameGen) AddFrame(arr []int)

func (FrameGen) Complete

func (fg FrameGen) Complete()

func (FrameGen) Setup

func (fg FrameGen) Setup(name string)

type GifVisualizer

type GifVisualizer struct {
	// contains filtered or unexported fields
}

func (*GifVisualizer) AddFrame

func (gv *GifVisualizer) AddFrame(arr []int)

func (*GifVisualizer) Complete

func (gv *GifVisualizer) Complete()

func (*GifVisualizer) Setup

func (gv *GifVisualizer) Setup(name string)

type Sorter

type Sorter func([]int, FrameGen)

type Visualizer

type Visualizer interface {
	Setup(string)
	AddFrame([]int)
	Complete()
}

Source Files

Directories

Path Synopsis

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
t or T : Toggle theme light dark auto
y or Y : Canonical URL