1 / 30

Introduction to Computer Science

Introduction to Computer Science. Raj Bhatnagar Department of Computer Science University of Cincinnati. Administrivia. Lecture 1-1:50, M,W 860D (Raj Bhatnagar) Lab 2-2:50 M,W 860D (Raj and TA) Office Hours: M,W 11-12 (Raj’s Office – 835 Rhodes)

Download Presentation

Introduction to Computer Science

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. Introduction to Computer Science Raj Bhatnagar Department of Computer Science University of Cincinnati

  2. Administrivia • Lecture 1-1:50, M,W 860D (Raj Bhatnagar) • Lab 2-2:50 M,W 860D (Raj and TA) • Office Hours: M,W 11-12 (Raj’s Office – 835 Rhodes) • Lectures Focus: What is CS; Problems CS seeks to solve; • Lab Focus: Some programming exercises in MATLAB • Evaluation: Programs in Labs 30% • Quizzes/Tests/ 30% • HW 25% • Final Exam 15%

  3. What is Computer Science About?

  4. What is Computer Science About? "Nobody is going to run 100 meters in five seconds, no matter how much is invested in training and machines. The same can be said about using the brain. The human mind is no different now from what it was five thousand years ago. And when it comes to mathematics, you must realize that this is the human mind at an extreme limit of its capacity." --Herbert Robbins, Mathematician As Commented by Edgar J. Dijkstra, (A well known CS Professor)

  5. What is CS? Computer Science is no more about computers than astronomy is about telescopes. - E. Dijkstra

  6. What is CS? Computer Science is a science of abstraction -creating the right model for a problem and devising the appropriate mechanizable techniques to solve it. - A. Aho and J. Ullman

  7. What is CS? • Understand how a human solves a problem/puzzle • Chess, Sudoku, image understanding, . . . • Write a Recipe – a sequence of instructions on how to solve the problem • Encode the instructions • so that a computer can follow them

  8. Computer Science – Major Tasks How to Achieve the following: • Represent Knowledge in electronic machines • Represent Models of problem solutions • Perform Reasoning • Communicate and collaborate with • Humans • Other Computers • Transfer information to long distances

  9. What is Computer Science? What do CS graduates’ jobs look like? • Make computers solve interesting problems (Applications?) • Most efficiently, effectively • Design computers (Software + Hardware Design) • To solve difficult problems • To integrate with business, sciences, arts, entertainment, and our everyday life • To communicate with humans and with each other

  10. Various Types of Software Software to control Computers • Device Drivers • Written in Assembler language • Every Hardware device needs it • Phones • PDAs • iPODs • Must be very efficient • Must know hardware and software very well

  11. Various Types of Software Operating Systems: • Master Control Program • “Central Nervous System” • Controls all devices • Talks to applications, users, devices, network • Windows, Linux, OS2, etc. • Written in lower level (Assembler) or kind of mid-level (C) languages • Need to know about hardware and software

  12. Various Types of Software System Level Utilities: • On top of the Operating System Layer • File Editors /Compilers/Development Tools • Database Software • Document Editors • File System Managers • Communication Software • Security/Firewall programs • Mail readers / Web Browsers

  13. Various Types of Software Networking software • Control Communication Among Computers • Networking protocols • wireless communications • internet communications • large scale file systems on internet (music, movie archives)

  14. Various Types of Software Application Software – Every aspect of society • Banking, finance, investments • Engineering, science, biology, genetics • Architecture, design, art • Music, computer games, animation movies • Education, on-line tutorials • Retail, airlines, supply chain management • Manufacturing control and planning No domain is untouched! No aspect of life is untouched

  15. Fastest Growing Professions - BLS

  16. Job Market Projections by BLS 1 million new jobs by 2014

  17. CS(BS) Salaries - 2006 National Trends - 2006 UC Graduates in CS (BS) 2006 Out of 16 Graduates: (14 responded to the survey) 5 - Continuing for Graduate Degrees 9 – Entered Job Market Avg. Salary: $76,000 Max. Salary: $140,000 Min. Salary: $48000

  18. Codes to Represent Information • Morse Codes to represent letters • Use “-” and “.” to encode alphabets • Only two symbols in the “Morse-Language” • Digital computers’ language: (0,1) • Represent all symbols in language (0,1) • Need to encode “A”, “B”. . . in (0,1) • ASCII codes

  19. ASCII Codes

  20. NumberBase • Number representation in Base 2, 3, 4, . . .10 • Convert from Base 10 (Decimal) to Base 2 (Binary) • Convert from Binary to Decimal • Base 16 (Hexadecimal) Numbers • Need 16 Symbols (0, 1, 2, 3, . . . A, B, C, D, E, F) • Conversion: Hexadecimal <> Decimal • Conversion: Hexadecimal <> Octal (Base 8) • Conversion: Hexadecimal <> Base 3 • Conversion: Hexadecimal <> Binary

  21. NumberBase (1278)10 = 1278 (1278)16 = 4FE (1278)2 = 010011111110 (1278)8 = 2376 (1278)2 = 010011111110 (1278)4 = 103332 (1278)2 = 010011111110 Binary numbers are easily read as Hexadecimal numbers

  22. Fractions in Binary What is (0.25)10 in base 2?

  23. Converting fractions to Binary • Step 1: Begin with the decimal fraction and multiply by 2. The whole number part of the result is the first binary digit to the right of the point. • Because .625 x 2 = 1.25, the first binary digit to the right of the point is a 1.So far, we have .625 = .1??? . . . (base 2) . • Step 2: Next we disregard the whole number part of the previous result (the 1 in this case) and multiply by 2 once again. The whole number part of this new result is the second binary digit to the right of the point. We will continue this process until we get a zero as our decimal part or until we recognize an infinite repeating pattern. • Because .25 x 2 = 0.50, the second binary digit to the right of the point is a 0.So far, we have .625 = .10?? . . . (base 2) . • Step 3: Disregarding the whole number part of the previous result (this result was .50 so there actually is no whole number part to disregard in this case), we multiply by 2 once again. The whole number part of the result is now the next binary digit to the right of the point. • Because .50 x 2 = 1.00, the third binary digit to the right of the point is a 1.So now we have .625 = .101?? . . . (base 2) . • Step 4: In fact, we do not need a Step 4. We are finished in Step 3, because we had 0 as the fractional part of our result there. • Hence the representation of .625 = .101 (base 2) .

  24. Infinite Binary Fractions • Step 1: Begin with the decimal fraction and multiply by 2. The whole number part of the result is the first binary digit to the right of the point. • Because .1 x 2 = 0.2, the first binary digit to the right of the point is a 0.So far, we have .1 (decimal) = .0??? . . . (base 2) . • Step 2: Next we disregard the whole number part of the previous result (0 in this case) and multiply by 2 once again. The whole number part of this new result is the second binary digit to the right of the point. We will continue this process until we get a zero as our decimal part or until we recognize an infinite repeating pattern. • Because .2 x 2 = 0.4, the second binary digit to the right of the point is also a 0.So far, we have .1 (decimal) = .00?? . . . (base 2) . • Step 3: Disregarding the whole number part of the previous result (again a 0), we multiply by 2 once again. The whole number part of the result is now the next binary digit to the right of the point. • Because .4 x 2 = 0.8, the third binary digit to the right of the point is also a 0.So now we have .1 (decimal) = .000?? . . . (base 2) . • Step 4: We multiply by 2 once again, disregarding the whole number part of the previous result (again a 0 in this case). • Because .8 x 2 = 1.6, the fourth binary digit to the right of the point is a 1.So now we have .1 (decimal) = .0001?? . . . (base 2) . • Step 5: We multiply by 2 once again, disregarding the whole number part of the previous result (a 1 in this case). • Because .6 x 2 = 1.2, the fifth binary digit to the right of the point is a 1.So now we have .1 (decimal) = .00011?? . . . (base 2) .

  25. Infinite Binary Fractions (0.1)10 = (0.00011001100110011)2 Lab Assignment for Today Write a matlab program that accepts a number with a fraction Part as input and converts both parts to a given base.

  26. Representation? • How are their representations different? • A character “1” (ascii representation is “01001001”) • A bit “1” (“1”) • A value of 1 (00000001) • A value 0f 1.0( ?? ) • Representation is a mere abstraction • Abstract concepts (character 1, value 1, bit 1) • Each has a different concrete representation • Can you peek into the bit string in a memory and decide what you are seeing?

  27. We need Compact Code • An image with 1 million pixels • Each pixel has three color-levels (RGB) (0-255) • 3 bytes per pixel • 3 million bytes to store an image • Can we make the code compact? • All 255 values are not used in an image • Some values are used more often than the others • Does this information help in designing a compact code?

  28. Compact Code • Example: • Alphabet: (A, B, C, D, E, F, G, H) • Bits needed to represent each symbol: 3 • A book written with above alphabet has 1 million letters • Bits needed to store the book: 3 million • Frequency with which letters are used is: • (A B C D E F G H) • (0.2 0.05 0.05 0.15 0.2 0.1 0.20 0.05) • How do we decide codes for these alphabets? • READ about HUFFMAN CODES on Wikipedia

  29. Huffman Coding http://en.wikipedia.org/wiki/Huffman_coding

  30. Things you should know by now • How to convert a number from one base to another base • Bases 2 through 16 • Numbers containing fractional parts • What are ASCII codes • Why fixed-width codes are better than variable-width codes • Why variable-width codes are better than fixed-width codes • MATLAB • Basic statements • Simple programs for base conversion

More Related