Giter VIP home page Giter VIP logo

Comments (5)

mission-peace avatar mission-peace commented on May 13, 2024

I will look at it. I think there is error in validation function. Do you see infinite loop in some reasonable size string which can be debugged?

 On Sunday, October 25, 2015 1:46 PM, mfazeen <[email protected]> wrote:

Hi,You have done a wonderful job in the implementation. However, when I try to insert a large String (I can provide the test string) It throws the following exception. It never completed inserting the full string.Exception in thread "main" java.lang.NullPointerException
at SuffixTree.nextChar(SuffixTree.java:426)
at SuffixTree.startPhase(SuffixTree.java:322)
at SuffixTree.build(SuffixTree.java:143)
at SuffixTree.main(SuffixTree.java:101)The string i was trying to insert was 63027 in length. However, another large string with a length of 63067 inserted without and error (I can provide this test string as well). However, the second large string failed at your validation function;Failed at 58 for index 56
Failed validation
falseI was trying to debug it but couldn't track it down. Wanted to bring it to your attention. Thanks.—
Reply to this email directly or view it on GitHub.

from interview.

mfazeen avatar mfazeen commented on May 13, 2024

Hi,
Thank you for your prompt reply. The NullPointerException is thrown even before it gets to the validation function. It did not load the complete string to the tree.

The exception is generated when the nextChar(int i) function try to access the start value of the activeNode child at the line:

return input[active.activeNode.child[input[active.activeEdge]].start + active.activeLength];

(last return statement in the else block in the nextChar function)

At this line the "active.activeNode.child[input[active.activeEdge]]" is null for sum reason and that failed the tree creation.
I.e. the activeNode child at the input[active.activeEdge] location is null for some reason. I assume that either this child is not created correctly in a previous step or the index of the child is incorrect. Hope this will help you.

I did not see any infinite loops though.
Thanks

from interview.

mission-peace avatar mission-peace commented on May 13, 2024

I meant do you have a smaller example where you get NPE instead of this 63K long string.

from interview.

mfazeen avatar mfazeen commented on May 13, 2024

Sorry, I did not get any NPE with smaller strings that I tried with. If I come across one I will let you know.

from interview.

mission-peace avatar mission-peace commented on May 13, 2024

fixed some bugs. Probably that will fix this issue.

from interview.

Related Issues (20)

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.