In case of a dictionary, can we assume that its a Sorted list of words? On Sep 22, 12:42 pm, ramdas kale <[email protected]> wrote: > If we take high = MAX_CAPACITY > > Here MAX_CAPACITY denotes the maximum no of words dictinary can index. > Actual no of words stored in dictionary could be less than MAX_CAPACITY. > > > > On Wed, Sep 22, 2010 at 1:23 AM, Minotauraus <[email protected]> wrote: > > high= const.(10^const) > > > What's const? The point of this isn't that it's a difficult prob to > > solve. Point lies in working with the design to make this close to log > > n. > > > Define what value "const" holds. > > > On Sep 21, 9:12 am, "coolfrog$" <[email protected]> > > wrote: > > > its dictionary means shorted ordered arry. > > > let low = 1; and high= const.(10^const) > > > > Boolean isWord(String word) > > > { while(low <= high) > > > { mid = (low+ high)/2; > > > if(word = getWordAt(mid)) > > > return true; > > > if( word > getWordAt(mid)) > > > { high = mid-1 > > > } > > > else > > > low = mid+1; > > > } > > > > } > > > Its a simple Binary Search Algorithm ... > > > who's complexity is O(log n) times. > > > -- > > You received this message because you are subscribed to the Google Groups > > "Algorithm Geeks" group. > > To post to this group, send email to [email protected]. > > To unsubscribe from this group, send email to > > [email protected]<algogeeks%[email protected]> > > . > > For more options, visit this group at > >http://groups.google.com/group/algogeeks?hl=en. > > -- > Ramdas Kale > +919983526790
-- You received this message because you are subscribed to the Google Groups "Algorithm Geeks" group. To post to this group, send email to [email protected]. To unsubscribe from this group, send email to [email protected]. For more options, visit this group at http://groups.google.com/group/algogeeks?hl=en.
