Back Of The Envelope Solution – Design of Computer Programs

[Norvig] And the answer is 20 billion. How do you do that back of the envelope? 5 factorial is 120. Let’s just round that off to 100. 100 to the 5th–that’s 5 times 2–is 10 digits, so that works out to 10 billion. And we rounded down to get from 120 to 100, so we […]

Compiling – Design of Computer Programs

Let’s quickly summarize how a language interpreter works. For regular expressions we have patterns like a or b plus, which define languages. A language is a set of strings like {a, b, ab, ba, …} and so on, defined by that pattern. Then we have interpreters like matchset, which in this case takes a pattern […]

Boggle – Design of Computer Programs

This homework is to play the word game Boggle. Now, Boggle is played with a set of letters that are arranged into an n x n grid–here 4 x 4– but you should accept other size as well, and your task is to find all the words that can be found in this grid. Now, […]

About the Class – Design of Computer Programs

Welcome to CS212. Now, in this class, you’re going to be learning by example. So I will pose some problems to you and you’ll get a chance to create your solution. And then I’ll show you and discuss my solution. It’s important to note that there’s more then one way to approach a problem, and […]

Hello – Design of Computer Programs

Hi. I’m Andy. I graduated college in 2009, and I started traveling the world, biking across the country, and basically living the life of a drifter. When I found out about Udacity, I decided this was the job for me. Last semester I TA’d Sebastian’s class on Programming a Robotic Car, and this semester I’m […]

All Plays Solution – Design of Computer Programs

Here’s my answer, so I took all the i, j, w pairs from the horizontal plays and just reassembled them with the i, j, putting in the indication that they’re going in the across direction and keeping the same word. Then I do the same thing for the vertical plays. They came out in the […]

Floor Puzzle Solution – Design of Computer Programs

Here is my solution. You can see it looks pretty similar to the way we solved the zebra puzzle. We did the same technique of assigning something to each of these numbers– bottom to 1, top to 5. These we left unassigned. Then we have this for loop. I chose not to use a generator […]

Set Theory Quiz Solution – Design of Computer Programs

This is the answer. A minus B corresponds to 3, because this is all the elements that are in A but not B. We haven’t filled in this area. A or B is number 2. All of the elements are either in A or B. A & B is number 1. I filled in this […]

Generalized State – Design of Computer Programs

Now the next question is what representation for states should we use if we want to generalize this problem. So that we’re given an initial state when there can be any number of missionaries, cannibals, and boats on one side of the river and any number on the other. Which of these representations is sufficient […]

Red Englishman Solution – Design of Computer Programs

[Norvig] And the answer is all we have to do is check to see if Englishman and red have been assigned the same house number. And we just do that with saying if (Englishman==red). And I should note just as an aside if you wanted to be sort of clever and make it look more […]

Copyright © 2019 Geted Tabs Online. All rights reserved.