(cout as in C++'s printf())
"cout-ing" or "c-ing out"?
Showing posts with label CS. Show all posts
Showing posts with label CS. Show all posts
Thursday, October 28, 2010
Sunday, October 24, 2010
Bridge Crossing
There are four people who want to cross a bridge. They take 1, 2, 5 and 10 minutes, respectively. They're crossing at night, so, to cross, you need a lantern, and they have one between the four of them. The bridge is only wide enough to fit two people crossing at a time.
What's the floor on their crossing time? That is, what's the shortest possible time for them all to cross?
Friday, October 22, 2010
A Wonderful Puzzle
(thanks to Wendy for giving this to me)
You read in a stream of integers one by one. You don't know in advance how long the sequence will be, though, of course, you can recognize the EOF char when you get to it. You have to find which integer is the majority, where the majority is defined to be the integer that appears at least (n/2) + 1 times, where n is the length of the sequence.
Do it in constant memory. And, linear time, of course.
You read in a stream of integers one by one. You don't know in advance how long the sequence will be, though, of course, you can recognize the EOF char when you get to it. You have to find which integer is the majority, where the majority is defined to be the integer that appears at least (n/2) + 1 times, where n is the length of the sequence.
Do it in constant memory. And, linear time, of course.
Tuesday, September 21, 2010
C Code, Run!
I saw this bumper sticker on a car last quarter on campus, co-incidentally when I was taking CS107 (the introductory C class). It's a pretty accurate description of how I was feeling during the write-a-heap-allocator assignment:
Wednesday, July 14, 2010
AppleJack 1.6 is out!
If you use a Mac, here's a nice little tidbit: AppleJack 1.6 is out (click on the post title for the link) . If you've never heard of it, AppleJack is a useful bug-fixing piece of software. Just start your computer up in single-user mode by holding down curlique-S (command-S) and type "applejack" at the prompt. It'll usually do a very good job of fixing whatever oddness is happening in your computer. It works especially well if Finder is acting up.
Monday, June 21, 2010
Google Silliness
Subscribe to:
Posts (Atom)

