What is computer science?
- Computer Science is basically problem-solving.
-
Problem-solving: We can consider Problem-solving as a process of taking some input
(problem details) apply computer science to it (algorithm) and generate some output(solution of the problem).
-
It is a number system in which there are just two digits, 0 and
1.
-
At our initial stage of counting, we might have used our finger to represent one thing(👉one finger for one thing🍬). That system is called unary. for example, if we want to represent 3 we can represent it in the following way (1+1+1) in unary.
-
writing number using digits 0 through 9 is called decimal. for
example, we know one hundred twenty-three can be represented as
123.
-
3 at one's place 2 at ten's place and 1 at hundred's place.
-
123=
100×1+10×2+1×3 = 102×1+101×2+100×3
-
each place for a digit represent the power of 10, and there are ten
possible digits for each place.
-
Position
10position
value
digit(0-9)
final value
0
100
1
3
1×3= 3
1
101
10
2
10×2= 20
2
102
100
1
100×1= 100
3
103
1000
0
1000×0= 0
final value = (0+100+20+3)=123
- In binary, we have the power of 2 for each place with just 2 digits (0 and 1).
- we can represent 0 as (0000), 1 as (0001), 2 as(0010), 3 as(0011), 4 as (0100),5 as(0101),6 as (0110),7 as (0111),8 as (1000) in binary.
Position 2position value digit(0/1) final value 0 20 1 0 1×0= 0 1 21 2 0 2×0= 0 2 22 4 0 4×0= 0 3 23 8 1 8×1= 8
- 3 at one's place 2 at ten's place and 1 at hundred's place.
- 123= 100×1+10×2+1×3 = 102×1+101×2+100×3
- each place for a digit represent the power of 10, and there are ten possible digits for each place.
-
Position 10position value digit(0-9) final value 0 100 1 3 1×3= 3 1 101 10 2 10×2= 20 2 102 100 1 100×1= 100 3 103 1000 0 1000×0= 0
- we can represent 0 as (0000), 1 as (0001), 2 as(0010), 3 as(0011), 4 as (0100),5 as(0101),6 as (0110),7 as (0111),8 as (1000) in binary.
Position 2position value digit(0/1) final value 0 20 1 0 1×0= 0 1 21 2 0 2×0= 0 2 22 4 0 4×0= 0 3 23 8 1 8×1= 8
Representing data- To represent letters we need to know how numbers mapped to letters many years ago some humans collectively decided on a standard mapping called ASCII(American Standard of Code for Information Interchange).for example letter "A" is the number 65(1000001), and B is 66 and so on.
- The mapping also includes punctuation and other symbols like emoji, accent marks etc.
- when we receive an emoji(crying out of joy😂) our computer is just receiving a decimal number like 128514(11111011000000010).
- An image is comprised of many square dots or pixel, each of which can be represented in binary with a system called RGB(Red Green Blue), we have to decide a colour intensity(0 to 100) of each (RGB) to get a new colour. for example when we mix(72-red,73-green,33-blue) we will get a yellow colour.


- when we receive an emoji(crying out of joy😂) our computer is just receiving a decimal number like 128514(11111011000000010).
on combining RGB (72,73,33) we will get yellow.
- Computer program knows based on the context of its code, whether the binary number should be interpreted as a number, or letter or pixel.
- videos are just many images playing one after another with some number of frames per second. Music too can be represented by the notes being played, their duration and their volume.
Algorithms
- Computer Science is basically is an Algorithm.
- Step by step instruction of solving problem is known as an algorithm.
- let's say we want to find a friend, Mohith in a phonebook we can try various approach.
- We could start by flipping through the book, one page at a time until we find Mohith or reach the end of the book.
- We could also flip two pages at a time, but if we go too far, we’ll have to know to go back a page.
- But an even more efficient way would be opening the phone book to the middle, decide whether Mohith will be in the left half or right half of the book (because the book is alphabetized), and immediately throw away half of the problem. We can repeat this, dividing the problem in half each time. With 1024 pages to start, we would only need 10 steps of dividing in half before we have just one page remaining to check.
- So all the three algorithms which we have mentioned above is true but each algorithm has different efficiency.
- Our first solution, one page at a time, is like the red line: our time to solve increases linearly as the size of the problem increases.
- The second solution, two pages at a time, is like the yellow line: our slope is less steep but still linear.
- Our final solution is like the green line: logarithmic, since our time to solve rises more and more slowly as the size of the problem increases. In other words, if the phone book went from 1000 to 2000 pages, we would need one more step to find Mohith. If the size doubled again from 2000 to 4000 pages, we would still only need one more step.
- We could start by flipping through the book, one page at a time until we find Mohith or reach the end of the book.
- We could also flip two pages at a time, but if we go too far, we’ll have to know to go back a page.
- But an even more efficient way would be opening the phone book to the middle, decide whether Mohith will be in the left half or right half of the book (because the book is alphabetized), and immediately throw away half of the problem. We can repeat this, dividing the problem in half each time. With 1024 pages to start, we would only need 10 steps of dividing in half before we have just one page remaining to check.
- Our first solution, one page at a time, is like the red line: our time to solve increases linearly as the size of the problem increases.
- The second solution, two pages at a time, is like the yellow line: our slope is less steep but still linear.
- Our final solution is like the green line: logarithmic, since our time to solve rises more and more slowly as the size of the problem increases. In other words, if the phone book went from 1000 to 2000 pages, we would need one more step to find Mohith. If the size doubled again from 2000 to 4000 pages, we would still only need one more step.
No comments:
For Query and doubts!