Skip to content

Commit 1547e46

Browse files
committed
Initial commit
0 parents  commit 1547e46

File tree

5 files changed

+41
-0
lines changed

5 files changed

+41
-0
lines changed

README.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
# ソートアルゴリズム
2+
3+
恥ずかしいけれど、知らない
4+
5+
- [Bubble sort](./bubble)
6+
- [Go](./bubble/bubble.go)

bubble/README.md

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
# Bubble sort
2+
3+
- https://en.wikipedia.org/wiki/Bubble_sort
4+
5+
# 概要
6+
7+
- となりあう2つの要素を比較し続けて、最後尾(あるいは先頭)を決定する
8+
9+
# 実装
10+
11+
- [Go言語](./bubble.go)

bubble/bubble.go/bubble.go

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
package bubble
2+
3+
// Sort implement bubble-sort algorithm.
4+
func Sort(arr []int) []int {
5+
return arr
6+
}

bubble/bubble.go/bubble_test.go

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
package bubble
2+
3+
import (
4+
"testing"
5+
6+
"github.com/hazukac/sort/utils/utils.go"
7+
. "github.com/otiai10/mint"
8+
)
9+
10+
func TestSort(t *testing.T) {
11+
Expect(t, utils.GetRandomArray(10)).ToBe([]int{1, 2, 3, 4, 5})
12+
}

utils/utils.go/utils.go

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
package utils
2+
3+
// GetRandomArray ...
4+
func GetRandomArray(length int) []int {
5+
return []int{6, 3, 2, 4, 1} // TODO: refactor
6+
}

0 commit comments

Comments
 (0)