Placeholder Image

字幕列表 影片播放

  • >> [VIDEO PLAYBACK]

    >> [視頻回放]

  • >> [CAR DOOR SHUTTING]

    >> [汽車車門關閉]

  • >> [CAR ENGINE STARTING]

    >> [汽車發動機起動]

  • >> [MUSIC PLAYING]

    >> [音樂播放]

  • >> -Moving right along in search of good times and good news.

    >> 右沿搜索-Moving 美好的時光和一個好消息。

  • With good friends you can't lose.

    有了良好的朋友,你不能輸。

  • >> -This could become a habit.

    >> - 這可能會成為一種習慣。

  • >> -Opportunity knocks Let's just reach out and grab it.

    >> -Opportunity敲門讓我們 只要伸出手抓住它。

  • -Yeah!

    是啊!

  • -Together we'll nab it.

    -Together我們逮到它。

  • -We'll hitch hike, bus, or yellow cab it.

    -We'll順利調漲, 公交車,或黃色出租車吧。

  • -Dammit.

    -Dammit。

  • -We're moving right along.

    -We're正確的順動。

  • -Footloose and fancy free.

    -Footloose和花式免費。

  • -Getting there is half the fun.

    -Getting有一半的樂趣。

  • Come share it with me.

    跟我來分享。

  • >> -We're moving right along.

    >> -We're正確的順動。

  • >> -We're going to share the load.

    >> -We're要分擔負載。

  • >> -We don't need a map to get this show on the road.

    >> - 我們並不需要一個地圖 獲得本次車展的道路上。

  • -Hey Fozzy, I want you to turn left if you come to a fork in the road.

    - 嘿Fozzy,我希望你能左轉 如果你來到了一個岔路口。

  • -Yes, sir.

    - 是的,先生。

  • Turn left at the fork in the road.

    左轉,在三岔路口。

  • Turn left.

    左轉。

  • >> -I don't believe that.

    >> - 我不相信。

  • >> -Cruising right along we found the lights on the highway.

    >> -Cruising沿著正確的發現 在高速公路上的燈光。

  • >> -And your way or my way.

    >> - 和你的方式或我的方式。

  • >> -So trust my navigation.

    >> - 所以相信我的導航。

  • >> -Movie stars with flashy cars and life with the top down.

    >> - 電影恆星浮華汽車 和壽命與自上而下。

  • >> -We're storming the big hills.

    >> -We're強攻大陵。

  • >> -Yeah, storm is right.

    >> 是啊,暴風雨是正確的。

  • Should it be snowing?

    是否應該下雪?

  • >> -No, I don't think so.

    >> 不,我不這麼認為。

  • >> -Moving right along.

    >> 沿著正確-Moving。

  • >> -Footloose and fancy free.

    >> -Footloose和花式免費。

  • >> -You're ready for the big time.

    >> -You're準備好大的時間。

  • >> -Is it ready for me?

    >> -is它為我準備好?

  • >> -Moving right along.

    >> 沿著正確-Moving。

  • Moving right along.

    運動沿著正確的。

  • Moving right along.

    運動沿著正確的。

  • Moving right along.

    運動沿著正確的。

  • -I think you better pull over.

    - 我想你最好靠邊停車。

  • -Yes, sir.

    - 是的,先生。

  • >> [END PLAYBACK]

    >> [結束播放]

  • >> [APPLAUSE]

    >> [掌聲]

  • >> DAVID J. MALAN: This is CS50.

    >> DAVID J.馬蘭:這是CS50。

  • And this is the end of Week 0, but the start of a beautiful friendship.

    這是第0週的端部,但 一段美好友誼的開始。

  • We are so excited to be here at Yale University

    我們很高興能成為 這裡在耶魯大學

  • for the very first time with our friend Scaz, and Jason, and Andy.

    對於第一次與我們 朋友Scaz,和Jason,和安迪。

  • All 40 of CS50's TF's and CA's here at Yale.

    的CS50的TF的所有40 和CA在這裡在耶魯大學。

  • And all of you.

    而這一切都是你的。

  • And in fact, it's probably time to--

    而事實上,它可能是時間用於:

  • >> [APPLAUSE]

    >> [掌聲]

  • >> So, even though most of the lectures will indeed be in Cambridge this year,

    >> 所以,儘管大部分的演講 的確將在劍橋今年,

  • the reality is that by design, and very much deliberately in CS50,

    現實情況是,由設計, 很刻意的CS50,

  • I do think we're nearing the point technologically, and pedagogically,

    我認為,我們正在接近的地步 技術和教學上,

  • where it can be a superior educational experience to engage with some

    它可以是一個優越的教育 經驗,與一些

  • of the course's material online.

    課程的材料在網上的。

  • Indeed, the reality-- and if I believe this philosophically-- is that lectures

    事實上,reality--如果我相信 這philosophically--是講座

  • are not a particularly effective means for delivering

    是不是一個特別 為提供有效的手段

  • fairly complex information.

    相當複雜的信息。

  • Certainly over hour plus long spans of time.

    當然,在小時 再加上大跨度的時間。

  • And indeed every few minutes-- I remember myself in college--

    事實上每隔幾個minutes-- 我記得自己在college--

  • you zone out for a moment, you miss some complex topic,

    你掃開了一會兒, 你錯過了一些複雜的問題,

  • and you're gone pretty much for the next 45 minutes.

    和你走了差不多 在接下來的45分鐘。

  • And the reality is that whether you're here in New Haven or Cambridge

    而現實情況是,無論是 你在這裡在紐黑文和劍橋

  • or beyond, the simplicity of having the ability to pause and fast forward,

    或超越,具有簡單 暫停的能力和快進,

  • rewind, hyperlink to related resources, search full text transcripts

    快退,超鏈接到相關的 資源搜索全文成績單

  • and the like is an opportunity that I dare say for our online students

    等是一個機會 我敢說我們的在線學生

  • well beyond New Haven, offers them an opportunity

    遠遠超出了紐黑文, 為他們提供了一個機會,

  • to really grasp the conceptual material that we

    要真正掌握 概念性的材料,我們

  • introduce in lectures all the better.

    講座介紹就更好了。

  • >> But ultimately in CS50, is the students' experience

    >> 但最終在CS50,是 學生的經驗

  • is characterized so, so much more by the course's problem sets,

    的特徵是,這麼多 在課程的習題集,

  • or weekly programming projects, the course's sections led by the teaching

    或每週編程項目, 當然各科為首教學

  • fellows, the nightly office hours led by the course assistants and the teaching

    研究員,夜間辦公時間為首的 過程助理和教學

  • fellows, and indeed such events as CS50 Puzzle

    研究員,實際上這樣的 事件CS50謎

  • Day, CS50's Hack-a-thon, the CS50 Fair, weekly lunches, and so much more.

    當天,CS50的黑客馬拉松,在CS50 公平,每週午餐,和這麼多。

  • And so whether you're here in New Haven, or tuning in from afar,

    所以,無論你在這裡新 紐黑文,或調整從遠方來,

  • today in Cambridge, and we'll see you again soon,

    今天在劍橋,和 我們將再次看到您的到來,

  • the reality is this is one and the same class.

    現實的情況是,這是 一個和相同的類。

  • And we are so excited to be here all together today.

    而我們是如此興奮 在這裡一起今天。

  • And so at the end of the semester, whether here or afar, well

    所以在學期結束時, 無論是在這裡還是遠遠望去,以及

  • hopefully you wear proudly, happily, and perhaps with a bit of relief,

    希望你穿自豪,令人高興的是, 或許有一點緩解,

  • the shirt that bears witness to you having taken CS50.

    這見證襯衫 你已經採取CS50。

  • >> So where did we leave off on Wednesday?

    >> 那麼,我們什麼週三離開了嗎?

  • We took a look at computational thinking.

    我們看了看 計算思維。

  • And that's toward what we distilled computer science unto, at least

    而這對我們蒸餾 計算機科學對,至少

  • for now.

    現在。

  • But we distilled it little further into at least three components elements.

    但是,我們蒸餾水它遠一點為 至少三種組分的元素。

  • >> Inputs, so what is the problem we're trying to solve?

    >> 輸入,所以什麼 問題,我們正在努力解決?

  • Outputs, what is the answer we're hoping to get?

    產出,什麼是 回答我們希望能得到?

  • And the representation there of.

    並表示那裡。

  • And we won't dwell here on after on binary, or even ASCII,

    我們不會住在這裡 後二,甚至是ASCII碼,

  • and the like so much, but rather take for granted

    之類的那麼多,但 而想當然地

  • that we can represent this information, because the far more interesting parts

    我們可以代表這個信息, 因為更為有趣的部分

  • of those problems are not just the inputs and outputs, but the algorithms

    這些問題不只是在 輸入和輸出,但這些算法

  • that go into solving those problems.

    該進入解決這些問題。

  • >> And you might recall from the other day that we

    >> 你可能還記得 有一天,我們

  • took a fairly traditional concept of looking someone up

    花了相當傳統 尋找個人上來概念

  • in a fairly large phone book, or more generally digitally these days,

    在一個相當大的電話簿,或 更普遍的數字,這些天,

  • just a very large data set.

    只是一個非常大的數據集。

  • A really big contacts list, with lots of names alphabetically sorted.

    一個非常大的聯繫人列表,用 很多名稱的字母順序排序。

  • And we realized that while I could approach this problem simply

    我們認識到,儘管我 可以簡單地解決這個問題

  • by using a linear approach-- page by page,

    通過使用線性 approach--逐頁,

  • or even two's at a time-- we realized that the more intuitive algorithm--

    甚至兩公司在我們實現了時間 - 該更直觀算法 -

  • just kind of dividing and conquering the problem again, and again,

    只是種分治 再次問題,並再次,

  • and again-- halving it with each time, gave us this green result.

    和again--它與每個減半 時間,給了我們這個綠色的結果。

  • And it's so much flatter because it suggests

    而且它是如此更平坦 因為它表明

  • that even as this problem gets bigger and bigger,

    即使因為這個問題 變得越來越大,

  • as is the case these days with data sets and reality-- Facebook and Google

    既然是這樣,這些天的數據 集和reality-- Facebook和谷歌

  • search results and the like-- does our algorithm

    搜索結果和 like--做我們的算法

  • perform just as effectively with those bigger bites

    執行一樣有效 與那些更大的叮咬

  • as it did even with the smaller bites.

    因為它沒有甚至更小的叮咬。

  • >> Now it begs the question, what can we actually solve similarly

    >> 現在,它引出了一個問題,是什麼 我們可以真正解決類似

  • with this kind of intuition?

    用這種直覺?

  • This sort of division and conquering?

    這種分裂和征服的?

  • Well, we could do something like this today here.

    那麼,我們可以做些什麼 今天這個樣子這裡。

  • We could take attendance.

    我們可以好好聽講。

  • So maybe like 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11--

    因此,也許像1,2,3,4, 5,6,7,8,9,10,11--

  • not going to be all that efficient.

    不會是所有的高效率。

  • So wait, grade school.

    所以等待,小學。

  • 2, 4, 6, 8, 10, 12, 14, 16, 18 and so forth.

    2,4,6,8,10,12,14, 16,18等。

  • But could we do a little better?

    但是,我們可以做的更好一點?

  • >> I'm pretty sure I can't do this by myself.

    >> 我敢肯定,我不能 我自己做到這一點。

  • So if you'll humor us for just a moment, we brought with us

    所以,如果你要的幽默我們只是 一個時刻,我們帶來了我們

  • an algorithm that's just got three steps,

    一種算法是 剛拿到三個步驟,

  • but it does require-- if you don't mind-- all of us stand up,

    但它確實如果require-- 不mind--我們所有的人站起來,

  • if you would.

    如果你會的。

  • So, with all of us now standing, step one of this algorithm is the following.

    因此,所有我們現在站,步 該算法中的一個是如下。

  • Stand up and assign yourself the number 1.

    站起來並分配 自己的號碼1。

  • So at this point in time, literally everyone in this room

    因此,在這個時間點, 從字面上每個人都在這個房間

  • hopefully is thinking to themselves, however awkwardly, the number 1.

    希望在想自己, 但是笨拙,數字1。

  • >> Now step two of this algorithm is going to involve the following.

    >> 現在,第二步,該算法是 將涉及以下內容。

  • Step two, pair off with someone standing,

    步驟二,雙關 與人站立,

  • add your numbers together, and adopt the sum as your new number.

    添加數字加在一起,和 採用的總和作為新的號碼。

  • Quick sanity check.

    快速完整性檢查。

  • What number is everyone thinking of now?

    什麼號碼是每個人想的呢?

  • >> So 2, except maybe for one, awkward, lonesome person.

    >> 所以2,也許除了為一體, 尷尬的,寂寞的人。

  • If we have an odd number of people in the room.

    如果我們有一個奇數 人在房間裡。

  • So one person might still be the number 1, that's fine.

    所以,一個人可能仍然 數字1,這很好。

  • But step three here, one of you should sit down.

    但是,一步三到這一步, 你應該坐下。

  • The other should go back to step two, and repeat, if you would.

    另外應該回到步驟 二,如果你會重複。

  • >> So if still standing, you should be among those going back to step two.

    >> 所以,如果仍然屹立不倒,你應該 在那些回到第二步。

  • Keep going.

    繼續前進。

  • A few people still standing.

    有幾個人還站著。

  • >> So, if still standing, pair up with someone.

    >> 所以,如果仍然屹立不倒, 配對與某人。

  • All right, dwindling down.

    好了,越來越少了。

  • A few people still standing.

    有幾個人還站著。

  • I'll help if need be.

    我會幫助,如果需要的話。

  • Remember the key takeaway here, is how much faster this is than me counting.

    記住關鍵外賣這裡,是怎麼 要快得多,這是比我計數。

  • >> So let's see.

    >> 所以,讓我們來看看。

  • I can help out.

    我可以幫忙。

  • So what number are you still thinking of?

    那麼,什麼數量 你還在想什麼?

  • >> AUDIENCE: I'm at 44.

    >> 聽眾:我在44。

  • >> DAVID J. MALAN: 44, so you go ahead and sit down.

    >> DAVID J.馬蘭:44,所以 你先走一步,坐下。

  • What number are you thinking of?

    什麼號碼,你在想什麼?

  • AUDIENCE: 74.

    聽眾:74。

  • >> DAVID J. MALAN: 74.

    >> DAVID J.馬蘭:74。

  • All right, go ahead and sit down.

    好吧,繼續坐下。

  • Who else is still standing?

    還有誰仍然屹立不倒?

  • 86.

    86。

  • And is anyone else still standing?

    而且是其他人還站著?

  • >> What number?

    >> 什麼號碼?

  • I heard 67.

    聽說67。

  • And then in top?

    然後在上面?

  • 32.

    32。

  • Anyone else still standing and thinking of a number?

    任何人都還站著 和思考的一個數字?

  • >> Oh, hi.

    >> 哦,你好。

  • Sorry.

    抱歉。

  • Be right back.

    就回來。

  • 42.

    42。

  • Anyone else?

    還有其他人?

  • >> AUDIENCE: 47.

    >> 聽眾:47。

  • >> DAVID J. MALAN: 47.

    >> DAVID J.馬蘭:47。

  • Is anyone else still standing who hasn't been counted?

    是任何人都還站著 誰沒有被計算在內?

  • So the final number of people in a room that has 497 seats is-- all of which

    所以,人在一個房間裡最後的數 擁有497個座位is--所有這些

  • are filled-- is 390.

    是filled--是390。

  • So this is great.

    因此,這是偉大的。

  • >> We will soon discuss the notion of a bug in a computer program.

    >> 我們下面將要探討的概念 在一個計算機程序中的錯誤。

  • But we'll come back to that before long.

    但是,我們會回來的,不久。

  • But in theory, what might have happened just now?

    但在理論上,可能是什麼 已經發生了剛才?

  • So even though there were three big steps to this algorithm, each of those

    因此,即使有三大 步驟以這種算法中,每個那些

  • was just kind of one big operation.

    只是其中的一種大的操作。

  • And there was this cyclicity to it in that if you were still standing,

    而有這種週期性吧 原因是,如果你還站著,

  • you kept going from step three to two, step three to two, step three to two.

    你不停地從第三步去二, 一步三到二,一步三到二。

  • >> But what kept happening on each iteration?

    >> 但是,保持發生 在每次迭代?

  • Each cycle of this loop?

    這個循環的每個循環?

  • What was happening elsewhere in the room?

    發生了什麼 其他地方的房?

  • Not only the same thing, but what was happening to half of you?

    不僅同樣的事情,但什麼 正在發生的事情的一半,你呢?

  • Sitting down.

    坐了下來。

  • And so there in lies this insight, much like the phone book example,

    所以有謊言這種認識, 很像電話簿例如

  • in that if half of you are sitting down each time,

    中,如果有一半的你 每次坐了下來,

  • the problem is starting with maybe 400 people,

    該問題已經開始 也許有400人,

  • then to 200 people, than 100 people, then 50 people, and so forth.

    然後,200人,100餘人, 然後50人,等等。

  • >> And so we whittle down in theory to just one person,

    >> 因此,我們在惠特爾下來 理論只是一個人,

  • thinking of the total value of everyone.

    想每個人的總價值。

  • Now reality, some social dynamics, and some arithmetic errors

    現在現實中,一些社會動態, 還有一些算術錯誤

  • might contribute to that ultimate bug.

    可能有助於這一最終的bug。

  • But in theory, while I was still counting away,

    但在理論上,而我 還在指望了,

  • taking several dozen steps, or hundreds of steps

    服用幾十 步驟,或幾百步驟

  • to count yourselves, to count a roomful of 500 or so people

    算呀,算 500左右的人一個屋子

  • should have taken far fewer steps, because you can only divide 500 and 1/2

    應該採取更少的步驟, 因為你只能劃分500和1/2

  • so many times.

    這麼多次。

  • And so just like with the phone book example the other day,

    所以,就像用手機 本書實例有一天,

  • did we have something logarithmic so to speak,

    我們什麼有什麼 對數可以這麼說,

  • whereby if we were all operating in unison,

    因此,如果我們都 統一經營,

  • and ignoring the addition errors, would we

    而忽略了 另外的錯誤,我們會

  • have achieved exactly that kind of running time?

    已經完全實現 那樣的運行時間?

  • >> Now to be fair, kind of cheated, in that I leveraged another resource.

    >> 現在,為了公平起見,一種被騙了,在 我利用其他資源。

  • Whereas it's just one of me, I leveraged hundreds of you.

    雖然這只是我的一個, 我利用數百你。

  • But that might be said to be an example of parallel processing,

    但是,這可以說是一種 例如並行處理,

  • or a state of art very much in vogue where computers these days have

    或藝術的狀態非常流行 其中,電腦這幾天有

  • multiple CPUs, or more technically, more multiple cores,

    多個CPU,或者更 在技​​術上,更多個內核,

  • and can truly do multiple things at once, much like you

    可以真正做到多 件事情,就像你

  • all we're doing there, in parallel.

    我們所做的存在,在並行。

  • But recall that what we also did on Wednesday

    但記得,我們 也做週三

  • was try to capture this intuition and formalize it in code.

    在試圖捕捉這種直覺 並規範它的代碼。

  • Something like pseudo-code.

    像偽代碼。

  • And in fact, and I hope you'll forgive, it's like 80 degrees in here.

    而事實上,我希望你會 原諒,這就像在這裡80度。

  • So I'm going to take this off for just a little bit.

    所以,我要藉此 關閉只是一點點。

  • What I thought we'd do is transition now to an application whereby

    我以為我們會做的是轉變 現在的應用程序,從而

  • we again engage the audience, but write a program in English

    我們再次吸引觀眾的, 但用英語寫一個程序

  • like syntax, with which to solve this problem here.

    像語法,與其中 這裡解決這個問題。

  • [VIDEO PLAYBACK]

    [視頻回放]

  • -It's peanut butter jelly time.

    - 它的花生醬果凍時間。

  • Peanut butter jelly time.

    花生醬果凍時間。

  • Peanut butter jelly time.

    花生醬果凍時間。

  • >> Way ya!

    >> 路亞!

  • Way ya!

    路亞!

  • Way ya!

    路亞!

  • Way ya!

    路亞!

  • Now there you go!

    現在,你去那裡!

  • There you go!

    你去那裡!

  • There you go!

    你去那裡!

  • There you go!

    你去那裡!

  • Peanut butter jelly!

    花生醬果凍!

  • Peanut butter jelly!

    花生醬果凍!

  • >> Peanut butter jelly!

    >> 花生醬果凍!

  • Peanut butter jelly!

    花生醬果凍!

  • Peanut, peanut butter jelly!

    花生,花生醬果凍!

  • Peanut butter jelly!

    花生醬果凍!

  • Peanut butter jelly with a baseball bat.

    花生醬果凍用棒球棒。

  • >> [END PLAYBACK]

    >> [結束播放]

  • DAVID J. MALAN: --that video, but it is a little addictive,

    DAVID J.馬蘭:--that視頻, 但它是一個有點上癮,

  • if not a bit annoying.

    如果不是有點討厭。

  • But to do this, I thought what we'd do is try to write a program together,

    但要做到這一點,我還以為會有什麼新 要做的就是盡量一起編寫一個程序,