CS50 x 2022 笔记

本文是CS50课程的笔记,涵盖了计算机科学的基础,包括数字、文本和多媒体的表示方式,算法概念,伪代码,以及Scratch编程。文章详细解释了二进制、ASCII和Unicode,以及如何用算法解决问题,如电话簿查找问题。此外,还介绍了C语言的基础,如IDE、编译器、变量、函数、条件语句和循环。
摘要由CSDN通过智能技术生成

0: What is computer science?

Computer science is less about programming than about problem soving, and need to be precise and methodical.

Problem soving can seem as the prosess of taking some input (a problem we want to solve) and generate some **output **(the solution to our problem). So we can find a way to reprsent inputs and outputs, which can help us store and work with information in a standardized way.在这里插入图片描述

0.1 Representing formats

Numbers

  • Unary: each digit represents a single value of one (like counting the number of people using fingers).
  • Decimal
  • Binary: just with two digits, o and 1.
    • Each binary digit is called a bit. 8 eight bits called one byte.
    • Since computers run on electricity, which can be turn on or off, we can represent a bit by just tuning somg swith on or off to reprent a 0 or 1. And there are billions of tiny switches calles transistors that can be turned on and off to represent different valunes.
      - Most computers use 8 bits at a time.

22 21 20

Text

  • The question is how numbers map to letters?
    • A standard mapping: ASCII (letters and punctuation). Unicode(marks and symbols).
    • By using context, like the file format, different programs can interpret and display the same bits as numbers or text.
    • Because only the descriptions have been standardized, so diffenrent companies will have slightly different images that represent each emoji.

Image, video, sounds

  • RGB: represent colors by indicatng the amound of red, green, and blue within each color.
  • The dots, or squares, on our screen are called pixels,and images are made up of many thousands or millions of thouse pixels,
  • Videos are sequences of many images, changing multiple times a second to give us the appearance of motion.
  • MIDI:one format represent music with number for the notes and their duration and volum.

All of this ideas are just zeroes and ones, interpret and used by softwares we’ve written to interpret them in the ways that we want.

  • Other formats: Compression:mathematical ways to represents some data with fewer bits). Container: store mutiple types of data together .

0.2 Algorithem

The black box that *transforms inputs to outputs * contains algorithems, step by step instructions for soving problems:

  • 0
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 1
    评论
评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值