プログラミング · 7単元 · 約191分 · 練習問題77問
始める
アルゴリズム
探索、整列、迷路の抜け方の背後にある方法を学ぶ7つのユニットです。ユークリッドの互除法、線形探索と二分探索、5種類のソート、ビッグO記法、ハノイの塔で学ぶ再帰、幅優先探索と深さ優先探索を扱います。各ユニットには、アルゴリズムを1ステップずつ動かして比較の回数を数えるラボ、ページ上で答え合わせできるJavaScriptの演習、フラッシュカード、解説つきの練習問題10〜12問があります。
進み具合
このコースで学ぶこと
- 手順の並びがアルゴリズムになる条件を言う
- バブル・選択・挿入ソートを1段階ずつ追う
- 問題を分け、半分ずつ解き、まとめる
- 基底部のある、自分自身を呼ぶ関数を書く
- キューを使って幅優先探索をする
単元
- 1アルゴリズムとは何か18ページ30分説明3操作4問題8練習2
- 2探索:線形探索と二分探索19ページ28分説明4操作3問題9練習2
- 3ソート1:バブルソート、選択ソート、挿入ソート19ページ29分説明3操作4問題9練習2
- 4ソート2:マージソートとクイックソート20ページ28分説明5操作3問題9練習2
- 5どれくらい速い?ビッグO記法20ページ25分説明6操作1問題10練習2
- 6再帰19ページ27分説明6操作2問題8練習2
- 7グラフの探索:BFSとDFS18ページ24分説明4操作2問題9練習2
このコースについて
アルゴリズムとは、明確な入力と出力を持つ正確な手順です。このコースで最初に身に付けるのは、コードより前に両方を書く習慣です。最大公約数なら入力は2つの正の整数で、出力は両方を割り切る最大の整数です。最初はユークリッドの方法を学び、1071と462で割り算が何回必要か数えます。また、エイダ・ラブレスも紹介します。未完成だったチャールズ・バベッジの解析機関への最後の注記「注G」には、機械でベルヌーイ数を求める手順が段階的に記されています。
よくある誤りは、停止条件のない再帰です。待機中の呼び出しはそれぞれスタック領域を使い、ChromeやNode.jsではRangeError: Maximum call stack size exceededになります。
はじめる前に
各単元にページ内で判定される JavaScript の練習があるので、JavaScriptが自然な出発点です。ここにはループ、配列、関数がすべて出てきます。2のべき乗と簡単な対数に慣れていることも、二分探索に必要な比較の回数を数えるときに役立ちます。
コースマップ
プログラミング · コース: 4先に学ぶ教科コンピューターの基本とタイピング
このコースの出典 (11)
- MIT OpenCourseWare 6.006 Introduction to Algorithms, Spring 2020 (Demaine, Ku, Solomon)
- lecture notes 1 Introduction, 3 Sorting, 9 Breadth-First Search, 10 Depth-First Search (ocw.mit.edu/courses/6-006-introduction-to-algorithms-spring-2020/pages/lecture-notes) and Fall 2011 lecture 13 BFS notes (ocw.mit.edu/courses/6-006-introduction-to-algorithms-fall-2011)
- Cormen, Leiserson, Rivest, Stein, Introduction to Algorithms (MIT Press)
- with the CLRS-based Khan Academy algorithms unit by Thomas Cormen and Devin Balkcom of Dartmouth (khanacademy.org/computing/computer-science/algorithms: binary search, selection sort analysis, merge sort, quicksort overview and analysis)
- MacTutor History of Mathematics, Al-Khwarizmi (mathshistory.st-andrews.ac.uk/Biographies/Al-Khwarizmi: word algorithm from the Latin title Algoritmi de numero Indorum)
- D. E. Joyce, Euclid's Elements Book VII Propositions 1 and 2 (mathcs.clarku.edu/~djoyce/elements/bookVII)
- Wolfram MathWorld, Merge Sort (mathworld.wolfram.com/MergeSort.html: proposed by John von Neumann in 1945, after Knuth 1998 p. 159)
- Stanford CS "Tony Hoare: Quicksort" (cs.stanford.edu/people/eroberts/courses/soco/projects/2008-09/tony-hoare/quicksort.html: devised while a student at Moscow State University for Russian-English machine translation with a tape dictionary, programmed in Algol 60 and published 1961; the year 1959 from the Wikipedia Quicksort article and its cited sources)
- Bodleian Libraries, Ada Lovelace (blogs.bodleian.ox.ac.uk/adalovelace: 1843 paper, Note G Bernoulli numbers)
- Fourmilab text of Menabrea's Sketch with Lovelace's notes (fourmilab.ch/babbage/sketch.html)
- Seven Bridges of Konigsberg (Euler 1736) and Tower of Hanoi (Edouard Lucas, 1883) checked against the Wikipedia articles and their cited sources.
確認日: 2026-10-17