• Steve Jones - SSC Editor (4/24/2016)


    Interesting. I'll have to play with this. No time now, but I've done some Python, and have been working with the SDTIG on their Python series. I've gotten behind, but they had an interesting machine learning segment, with the last meeting this Wed.

    http://www.meetup.com/San-Diego-Technology-Immersion-Group-SDTIG/

    I think I'd do something similar to your approach. String slicing makes sense, though probably not super fast.

    Do you mean slow in terms of lots of input rows, wide strings, or both?

    This is slow because the bigger the phone book, the longer it takes so to speak. I need a better approach that scales to meet the 10 second minimum requirement. The attached data actually completes within 12 seconds on my machine. It's not that slow, but not fast enough. The below recommendation is one way to tackle the problem.

    The recommended approach is by doing a Treap. This is similar to a binary search tree, but a self-balancing binary search tree. I've seen examples in C++, but not too much in Python without modules. Trying to do this without a module. Guess I can manually do it.

    Treap