CS50 Lecture Notes: Introduction to Computer Science & Programming

Jun 13, 2024

CS50 Lecture Notes

Introduction to Computer Science & Programming

  • Instructor: David J. Malan
  • Course: CS50, Harvard University's Introduction to Computer Science
  • Special Guest: Spot the Robot, Boston Dynamics (Demo)

Instructor's Background

  • David Malan took CS50 as a sophomore after initially gravitating towards Government studies.
  • Found programming fun and switched to a letter grade after enrolling pass/fail.
  • Emphasizes that computer science is a general-purpose way of solving problems applicable to many fields.
  • Encourages students to get comfortable feeling uncomfortable with new material.

Course Overview

  • Languages learned:

    • C: Foundational, older language.
    • Python: Modern, used for data science, web apps.
    • SQL: For databases.
    • JavaScript, HTML, CSS: For web development.
  • Course Structure:

    • Weekly problem sets (assignments).
    • Sections/recitations for different comfort levels.
    • Final project representing a capstone of CS50 experience.

Key Concepts

  • Problem Solving: Focus on how to solve problems using algorithms and computational thinking.
  • Learning Objectives for Today:
    • Representing numbers, letters, colors, images, videos, and audios.
    • Writing algorithms and implementing them with code.
  • Binary System:
    • Binary (base-2) representation.
    • Bits and bytes (8 bits = 1 byte).
  • Text Representation:
    • ASCII and Unicode for character representation.
    • Hexadecimal (base-16) notation for compact representation.
  • Color Representation:
    • RGB model (Red, Green, Blue) using bytes (0-255).
  • Algorithm Efficiency:
    • Binary search as a model for efficient problem solving.

Course Activities & Community

  • CS50 Lunches: Weekly at Changsho restaurant.
  • CS50 Puzzle Day: Team-based problem-solving with puzzles, pizza, and prizes.
  • CS50 Hackathon: Intense programming night ending with IHOP pancakes.
  • CS50 Fair: Exhibition of final projects.
  • CS50 Culture: Focus on personal growth vs. peer comparison.

Artificial Intelligence (AI) in CS50

  • AI-based tools like the CS50 Duck to help students.
  • Restricted use of AI-based tools for assignments, with CS50's AI tools permitted.
  • Introduction of large language models (LLMs) like ChatGPT.

Introduction to Scratch Programming

  • Purpose: Visual programming to understand basic concepts before C.
  • Interface: Blocks representing actions, controls, and events.
  • Basics: Hello World Example
    • Using "events" and "looks" blocks to make the cat say hello.
  • Advanced Scratch Programs:
    • Custom functions (meow example), loops, conditionals, and games.
  • Examples:
    • Oscar Time Game: Trash falling into Oscar the Grouch’s bin.
    • Interactive games using video sensing and keyboard input.

Conclusion

  • Encouragement to take incremental steps in problem-solving.
  • Final note: Cake served in the Transept and meet Spot the robot.