# Computer Science 101

It’s very common to hear in your CS 101 class, ‘Everything is 1’s and 0’s in the computer world’. Let explore this idea which is the foundation upon which the most complicated technology you can imagine is built.

There is something called ASCII – you can google it. It’s just a number assigned to most of the characters (i.e. letters and punctuation) that we use.

Ok, so what?

If you put a bunch of 1’s and 0’s together, you can represent any number. Kind of like Morse code. Don’t worry if you don’t know what Morse code is. The idea is – there exists a mapping between a set of 1’s and 0’s and the normal numbers that we use. It goes something like this if we take 2 bits:

00 is 0 01 is 1 10 is 2 11 is 3

With 3 bits we can represent 9, with 4 – 16, with 32 bits you can represent more than 4.2 billion numbers and so on.

Watch the movie The Matrix. It takes this idea to the next level.

So if a bit (a single 1 or 0 is called a bit) can be mapped to a number and a number can be mapped to a character (using ASCII). We can now represent any sentence ever spoken (in English) using just ones and zeros. Of course, this sequence is for a computer to understand. They might be dumb but believe me, they are wicked fast.

Let’s take this idea a little further. How do we store our music with 1’s and 0’s ?

Sound is just a wave. It can be represented on a graph. Don’t believe me? Take a look at it in real-time on this link.

So now the problem is converting this graph into 1’s and 0’s. It’s pretty simple actually. You divide the horizontal axis into a fixed number of parts – say 100. Now for each part, you note the value on the vertical axis. So for 100 parts on the horizontal axis, maybe you get something like this for the vertical axis.

[54, 87, 32, 98, 132, 85, 31, 78, 235, 941, 79, 23, 14, 412, 6, 34 .... 100 values]

And we know how to Convert Decimal number to Binary number (i.e. 1’s and 0’s).

Boom! You can store audio now.

Raising the bar. How can we store your favorite movie ?

A movie has two parts – audio and video. We already saw how to save audio. A video is a bunch of pictures saved one after the other and then played very fast. Kind of like a flipbook. It’s that simple.

So taking a step back, we need to save a picture in binary.

Let’s try to reverse engineer the answer. i.e. we will look at to solution and then try to figure out how we arrived at it.

Take a look at your laptop or phone or literally any digital screen very closely. You will see 3 color lights. Red, Green and Blue stacked beside each other – there are thousands of them. If you have a cheap display, it is easier to see as these lights are less closely packed in cheap displays.

So these lights light up at different intensities and with a little bit of physics magic called interference, they generate different colors. Yes, it’s either magic or a physics class to understand interference. Your choice.

So now we have a color, just like a painting, we put a bunch of colors with different shades together to get a picture. If we are able to store the brightness of the 3 color lights (Red, Green, Blue), we can store a picture.

It’s a hell lot easier now. Let’s say each color can go from a range of 0 to 100 in brightness. So now it just takes a few thousand triplets of 3 integers to save a picture in your pocket. And guess what these numbers are converted into for the dumb computer to make sense …..

1's and 0's

## Recommended Posts:

- What is the Importance of Mathematics in Computer Science?
- Computer science, an overrated dream
- Do programmers need a Computer Science degree to get a job?
- 10 Famous Bugs in The Computer Science World
- Python IDEs For Data Science
- 11 Industries That Benefits the Most From Data Science
- Data Science Project Scope and Its Elements
- Computer Animation
- What is Computer Crime?
- What happens when we turn on computer?
- Computer Graphics | Antialiasing
- New Trends In Human Computer Interaction
- Introduction of Firewall in Computer Network
- I Can’t Do Computer Programming – 7 Common Myths You Must Know
- Computer Graphics | The RGB color model

If you like GeeksforGeeks and would like to contribute, you can also write an article using contribute.geeksforgeeks.org or mail your article to contribute@geeksforgeeks.org. See your article appearing on the GeeksforGeeks main page and help other Geeks.

Please Improve this article if you find anything incorrect by clicking on the "Improve Article" button below.