daily pastebin goal
58%
SHARE
TWEET

Untitled

a guest Nov 8th, 2018 84 Never
Upgrade to PRO!
ENDING IN00days00hours00mins00secs
  1. package others.trie;
  2.  
  3. import others.trie.Trie;
  4. import others.trie.TrieNode;
  5.  
  6. import java.util.ArrayList;
  7.  
  8. public class PrefixSearchByRequests {
  9.   public static void main(String[] args) {
  10.     Trie trie = new Trie();
  11.     trie.add("boo",3);
  12.     trie.add("bool",12);
  13.     trie.add("boolshit",1);
  14.     trie.add("boold",2);
  15.     ArrayList<TrieNode> res = trie.findMostPopular("boo");
  16.     res.forEach(
  17.         n -> {
  18.           System.out.print(n.getWord());
  19.           System.out.print(": ");
  20.           System.out.println(n.getRequests());
  21.         });
  22.   }
  23. }
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top