MCPcopy Create free account
hub / github.com/PrajaktaSathe/Java / main

Method main

Programs/Trie_Implementation.java:82–100  ·  view source on GitHub ↗
(String[] args)

Source from the content-addressed store, hash-verified

80public 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}

Callers

nothing calls this directly

Calls 4

insertMethod · 0.95
searchMethod · 0.95
startsWithMethod · 0.95
deleteMethod · 0.95

Tested by

no test coverage detected