Given an English word in the form of a string, how can you quickly
find all valid
anagrams for that string (all valid rearrangements of the letters that
form valid
English words)?
--
*Piyush Sinha*
*IIIT, Allahabad*
*+91-8792136657*
*+91-7483122727*
Use BFS?
On Tue, May 17, 2011 at 11:36 AM, Piyush Sinha ecstasy.piy...@gmail.comwrote:
Given an English word in the form of a string, how can you quickly
find all valid
anagrams for that string (all valid rearrangements of the letters that
form valid
English words)?
--
*Piyush Sinha*
*like dislike mathamatical quiz solution* *
* *I like the number 5, but not 6. I like 32, but not 33. I like 41, but not
42.*
*Which of the following numbers does I like and not like?
50
39
23
14
16
*
*Update Your Answers at* : Click
Like: 50, 23, 14. Dislike: 39, 16.
Dave
On May 17, 2:29 am, Lavesh Rawat lavesh.ra...@gmail.com wrote:
*like dislike mathamatical quiz solution* *
* *I like the number 5, but not 6. I like 32, but not 33. I like 41, but not
42.*
*Which of the following numbers does I like and not like?
50
digits with sum of 5 .
On Tue, May 17, 2011 at 5:07 PM, Dave dave_and_da...@juno.com wrote:
Like: 50, 23, 14. Dislike: 39, 16.
Dave
On May 17, 2:29 am, Lavesh Rawat lavesh.ra...@gmail.com wrote:
*like dislike mathamatical quiz solution* *
* *I like the number 5, but not 6. I like 32,
@Ankit
Wht about updating the nodes when a value has been added to the
bin ??
The left over space has to be modified n so is the tree.
On May 17, 1:17 pm, ankit sambyal ankitsamb...@gmail.com wrote:
Hey Guys, here is my solution :
we can use AVL trees for this. We will use the left over space
guys why cant we simply sort bins using merge sort or any comparison
sort and then use binary search to find out the first available
bin.t(n)=O(nlgn)+n*(lgn)=O(nlgn).
--
You received this message because you are subscribed to the Google Groups
Algorithm Geeks group.
To post to this group, send
@monsieur: we can't solve the problem by the way u suggest because we have
to sort it by bin number but we have to find the first fit according to the
left over space in the bin. So, in the worst case it will take more than
O(n*log(n))time If u need any clarifications feel free to comment
@ila: When a value has been added to the bin, its value will definitely
change.
First we have to delete the previous bin from the AVL tree and then we have
to insert that bin into the AVL tree with the updated value. If u need any
more clarifications, plz feel free to comment.
Regards,
Ankit
Dear Folks,
Wishes for the Day,
We need consultant for *BI Business /Systems Analyst*
please share suitable profiles to prak...@panzersolutions.com
*Job title : BI Business /Systems Analyst*
*Location :New Haven, CT*
*Duration :6+ months*
*Rate :$50/Hr*
Project
For any given word.
- Find the lexicographic ordering and calculate it hash.
- Find all permutation of the string
- Check each permutation if it's a valid word
- if so store it at the same hash index.
On Tue, May 17, 2011 at 7:16 AM, Ashish Goel ashg...@gmail.com wrote:
hash..
Best Regards
Ohh..If it is so...Sorry !![?] I understood it the different way...[?]
But if the question is as mentioned in your 2nd case then also I believe
there is O(n) solution.[?]
Maintain
two pointers: *START* and *END*
two variables: max1 and max2
Assume arr[MAX_SIZE] to be the array containing
Dear Folks,
Wishes for the Day,
We need consultant for * .Net developer*
please share suitable profiles to *prak...@panzersolutions.com*
*Job title :.Net developer
Location :Midtown Manhattan, NY
Duration :1 Year
Rate :Market*
*NOTE: Financial industry experiance
Nice explanation Dave..Thnx for the extra info !!
On Tue, May 17, 2011 at 11:00 AM, Piyush Sinha ecstasy.piy...@gmail.comwrote:
thanks Dave :)
This is a standard Google question
On 5/17/11, Dave dave_and_da...@juno.com wrote:
@Piyush. The simplest algorithm is to sort the array
Sort the characters in the string. Go through the dictionary sorting the
characters in each word in turn. Print the words whose sorted versions
match the sorted string.
You can quickly print all equivalence classes of anagrams in the dictionary
by hashing with the sorted strings as keys. It
given a number n, compute the smallest prime that is bigger than n.
for example, n=8, then the smallest prime that bigger than 8 is 11.
i wonder whether there is an effective way, rather than check every number
bigger than n one by one.
thanks.
--
You received this message because you are
@Wujin: Well, obviously, you don't have to check _every_ number one-by-
one. If n 1, you can ignore every even number. Furthermore, if n
3, you can ignore every odd multiple of 3. That means that you need to
check only numbers of the form 6*n - 1 and 6*n + 1.
Dave
On May 17, 9:09 pm, wujin
@Dave, thanks for your reply.
i know that, i can only check from 6*n - 1 and 6*n + 1..
assume that, n=1 , and we begin from k=1667, the number needed to check
is 10001,10003
but to determin 10001 is prime or not costs a lot, right?
when the n is huge, it will be not feasible.
is there
Same method as Gene told.
Only enhancement u can made is start from the word nearer to sorted string
and compare till the nearest word of the reverse of sorted string.
You don't need to check the whole dictionary.
Anuj Agarwal
Engineering is the art of making what you want from things you can
19 matches
Mail list logo