Java coding interview question – autocomplete with trie


Video is ready, Click Here to View ×

This tutorial introduces data structure tire and the implementation of autocomplete with trie (Amazon Interview question). To study complete list of coding interview questions and answers, get “Java Coding interview Pocket Book” today!

Download code:
Interview book:

19 thoughts on “Java coding interview question – autocomplete with trie

  1. Thanks a lot mam, really wounderful , i have a DS question for you , please help me ……Have one DS question, need anser.
    Q : we have a city , in which we have locations, each location has few restaurents.
    One ( ex: KFC) restaurent might be in multiple locations( like HiTechcity, Nampally etc).

    To Given restaurent get all its locations, given location display all restaruents in that location.
    What Data Structure use this problem?

  2. This is to answer the question “why List.add(toString()); ? Can you explain that for me please? Thanks” by Gokhan ILHAN. toString() is an override function defined just below the getWords() function. It returns the String that the node represents, for example, if this node represents the character t, whose parent represents the character n, whose parent represents the character a, then the String would be "ant". getWords() is a recursive function. When isEnd is true, it will return the whole string this node are in. Some nodes might be in multiple strings, for example, the node “z” are in “amazon” and “amazing”. So when both reach the end, two strings are added to the list and returned.

Leave a Reply

Your email address will not be published. Required fields are marked *