Skip to content

Commit

Permalink
fix: add use case
Browse files Browse the repository at this point in the history
  • Loading branch information
passerbyloo committed Nov 29, 2019
1 parent 055cb68 commit 7762f6a
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 2 deletions.
13 changes: 13 additions & 0 deletions Skip-List/SkipList.playground/Contents.swift
Original file line number Diff line number Diff line change
Expand Up @@ -5,3 +5,16 @@ print("Hello, Swift 4!")

// SkipList is ready for Swift 4.
// TODO: Add Test

let k = SkipList<Int, String>()
k.insert(key: 10, data: "10")
k.insert(key: 12, data: "12")
k.insert(key: 13, data: "13")
k.insert(key: 20, data: "20")
k.insert(key: 24, data: "24")

if let value = k.get(key: 20) {
print(value)
} else {
print("not found!")
}
2 changes: 1 addition & 1 deletion Skip-List/SkipList.playground/Sources/SkipList.swift
Original file line number Diff line number Diff line change
Expand Up @@ -212,7 +212,7 @@ extension SkipList {
}
}

func insert(key: Key, data: Payload) {
public func insert(key: Key, data: Payload) {
if head != nil {
if let node = findNode(key: key) {
// replace, in case of key already exists.
Expand Down
2 changes: 1 addition & 1 deletion Skip-List/SkipList.swift
Original file line number Diff line number Diff line change
Expand Up @@ -212,7 +212,7 @@ extension SkipList {
}
}

func insert(key: Key, data: Payload) {
public func insert(key: Key, data: Payload) {
if head != nil {
if let node = findNode(key: key) {
// replace, in case of key already exists.
Expand Down

0 comments on commit 7762f6a

Please sign in to comment.