0% found this document useful (0 votes)
25 views3 pages

Problem Solving

The document discusses computer science topics such as binary, letters, colors, algorithms, pseudocode, and abstraction. It explains how computers use binary to represent numbers and characters. Color representation with RGB values and pixels in images and video are also covered. Examples of algorithms and pseudocode are provided. Abstraction is introduced as a way to combine ideas into single functions.

Uploaded by

Neutral Network
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
25 views3 pages

Problem Solving

The document discusses computer science topics such as binary, letters, colors, algorithms, pseudocode, and abstraction. It explains how computers use binary to represent numbers and characters. Color representation with RGB values and pixels in images and video are also covered. Examples of algorithms and pseudocode are provided. Abstraction is introduced as a way to combine ideas into single functions.

Uploaded by

Neutral Network
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 3

Title:

[[CS50x]]
Main
Topic:
Com-
puter
Sci-
ence
Subtopic:
Pro-
gram-
ming
Tags:
#Pro-
gram-
ming
#Study

Lecture 0
!!! quote What ultimately matters in this course is not so much where you end
up relative to your classmates but where you end up relative to yourself when
you began. !!!

Problem Solving
Programming isn’t about staying alone and programming, it’s about problem
solving, collaborating and thinking.
This course teaches how to think more correctly, because the computer
only accepts the correct input (to function correctly) [[Pasted image
20220622163013.png]]

Binary
How computers, who can only use 1’s and 0’s count?
• Humans use the unary system, assigning a single value of one to each
digit
• Or they use the decimal system, going from 0 to 9
However, computers use a simpler system, the binary, which represents numbers
with patters

1
000 001 010 011 100 101 110 111
0 1 2 3 4 5 6 7

• Each binary digit is also called a bit.

2² 2¹ 2�
# # #

• Most computers use 8 bits at a time, like 00000011 for the number 3.

Letters
• The letter “A” is the pattern 01000001. By using context, like the file
format, different programs can interpret and display the same bits as
numbers or text. [[Pasted image 20220622170547.png]]

Unicode
• Other characters, such as letters with accent marks and symbols in other
languages, are part of a standard called Unicode, which uses more bits
than ASCII to accommodate all these characters.
• This includes emojis: For example, the “face with medical mask” emoji is
just the four bytes 11110000 10011111 10011000 10110111: [[Pasted image
20220622171206.png]]

Colours
How do computers represents colours?
• With bits, we can map numbers to colours as well. There are many dif-
ferent systems to represent colours, but a common one is RGB, which
represents colours by indicating the amount of red, green, and blue within
each color.
• Each number might be 8 bits, with 256 possible values, so with three bytes,
or 24 bits, we can represent millions of colours
• The dots, or squares, on our screens are called pixels, and images are
made up of many thousands or millions of those pixels as well. We
can see pixels in an emoji if we zoom in, for example: [[Pasted image
20220622171719.png]]
• Videos are sequences of many images, changing multiple times a second
to give us the appearance of motion

Algorithm
• A sequence of steps to do something

2
• We might open the book and start from the first page, looking for a name
one page at a time. This algorithm would be correct, since we will even-
tually find the name if it’s in the book.
• We might flip through the book two pages at a time, but this algorithm
will not be correct since we might skip the page with our name on it.
• Another algorithm would be opening the phone book to the middle, decide
whether our name will be in the left half or right half of the book (because
the book is alphabetized), and reduce the size of our problem by half. We
can repeat this until we find our name, dividing the problem in half each
time.

Pseudocode Write “code” in a human language (like English)


1 Pick up phone book 2 Open to middle of phone book 3 Look at page 4 If
person is on page 5 Call person 6 Else if person is earlier in book 7 Open to
middle of left half of book 8 Go back to line 3 9 Else if person is later in book
10 Open to middle of right half of book 11 Go back to line 3 12 Else 13 Quit

Scratch Basics
• Useful to put ideas in code, but without the strange syntax
• It uses a coordinate system (x,y)
• Categories: Motion (moving, rotating), Looks (put things in the screen),
Sound (play sounds), Events (Make things happen, when something hap-
pens (triggered by something)), Control (wait, repeat, loop, conditionals),
Sensing (Ask questions about the things that are happening, i.e distance
to something), Operators (Math, Random numbers, combine things), Vari-
ables (Store values in other words)
– My blocks: Create your own blocks, turn several pieces into one,
connecting them, create functions
Input -> function -> output David -> say “Hello” + answer -> Hello David

Abstraction
If there’s something we wanted to change, we would only need to change it in
one place instead of three.
• Combining several ideas in just one, makes the job easier, and makes
harder for a bug to appear.

You might also like