字幕表 動画を再生する 英語字幕をプリント >> [MUSIC PLAYING] >> [MUSIC PLAYING] DAVID MALAN: All right. This is CS50. [MUSIC PLAYING Tritonal, Cash Cash, "Untouchable"] [MUSIC PLAYING] SPEAKER 1: I'm going to France, and you're going, too. [MUSIC PLAYING] DAVID MALAN: This is CS50, Harvard University's introduction to the intellectual enterprises of computer science and the arts of program-- and for the first time in history, Yale University's as well. Indeed, whether you're here in Cambridge or in New Haven or Miami or St. Louis or Amsterdam or anywhere around the world taking CS50, computer science E50, CS50X, CS50 AP, we are all one and the same. Welcome to CS50. >> What we have-- >> [APPLAUSE] >> [LAUGHS] >> [APPLAUSE] >> So I made a mistake myself some time ago when I started off college. And I got to college, and I decided to frankly, stick within my comfort zone. I ended up declaring a concentration, or a major, of government. Ant that was mostly a function of me being pretty familiar with government or at least history or I really liked constitutional law in high school. And so when I got here, I kind of gravitated toward things with which I was already familiar. Right? God forbid I do poorly in the class. I certainly wanted to stay within my comfort zone, and it wasn't until sophomore year that I finally got up the nerve to step foot in a classroom called CS50. And at that point, did I finally realize that, my God, homework could actually be fun. >> Indeed, I was one of those kids that on Friday evenings when the P-SETS would be released, I would go back to my room and dive into the night's P-SETS. And for me, that was a sign that this was a field for me. But what was more important was the fact that I did get up this nerve to explore waters unfamiliar to me and get beyond my own comfort zone and frankly, I only was able to do that sophomore year by taking this class pass/fail. >> Indeed, it was the very last day that I finally switched over and finally declared CS as my concentration, putting gov at that point behind me. And so we're not setting out in this course to turn all of you into CS majors or concentrators, but rather to give you an opportunity to hopefully go beyond the world with which you're currently familiar and bring back from this world skills and knowledge and savvy that you can apply to your own world, whether that's in the humanities, social sciences, natural sciences, or beyond. >> Indeed, if you're feeling a little intrepid about being in this room let alone in this class, realize that if history is any indication, 72% of you have never taken a CS course before. So it is by all means not the case that the student sitting to the left or to the right or in front or behind you knows far more about CS or programming in particular than you. That's not in fact the case. And indeed, much of the support structure that we've set up in this course over the past many years has been for exactly that reason-- to provide an on ramp that still exits just as rigorously and just as high as ever-- but the slope of which allow students less comfortable and more comfortable alike to succeed irrespective of his or her prior background. >> Indeed, what ultimately matters in this class is not so much where you end up relative to your classmates but where you in week 12 end up relative to yourself in week zero, which is where we are here today. >> Indeed and this may very well and probably does look like Greek to many of you. But rest assured, that this and so much more is going to be completely within your grasp in just a little bit of time. >> But today, we focus on some of the higher level ideas to give you a taste of CS50 and computer science in a sense of what you're signing up for. And indeed, computer science might be distilled more simply as computational thinking-- thinking like a computer, if you will. And there's so many different things ingredients that go into that, but let's propose just three for today. If the goal of the class ultimately is not to teach you programming, is not to teach you C or PHP or SQL or any number of the words and acronyms in the course's description, but rather to teach you to solve problems more effectively and to think more methodically and more algorithmically, so to speak. Let's see what exactly this means. >> So I would propose that thinking computationally boils down to solving problems. What do you need to solve a problem? You need to input-- like the input to the problem-- you need an output, which is hopefully the solution, and then you need a process by which to solve that problem, which we'll call an algorithm-- a set of instructions for solving some problem. >> But first, let's focus on the first and the last of these inputs and outputs. Computers after all, apparently only understands zeros and ones. But how can that possibly be? Even if you're not familiar at all with what's underneath the hood, you probably at least heard that computers understand binary-- just zeros and ones-- but how can you possibly do anything interesting? >> Well, one of the themes of the class is going to be this layering-- where today, we'll take a quick glance at the lowest level details, but with each passing day, where we layer or abstract on top of those details to actually solve higher level problems of interest to us. >> So here is what we might call binary-- with just an alphabet of 0 and 1. But we humans are mostly familiar with decimal. Dec meaning 10. Bi meaning two. And so in the decimal system, we have 10 digits at our disposal-- of course, zero through nine. So if you look at a number like this, most of you intuitively just grasp that is 123. There's nothing really hard about that. But why is it 123? Well, if you think back to grade school-- or at least the way I learned this kind of world-- you might recall that we treated these things in columns, or places. >> So we have the ones place on the right. The tens place in the middle. The hundreds place on the left. And then how do we get from this pattern symbols-- 1 2 3-- to this higher level idea that we know as 123? Well, it's just some simple arithmetic. Right? >> The one there is essentially means give us 100 times 1 plus 10 times 2 plus 1 times 3. And of course if we do out the math there, it's 100 plus 20 plus 3-- otherwise known as 123. >> So if you're on the same page as that right now and are comfortable with the so-called decimal system as a human, it's actually well within your scope of comfort to consider now the binary system. Take a wild guess-- this represents, in the world of computers in binary-- what number? Zero. >> But why is that? Well, it turns out that the columns or places here-- they're not powers of 10. 1, 10, 100, 1,000, and so forth. They're instead, quite simply, powers of 2. So, 1, 2, 4, 8, 16, 32, and so on. And so now we of course get to 0 here simply because we have 4 times 0 plus 2 times 0 plus 1 times 0, which of course gives us 0. >> But how do I go about representing the number 1? What's the pattern of zeros and ones to represent the number we humans know as 1? 001. And 2? 010. >> And now the pattern starts to repeats. Now it's 011. And again, 0 fours, one 2, one 1. So 2 plus 1. That's 3. >> And now to represent 4, we don't just change that 0 to a 1. You sort of have to carry, so to speak, and the numbers start flipping around just like in the decimal world. >> So this is 4. This is 5. This is 6. This is 7. And so we've counted as high as 7. >> Now all we just need is more a bits-- more zero's and one's. And indeed "bits", if you've heard this term-- binary digit. Bit is where that comes from. And so if we want to represent bigger numbers, we need more bits. But let's move away from slides now to something a little more real. Suppose that we want to actually represent this thing. >> Well let's take a look now at a little demonstration. So this is a web based application that one of CS50's own, Michael G, put together this summer to help us elucidate exactly this idea. And would someone like to venture up on stage in front of all his or her classmates?