-2

I want to store some elements in TreeMap or TreeSet and when user insert an alphabet based on that first word starts from that alphabet should be returned.

How to retrieve words based on user inputting letter from a TreeSet or TreeMap efficiently without delay?

Alex K
  • 22,315
  • 19
  • 108
  • 236
Mujthaba Ibrahim
  • 207
  • 3
  • 16
  • 1
    What do you mean by "without delay"? and could you please post an example of you requirement? Also: please show the code you have so far. – Timothy Truckle Nov 24 '16 at 17:50
  • without delay means , avoid multiple checking code must efficient and optimized – Mujthaba Ibrahim Nov 26 '16 at 08:23
  • my requirement is if i have file with the a sentence like "axn apple banana auto cat bull tree song jack dad mom rocket" and if user enter a letter if that letter is 'a' my program should return " apple auto axn " order must be in ascending – Mujthaba Ibrahim Nov 26 '16 at 08:27

1 Answers1

0

Sounds like you might want to look into a Trie or Prefix-tree data structure

Jerry Sha
  • 3,931
  • 2
  • 23
  • 16