8000 Merge pull request #906 from passerbyloo/master · Gengpp/swift-algorithm-club@83aa652 · GitHub
[go: up one dir, main page]

Skip to content
  • Commit 83aa652

    Browse files
    authored
    Merge pull request kodecocodes#906 from passerbyloo/master
    fix: add use case
    2 parents f3de99a + 7762f6a commit 83aa652

    File tree

    3 files changed

    +15
    -2
    lines changed

    3 files changed

    +15
    -2
    lines changed

    Skip-List/SkipList.playground/Contents.swift

    Lines changed: 13 additions & 0 deletions
    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

    Lines changed: 1 addition & 1 deletion
    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

    Lines changed: 1 addition & 1 deletion
    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)
    0