Git Product home page Git Product logo

critbit's People

Contributors

gilramir avatar

Watchers

 avatar

critbit's Issues

Insert() panics after Delete()

Insert() panics after Delete()

Example Code

package main

import (
        "github.com/gilramir/critbit"
        "log"
)

func main() {
        log.SetFlags(0)
        trie := critbit.New(128)
        for i, key := range []string{
                "red",
                "blue",
                "green",
                "yellow",
        } {
                log.Println(key)
                trie.Insert(key, 1)
                if i == 2 {
                        trie.Delete(key)
                }
        }
}

Output

red
blue
green
yellow
panic: interface conversion: interface is int64, not uint32

goroutine 1 [running]:
panic(0x811da00, 0x184153a0)
        /usr/lib/go-1.7/src/runtime/panic.go:500 +0x331
tt/vendor/github.com/gilramir/critbit.(*Critbit).addExternalRef(0x18447f74, 0x8132f90, 0x6, 0x81184a0, 0x18410ae0, 0x0, 0x0, 0x0)
        /home/<...>/go/src/tt/vendor/github.com/gilramir/critbit/tree.go:31 +0x1c5
tt/vendor/github.com/gilramir/critbit.(*Critbit).Insert(0x18447f74, 0x8132f90, 0x6, 0x81184a0, 0x18410ae0, 0x18473001, 0x0, 0x0)
        /home/<...>/go/src/tt/vendor/github.com/gilramir/critbit/insert.go:54 +0x384
main.main()
        /home/<...>/go/src/tt/t.go:24 +0x293

Expected Output

red
blue
green
yellow

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.