If sort returned the array the code would look even simpler. Don't really understand why this function is by reference. Anyway I was thinking about the size of the DB more than anything else.
Originally Posted by NogDog
Also the scrabble thing needs to output a group of words for each intersection. So 7 tiles + a, through to z, and then we could find places on the board the letters could be useful.
Right now I'd probably vote for your suggestion of just sorting the letters and storing them as being a more optimal solution, since the code that populates the DB is a one-shot deal that does not need to be particularly optimized. However, the slight gain in disk space would generally be of negligible importance in today's world of terabyte disks, so I'm not going to worry enough about it now to change an existing system that works.
It's probably a good example on how we all can get fixated on a given technology and then apply it without considering if it's really the best solution for a given problem. (Anyone besides me old enough to remember when the US DoD decided all software should be written in Ada?)
"Please give us a simple answer, so that we don't have to think, because if we think, we might find answers that don't fit the way we want the world to be."
~ Terry Pratchett in Nation
How to Ask Questions the Smart Way
(not affiliated with this site, but well worth reading)
Users Browsing this Thread
There are currently 1 users browsing this thread. (0 members and 1 guests)