Thread: C programming
View Single Post
Old 11-21-05, 01:19 PM   #7
Nerd, Geek, Freak
wnd's Avatar
Join Date: Sep 2005
Location: Finland
Posts: 703
Default Re: C programming

If you really want to pack the stuff in an array as small as possible concider not wasting one bit per number (as numbers [10, 100] = [0, 90] can be presented with seven bits). This way it is trivial to spend only 17 octets (or 8-bit bytes) for storing those 19 numbers you have to.

IMO your assignment would have made more sense (while still being trivial) if the input would've been large (like 10^9 numbers) and you would be to optimize performance instead.
web | cat

Christianity, noun: The belief that a cosmic Jewish Zombie who was his own father can make you live forever if you symbolically eat his flesh and telepathically tell him you accept him as your master, so he can remove an evil force from your soul that is present in humanity because a rib-woman was convinced by a talking snake to eat from a magical tree. [mad.frog]
wnd is offline