字幕列表 影片播放 列印所有字幕 列印翻譯字幕 列印英文字幕 >> [MUSIC PLAYING] >> [音樂播放] >> [MUSIC PLAYING] >> [音樂播放] DAVID MALAN: All right. DAVID馬蘭:好的。 This is CS50. 這是CS50。 [MUSIC PLAYING Tritonal, Cash Cash, "Untouchable"] [音樂播放Tritonal,現金現金, “賤民”] [MUSIC PLAYING] [音樂播放] SPEAKER 1: I'm going to France, and you're going, too. 揚聲器1:我要去 法國和你要去了。 [MUSIC PLAYING] [音樂播放] DAVID MALAN: This is CS50, Harvard University's introduction DAVID馬蘭:這是CS50, 哈佛大學的介紹 to the intellectual enterprises of computer science 以智力 計算機科學的企業 and the arts of program-- and for the first time in history, 和program--的藝術 對於在歷史上第一次, 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, 服用CS50,計算機 科學E50,CS50X,CS50 AP, we are all one and the same. 大家都是同一個。 Welcome to CS50. 歡迎CS50。 >> What we have-- >> 我們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. 鼓起勇氣步驟腳 在一個名為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 在P-SETS將被釋放,我 會回到我的房間,潛水 into the night's P-SETS. 到晚上的P-集。 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. 聲明CS為我的注意力, 把政府網站在我身後這一點。 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 認識到,如果歷史 任何跡象表明,你72% have never taken a CS course before. 以前從來沒有採取CS課程。 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 或向右或前面或 你身後知道遠更多關於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 一直正是reason--到 斜坡上仍然退出提供 just as rigorously and just as high as ever-- 正如嚴格和 一樣高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 給你的味道 CS50和計算機科學 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. 簡單地計算thinking-- 思就像一台電腦,如果你願意。 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 是不是要教你C或PHP或 SQL或任何數目的字 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-- 您需要input--像 輸入到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-- 你可能至少聽說 計算機能夠理解binary-- just zeros and ones-- but how can you possibly do anything interesting? 只是零和ones--卻怎麼也 你可能做什麼有趣的事? >> 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 是這個layering--今天在這裡,我們將 我們快速瀏覽一下的最低水平。 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. >> 因此,這裡就是我們可以稱之為binary-- 用0和1只是一個字母。 But we humans are mostly familiar with decimal. 但是,我們人類大多 熟悉小數。 Dec meaning 10. 十二月意義10。 Bi meaning two. 畢意兩種。 And so in the decimal system, we have 10 digits 並因此在小數 系統,我們有10位 at our disposal-- of course, zero through nine. 在我們的disposal-- 當然,0到9。 So if you look at a number like this, most of you 所以,如果你看一個數字 像這樣的,你最多 intuitively just grasp that is 123. 直觀地只是把握是123。 There's nothing really hard about that. 沒有什麼真的很難有關。 But why is it 123? 但為什麼123? Well, if you think back to grade school-- or at least 好吧,如果你想回 等級school--或至少 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-- 然後我們怎麼 從這種模式symbols-- 1 2 3-- to this higher level idea that we know as 123? 1 2 3--至更高水平 想法,我們所知道的123? Well, it's just some simple arithmetic. 好吧,這只是一些簡單的算術。 Right? 對嗎? >> The one there is essentially means give us 100 times 1 plus 10 times >> 一個有實質上是指 給我們100倍1加10倍 2 plus 1 times 3. 2加1次3。 And of course if we do out the math there, it's 100 plus 20 當然,如果我們做出來的 數學那裡,它是100加20 plus 3-- otherwise known as 123. 加3--否則稱為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 以野生guess--這代表, 在計算機的世界 in binary-- what number? 在binary--什麼號碼? Zero. 零。 >> But why is that? >> 但是,這是為什麼? Well, it turns out that the columns or places here-- they're not powers of 10. 嗯,事實證明,該列或 這裡 - 他們不是10的冪的地方。 1, 10, 100, 1,000, and so forth. 1,10,100,1000,等等。 They're instead, quite simply, powers of 2. 他們相反,相當 簡單地說,2的冪。 So, 1, 2, 4, 8, 16, 32, and so on. 因此,1,2,4,8,16,32,等等。 And so now we of course get to 0 here simply because we have 4 times 所以,現在我們當然得到0 在這裡,只是因為我們有4倍 0 plus 2 times 0 plus 1 times 0, which of course gives us 0. 0加2次0加1次 0,這當然給了我們0。 >> But how do I go about representing the number 1? >> 但我怎麼去 表示數字1? What's the pattern of zeros and ones to represent 什麼是模式 零和一表示 the number we humans know as 1? 數我們人類所知道的1? 001. 001。 And 2? 和2? 010. 010。 >> And now the pattern starts to repeats. >> 而現在的模式開始重複。 Now it's 011. 現在是011。 And again, 0 fours, one 2, one 1. 再次,0四肢一2一1。 So 2 plus 1. 因此,2加1。 That's 3. 這是3。 >> And now to represent 4, we don't just change that 0 to a 1. >> 現在來表示4,我們 不只是改變0到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. >> 因此,這是4。 This is 5. 這是5。 This is 6. 這是6。 This is 7. 這是7。 And so we've counted as high as 7. 所以,我們計算高達7。 >> Now all we just need is more a bits-- more zero's and one's. >> 現在我們只是需要更多的是 bits--更多的零的和一個人的。 And indeed "bits", if you've heard this term-- binary digit. 事實上“位”,如果你 聽到這個term--二進制數字。