Skip to content

Commit d7a0969

Browse files
committed
reformat import order
1 parent f43e13e commit d7a0969

File tree

6 files changed

+12
-10
lines changed

6 files changed

+12
-10
lines changed

03-Stacks-and-Queues/05-Array-Queue/solution/solution.go

+4-4
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@ func (a *Array) IsEmpty() bool {
5050
// 在第 index 个位置插入一个新元素 e
5151
func (a *Array) Add(index int, e interface{}) {
5252
if index < 0 || index > a.size {
53-
panic("Add failed. Require index >= 0 and index <= size.")
53+
panic("add failed, index is out of range")
5454
}
5555

5656
if a.size == len(a.data) {
@@ -78,7 +78,7 @@ func (a *Array) AddFirst(e interface{}) {
7878
// 获取 index 索引位置的元素
7979
func (a *Array) Get(index int) interface{} {
8080
if index < 0 || index >= a.size {
81-
panic("Get failed. Index is illegal.")
81+
panic("get failed, index is out of range")
8282
}
8383
return a.data[index]
8484
}
@@ -94,7 +94,7 @@ func (a *Array) GetFirst() interface{} {
9494
// 修改 index 索引位置的元素
9595
func (a *Array) Set(index int, e interface{}) {
9696
if index < 0 || index >= a.size {
97-
panic("Set failed. Index is illegal.")
97+
panic("set failed, index is out of range")
9898
}
9999
a.data[index] = e
100100
}
@@ -132,7 +132,7 @@ func (a *Array) FindAll(e interface{}) (indexes []int) {
132132
// 从数组中删除 index 位置的元素,返回删除的元素
133133
func (a *Array) Remove(index int) interface{} {
134134
if index < 0 || index >= a.size {
135-
panic("Remove failed,Index is illegal.")
135+
panic("remove failed, index is out range")
136136
}
137137

138138
e := a.data[index]

03-Stacks-and-Queues/Optional-02-Loop-Queue-without-Size-Member/loopqueue/LoopQueue.go 03-Stacks-and-Queues/Optional-02-Loop-Queue-without-Size-Member/loopqueue/loopqueue.go

+2-2
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ type LoopQueue struct {
1212
tail int
1313
}
1414

15-
func Constructor(capacity int) *LoopQueue {
15+
func New(capacity int) *LoopQueue {
1616
return &LoopQueue{
1717
data: make([]interface{}, capacity+1),
1818
}
@@ -106,7 +106,7 @@ func (lq *LoopQueue) String() string {
106106
}
107107

108108
func main() {
109-
queue := Constructor(10)
109+
queue := New(10)
110110
for i := 0; i < 10; i++ {
111111
queue.Enqueue(i)
112112
fmt.Println(queue)

14-Hash-Table/06-Resizing-in-Hash-Table/main.go

+3-2
Original file line numberDiff line numberDiff line change
@@ -2,13 +2,14 @@ package main
22

33
import (
44
"fmt"
5+
"path/filepath"
6+
"time"
7+
58
"github.com/donng/Play-with-Data-Structures/14-Hash-Table/06-Resizing-in-Hash-Table/AVLTree"
69
"github.com/donng/Play-with-Data-Structures/14-Hash-Table/06-Resizing-in-Hash-Table/BSTMap"
710
"github.com/donng/Play-with-Data-Structures/14-Hash-Table/06-Resizing-in-Hash-Table/RBTree"
811
"github.com/donng/Play-with-Data-Structures/14-Hash-Table/06-Resizing-in-Hash-Table/hashtable"
912
"github.com/donng/Play-with-Data-Structures/utils"
10-
"path/filepath"
11-
"time"
1213
)
1314

1415
func main() {

14-Hash-Table/07-More-About-Resizing-in-Hash-Table/main.go

+3-2
Original file line numberDiff line numberDiff line change
@@ -2,13 +2,14 @@ package main
22

33
import (
44
"fmt"
5+
"path/filepath"
6+
"time"
7+
58
"github.com/donng/Play-with-Data-Structures/14-Hash-Table/07-More-About-Resizing-in-Hash-Table/AVLTree"
69
"github.com/donng/Play-with-Data-Structures/14-Hash-Table/07-More-About-Resizing-in-Hash-Table/BSTMap"
710
"github.com/donng/Play-with-Data-Structures/14-Hash-Table/07-More-About-Resizing-in-Hash-Table/HashTable"
811
"github.com/donng/Play-with-Data-Structures/14-Hash-Table/07-More-About-Resizing-in-Hash-Table/RBTree"
912
"github.com/donng/Play-with-Data-Structures/utils"
10-
"path/filepath"
11-
"time"
1213
)
1314

1415
func main() {

0 commit comments

Comments
 (0)