Play Now Login Create Account
illyriad
  New Posts New Posts RSS Feed - Riddle game
  FAQ FAQ  Forum Search   Register Register  Login Login

Topic ClosedRiddle game

 Post Reply Post Reply Page  12>
Author
Manannan View Drop Down
Postmaster
Postmaster
Avatar

Joined: 22 Mar 2011
Location: Mystical Mists
Status: Offline
Points: 576
Direct Link To This Post Topic: Riddle game
    Posted: 28 Mar 2011 at 23:45
do i get a prize? a week in the bahamas would be very nice Cool
Back to Top
HonoredMule View Drop Down
Postmaster General
Postmaster General
Avatar

Joined: 05 Mar 2010
Location: Canada
Status: Offline
Points: 1650
Direct Link To This Post Posted: 28 Mar 2011 at 23:19
Oh, and yes Manannan did post the answer first.  I just thought I'd offer a more literal answer as well. Tongue
Back to Top
HonoredMule View Drop Down
Postmaster General
Postmaster General
Avatar

Joined: 05 Mar 2010
Location: Canada
Status: Offline
Points: 1650
Direct Link To This Post Posted: 28 Mar 2011 at 23:14
You are correct that it is not necessary to 'simplify' the string to numbering repeated characters instead of listing them.  However, that would be a little too obvious a hint.  And, if you were building a database of anagrams (i.e. useful ones not just dictionary search of random word arrangements), you would want to shorten the lookup key as much as possible for both storage savings and search performance.  Including digits from the actual original string would just require using an escape character.  For example, "November 22nd" would map to "bde2mn2ov\22" where \22 means "the character '2' two times."

You are skipping a couple steps, however, which would be quite important if you were actually coding up a solution:
1 - All letters need to be lower case, since 'n' and 'N' are not the same character but anagram searches should be case-insensitive.
2 - All spaces, punctuation, and other non-counted characters have to be removed from the string.
Both of those steps would precede the sorting, since sorting costs O(n log n) time (i.e computing time/cost scales on the order of n*log n times the length of the string, whereas lowercasing and character removal takes O(n) time (cost is linear to the length of the string).  Since removing characters shortens the string, doing the removal first saves work on the sorting.
Back to Top
Hora View Drop Down
Postmaster
Postmaster
Avatar

Joined: 10 May 2010
Status: Offline
Points: 839
Direct Link To This Post Posted: 28 Mar 2011 at 22:39
well, ok, in the hint you sort the letters on alphabetic order, and the o comes twice, and then you compair them two results.
But I actually don't see, where there is the simplification with writing o2 instead of oo. That only makes sense, if you want to save data space instead of time, doesn't it?
I don't think there's that much difference in counting those o's or compairing two o's one after the other...

Was that the solution, or do you wait for some coding?  Wink

Edit: And yeah, it seems I'm outing me a complete nerd now GeekLOL

Edit 2: And actually I think Manannan solved the riddle first, didn't he?


Edited by Hora - 28 Mar 2011 at 22:42
Back to Top
HonoredMule View Drop Down
Postmaster General
Postmaster General
Avatar

Joined: 05 Mar 2010
Location: Canada
Status: Offline
Points: 1650
Direct Link To This Post Posted: 28 Mar 2011 at 22:06
hint: deno2rw
Back to Top
HonoredMule View Drop Down
Postmaster General
Postmaster General
Avatar

Joined: 05 Mar 2010
Location: Canada
Status: Offline
Points: 1650
Direct Link To This Post Posted: 28 Mar 2011 at 18:18
1) de-capitalize 'New'
    new door
2) move the 'd' to the end
    new oord
3) move the first o to the beginning
    onew ord
4) move the space one place to the left
    one word

Programming question:  how do you algorithmically show that the two phrases are anagrams?  (If you know the trick, it's easy--and very efficient.)
Back to Top
Manannan View Drop Down
Postmaster
Postmaster
Avatar

Joined: 22 Mar 2011
Location: Mystical Mists
Status: Offline
Points: 576
Direct Link To This Post Posted: 28 Mar 2011 at 17:37
surely one word is an anagram of new door anyway
Back to Top
Nokigon View Drop Down
Postmaster General
Postmaster General
Avatar
Player Council - Historian

Joined: 07 Nov 2010
Status: Offline
Points: 1452
Direct Link To This Post Posted: 28 Mar 2011 at 17:33
Yeah. So you have Newdoor.
Back to Top
James Russell View Drop Down
Greenhorn
Greenhorn
Avatar

Joined: 22 Mar 2011
Location: England
Status: Offline
Points: 50
Direct Link To This Post Posted: 28 Mar 2011 at 17:32
Originally posted by Nokigon Nokigon wrote:

By getting rid of the space?
Yes combining it to make a word...
Back to Top
Nokigon View Drop Down
Postmaster General
Postmaster General
Avatar
Player Council - Historian

Joined: 07 Nov 2010
Status: Offline
Points: 1452
Direct Link To This Post Posted: 28 Mar 2011 at 17:31
By getting rid of the space?
Back to Top
 Post Reply Post Reply Page  12>
  Share Topic   

Forum Jump Forum Permissions View Drop Down

Forum Software by Web Wiz Forums® version 12.03
Copyright ©2001-2019 Web Wiz Ltd.