could u explain how would you use a trie for this?? On Thursday, June 14, 2012 1:01:00 PM UTC+5:30, Mohit Rathi wrote: > > Hi, > > *There are two arrays of length 100 each. Each of these has initially n > (n<=100) > elements. First array contains names and the second array contains numbers > such that ith name in array1 corresponds to ith number in array2. > Write a program which asks the user to enter a name, finds it in array1,* > > *a. if it exists, then print the corresponding number in array2, > b. else ask the user to input its associated number and add the number and > name to array2 and array1 respectively, and update the size of list* > > I can think of solving it through linear walk to the array. Anyone with > more optimized algorithm like BST or HashTable? > > comments are welcome > > > Thanks > >
-- You received this message because you are subscribed to the Google Groups "Algorithm Geeks" group. To view this discussion on the web visit https://groups.google.com/d/msg/algogeeks/-/-BW4cpALLgIJ. To post to this group, send email to algogeeks@googlegroups.com. To unsubscribe from this group, send email to algogeeks+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/algogeeks?hl=en.