(String[] args)
| 80 | public class Trie_Implementation { |
| 81 | |
| 82 | public static void main(String[] args) { |
| 83 | Trie t= new Trie(); //Intialzing our Trie |
| 84 | |
| 85 | t.insert("hacktoberfest"); //Insert a word into our Trie |
| 86 | |
| 87 | boolean isPresent= t.search("hacktoberfest"); //Search if the word is present in our Trie |
| 88 | System.out.println("is hacktoberfest present in our Trie => "+isPresent); //Prints true as the word is exists |
| 89 | |
| 90 | boolean isStartsWith= t.startsWith("hack"); //Checks if any word starts with hack |
| 91 | System.out.println("is there any word in our Trie that starts with hack => "+ isStartsWith); //Prints true |
| 92 | |
| 93 | boolean isPresent2= t.search("hecktoberFest"); |
| 94 | System.out.println("is hecktoberfest present in our Trie => "+ isPresent2); //Printts false since there is no word with hecktoberfest |
| 95 | |
| 96 | t.delete("hacktoberfest"); //Delete the word from our Trie |
| 97 | boolean isPresentAfterDeleting= t.search("hacktoberfest"); |
| 98 | System.out.println("is hacktoberfest present in our Trie => "+ isPresentAfterDeleting); //Prints false as the word has been deleted |
| 99 | |
| 100 | } |
| 101 | } |
nothing calls this directly
no test coverage detected