Skip to content

Commit 7762f6a

Browse files
committed
fix: add use case
1 parent 055cb68 commit 7762f6a

File tree

3 files changed

+15
-2
lines changed

3 files changed

+15
-2
lines changed

Skip-List/SkipList.playground/Contents.swift

+13
Original file line numberDiff line numberDiff line change
@@ -5,3 +5,16 @@ print("Hello, Swift 4!")
55

66
// SkipList is ready for Swift 4.
77
// TODO: Add Test
8+
9+
let k = SkipList<Int, String>()
10+
k.insert(key: 10, data: "10")
11+
k.insert(key: 12, data: "12")
12+
k.insert(key: 13, data: "13")
13+
k.insert(key: 20, data: "20")
14+
k.insert(key: 24, data: "24")
15+
16+
if let value = k.get(key: 20) {
17+
print(value)
18+
} else {
19+
print("not found!")
20+
}

Skip-List/SkipList.playground/Sources/SkipList.swift

+1-1
Original file line numberDiff line numberDiff line change
@@ -212,7 +212,7 @@ extension SkipList {
212212
}
213213
}
214214

215-
func insert(key: Key, data: Payload) {
215+
public func insert(key: Key, data: Payload) {
216216
if head != nil {
217217
if let node = findNode(key: key) {
218218
// replace, in case of key already exists.

Skip-List/SkipList.swift

+1-1
Original file line numberDiff line numberDiff line change
@@ -212,7 +212,7 @@ extension SkipList {
212212
}
213213
}
214214

215-
func insert(key: Key, data: Payload) {
215+
public func insert(key: Key, data: Payload) {
216216
if head != nil {
217217
if let node = findNode(key: key) {
218218
// replace, in case of key already exists.

0 commit comments

Comments
 (0)