CSE 111, Fall 2000
 

Great Ideas in Computer Science

Lecture Notes #2

1.  3 Great Insights of Computer Science

I.  There are only 2 objects that a computer has to
    deal with in order to represent "anything"

II.  There are only 5 actions that a computer has to
     perform in order to do "anything"

III.  There are only 3 ways of combining these
      actions (into more complex ones)
      that are needed in order for a computer
      to do "anything"
 

2.  What's an "object"?  An "action"?

    - Every language has nouns
            (= words/phrases that name/describe
                    things (objects))
       & verbs
            (= words/phrases that name/describe actions)
       & rules of grammar
            (= rules for combining nouns & verbs
                into sentences)

    - Every problem requires you to do something to
        (i.e., perform some action on)
        some objects in order to transform them in
        some way

    - Therefore, programming languages need
        nouns, verbs, & rules of grammar
       to describe these transformations

        * Insight I = only need 2 nouns
        * Insight II = only need 5 verbs
        * Insight III = only need 3 rules of grammar

        & they are nouns, verbs, & rules
           that a computer can easily deal with.
 

3.  Insight I:

    Only need 2 nouns (representing 2 objects)
    to talk about/represent "anything"

    (e.g., Morse code:  dots & dashes)

    a)    -    Every instruction can be expressed in some
                language (English, Pascal, Java, ...)
                i.e., as a sequence ("string") of
                      words, numerals, etc.

            -    Every letter of every word
                  can be expressed as a numeral
                    e.g., A = 1, ..., Z = 26
                    e.g., ASCII code
                            *    has codes for caps, lower case,
                                  symbols, numerals,
                                  punctuation
                            *    there are codes for other
                                  alphabets (Unicode)
                            *    langs like Japanese, Chinese,
                                 Arabic, Hebrew, etc.,
                                 pose other problems
                                  - open area of research

            -    Note:
                 A numeral is a representation for a
                 number;
                    e.g.,    1, I, one, / , un, uno
                              are 6 numerals
                              representing the same number

                              5, V, five, ///// , cinq, cinque,
                              are 6 numerals
                              representing another number

            -    Every numeral can be expressed
                  in binary notation
                   i.e., as 0s and 1s
                    e.g.,

decimal binary
0 0
1 1
2 10
3 11
4 100
5 101
6 110
7 111
8 1000
9 1001
10 1010
11 1011
... ...
99
100
101
...
999
1000

                    *    exericise for reader:
                         fill in the rest of the "binary" column

                    *    decimal notation:

___ ___ ___ ___ ___
10000s
place
1000s
place
100s
place
10s
place
1s
place

                Each "place" is 10 times the one to its right.

                        e.g.,     748 = 7 100s + 4 10s + 8 1s
                                         = 7x100  +  4x10  + 8x1
                                         =  700     + 40     + 8

                        NOTE:  The symbols "0", "1", "2", "3",
                                    "4", "5", "6", "7", "8", "9"
                                    are called "digits"

                    *    binary notation:

___ ___ ___ ___ ___
16s
place
8s
place
4s
place
2s
place
1s
place

                Each "place" is 2 times the one to its right.

                e.g.,     101 (in binary) = 1 4s + 0 2s + 1 1s
                                                 = 1x4  + 0x2  + 1x1
                                                 =  4    +    0    +  1
                                                 =  5 (in decimal)

                        NOTE:  5 (in decimal) and 101 (in
                                    binary) are 2 numerals
                                    representing the same
                                            number.

                        NOTE:  The symbols "0", "1" are called
                                "binary digits", or "bits" for short

            -  0s and 1s can be physically represented
                (or "implemented") by:
                    *    electrical signals
                         (on/off, high/low voltage)
                    *    magnets
                         (north/south,
                          magnetized/not magnetized)
                    *    etc. -- anything with 2 states
                            >    those 2 states are the 2 objects
                                  that "0" and "1" are nouns for

            -    BUT:    This does NOT imply that
                             "computers (only) deal with
                             numbers"
                  Rather:    (digital) computers deal with 2
                                        states

           e.g.    WRITE(7)    could be coded
                  (or represented) in ASCII as:

                    8782738469405541

                  (where 87 is ASCII for "W", ...,
                    &       41 is ASCII for ")" )

                                                    NOTE:  In ASCII, which runs from
                                                                 "blank" = 32 (decimal)
                                                                              = 00100000 (binary)
                                                                 to "~" = 126 (decimal)
                                                                           = 001111110 (binary),
                                                                 "0" = 48, ..., "9" = 57, ...,
                                                                 "A" = 65, ..., "Z" = 90
                                                                (& 0-31, 127-255 are either
                                                                not used or used for non-printing
                                                                "characters" like <return>)

                    which, converted to binary, would be:

                    01010111...00101001

                    (where 87 (decimal) = 01010111 (binary),
                    etc.)

           -    How to represent more complex info?
                    *    that's the study of "data structures"
                         (in computer science)
                         & "knowledge representation" (in AI)


Copyright © 2000 by William J. Rapaport (rapaport@cse.buffalo.edu)

file: 111F00/lecturenotes2.06sp00.html