Presentation is loading. Please wait.

Presentation is loading. Please wait.

CS201 - Intro. to Sabancı University1 CS 201 - Introduction to Computing Albert Levi FENS 1091

Similar presentations


Presentation on theme: "CS201 - Intro. to Sabancı University1 CS 201 - Introduction to Computing Albert Levi FENS 1091"— Presentation transcript:

1 CS201 - Intro. to Computing @ Sabancı University1 CS 201 - Introduction to Computing Albert Levi FENS 1091 levi@sabanciuniv.edu

2 CS201 - Intro. to Computing @ Sabancı University2 Course Information l CS201 – Introduction to Computing ä Website - http://people.sabanciuniv.edu/levi/cs201 ä also follow SUCourse ä an e-mail list will be used for announcements so you are responsible to check your e-mails (sabanciuniv account) l Instructor: Albert Levi, FENS 1091, ext. 9563, levi@sabanciuniv.edu l Schedule ä Lectures: Monday 13:40 – 15:30, Tuesday 9:40 – 10:30, All in FENS G077 (auditorium) ä Recitations will start first week See schedule for date, time and location Recitations will also be used as labs, so please take your laptops (with power and Ethernet cables) to recitations ä Attend all. It is to your benefit. l Weekly or Biweekly Homework Assignments (total 7 assignments) l Textbook: A Computer Science Tapestry, by Astrachan ä http://www.cs.duke.edu/csed/tapestry/

3 CS201 - Intro. to Computing @ Sabancı University3 Course Policy l Two Midterm Exams + Final Exam + 7 homework assignments ä Midterms are each 23% Midterm 1: November 7, 2015, Saturday 14:00 – 16:00 Midterm 2: December 5, 2015, Saturday 10:00 – 12:00 ä Final exam (34%) will be scheduled by SR ä Homework assignments are total 20% and all will be counted they are not of equal weight (distribution of 20% among assignments will be determined at the end of the course) l No late homework without penalty ä One late day is allowed at cost of 10% of full grade l Plagiarism will not be tolerated ä Homeworks are to be done personally ä Cooperation is not an excuse If you do not know how to cooperate, don’t do it ä we use software tools to detect plagiarized homework ä first case –100 (minus hundred), second fails the course! ä Homework traders and plagiarizers are also reported to the dean's office for disciplinary actions ä read the detailed policy on the web site of the course - http://people.sabanciuniv.edu/levi/cs201/policy_plagiarism.html http://people.sabanciuniv.edu/levi/cs201/policy_plagiarism.html

4 CS201 - Intro. to Computing @ Sabancı University4 Course Policy (cont’d) l Make-ups (detailed policy is on the web) ä reports must come before or during the exam ä you must be really sick to take a make-up exam ä according to the by-laws, acceptance of report is up to the instructor a medical report does not guarantee taking a make-up exam ä make-ups will be harder

5 CS201 - Intro. to Computing @ Sabancı University5 This course will give you l Basic computer science notions l Mostly C++ programming concepts ä with emphasis on computational problems ä Object oriented programming language At the end of this course, you will be able to ä develop algorithms ä write programs using C++ ä but not-so-big-applications

6 CS201 - Intro. to Computing @ Sabancı University6 Before CS 201 Maybe you are afraid of computers Maybe you hate Maybe you used computers just for fun before

7 CS201 - Intro. to Computing @ Sabancı University7 During CS 201 You may have bad dreams at the beginning And you may think of you are going to nuts But if you work properly and spend considerable amount of time...

8 CS201 - Intro. to Computing @ Sabancı University8 At the End of CS 201 Success is yours!

9 CS201 - Intro. to Computing @ Sabancı University9 MS Visual C++ 2012 l Necessary software to write and execute C++ programs ä Actually this one of the alternative systems; there are other alternatives but for the sake of standardization you have to use this l Part of MS Visual Studio.NET (2012) l I strongly recommend using under Windows OS ä If you have a Mac, install windows on it first l You will install to your laptops l Help will be available in first week labs l Check website for instructions on how to install, if you prefer to install before the labs (actually it'd be better if you install before the lab) l You can install ä over the network \\software\microsoft\VisualStudio\Visual_Studio_2012 ä step-by-step installation screenshots are on course web site http://http://people.sabanciuniv.edu/levi/cs201/VisualStudioUltimate2012_Installation_Guide.pdf

10 CS201 - Intro. to Computing @ Sabancı University10 What is Computer Science? l Hard to define ä The study of computers too general ä The study of managing and processing information/data basic idea ä The art of problem solving using computing machinery my definition involves more engineering l The discipline is called informatics in many countries ä especially in Europe

11 CS201 - Intro. to Computing @ Sabancı University11 Computer Science l Computer Science is not only programming ä more than programming l Computer Science is a young discipline ä More than 50 years ä First graduate program at CMU (then Carnegie Tech) in 1965 ä in Turkey first CS department in 1977 l Turing machine (1937) ä abstract machine ä theoretically capable of any computation that we can do with modern computers today l AIM: automated computation

12 CS201 - Intro. to Computing @ Sabancı University12 Alan Turing (1912--1954) l A scientist and mathematician l Instrumental in breaking codes during WW II l Developed mathematical model of a computer called a Turing Machine (before computers) ä solves same problems as a Pentium processor (more slowly) l Showed there are problems that cannot be solved by a computer l Was a long distance runner l committed suicide

13 CS201 - Intro. to Computing @ Sabancı University13 Why both Science and Engineering? l Computer Science and Computer Engineering distinction ä Computer Science is mostly related to software and theoretical parts ä Computer Engineering is mostly related to hardware and systems ä In Turkey and most countries, Computer Science and Engineering departments offer a balanced curriculum Independent of their names

14 CS201 - Intro. to Computing @ Sabancı University14 Computer Science and Engineering l Artificial Intelligencethinking machines, perception l Scientific Computingbiocomputing l Theoretical CSanalyze algorithms l Architecturehardware-software interface l Software Engineeringcreating software products l Hardware EngineeringMicroprocessor based systems l Operating Systems l Graphicsanimation, entertainment l Computer Securityhacking, digital signatures l Computer NetworksCommunicating computers, Internet l …….

15 CS201 - Intro. to Computing @ Sabancı University15 Algorithms l Arabic-originated word l Step-by-step process that solves a problem ä do this, then do that,... ä eventually stops with an answer ä general process rather than specific to a programming language l Issues ä correctness ä complexity and efficiency l I picked a number between 1 and 100 ä You will guess it ä I’ll respond “high”, “low”, “correct”. ä how many guesses needed (worst case)?

16 CS201 - Intro. to Computing @ Sabancı University16 Example Algorithm - Find the minimum l Initial list: 4 6 7 3 9 1 4 5 l Should we sort? 1 3 4 4 5 6 7 9 ä About ( n.log(n)) operations, where n is the number of elements l Optimal algorithm - About n operations ä Pick 4 as the minimum ä Compare 4 to 6 - min is still 4 ä Compare 4 to 7- min is still 4 ä Compare 4 to 3 - Pick 3 as the minimum ä Compare 3 to 9- min is still 3 ä Compare 3 to 1 - Pick 1 as the minimum ä Compare 1 to 4- min is still 1 ä Compare 1 to 5 - We are done and the minimum is 1

17 CS201 - Intro. to Computing @ Sabancı University17 Example Algorithm - Find the minimum

18 CS201 - Intro. to Computing @ Sabancı University18 Data Representation in Computers l Computers are data processing machines l All type of data are represented in numeric format ä numbers - obvious ä colors - RGB values ä characters - ASCII codes l Music files, such as.mp3 files, and video files, such as.mov files are also represented in numbers l Emails,Tweets, Whatsapp messages l Internal representation (at the lowest level) is in binary form ä 0 and 1 ä all arithmetic in binary too l Low level instructions are also in binary ä machine language ä not human readable and programmable!

19 CS201 - Intro. to Computing @ Sabancı University19 Problem Solving and Computers l Computerized problem solving explicitly or implicitly require computation l For examples: ä Arithmetic problems ä Computer graphics (require geometric operations) ä Image Processing (mathematical transformations) l A program is an implementation of an algorithm ä using a specific programming language ä to execute on specific platforms l Let’s develop our first program ä In other words, let’s make use of computer for computation

20 CS201 - Intro. to Computing @ Sabancı University20 First Program l Problem: How many 3-digit positive numbers are there that are divisible by 7, but not divisible by 4? ä Think of an algorithm! l Try all 3-digit numbers between 100 and 999 ä If a number is divisible by 7 but not by 4 Increment a counter l Display the value of the counter l Now let’s see the program ä myfirstprogram.cpp

21 CS201 - Intro. to Computing @ Sabancı University21 Themes and Concepts l Theory ä developing algorithms and evaluating them how fast? Works all the time? Tested? l Language ä needed to express the algorithms to the computers ä programming languages: C++, Java, C, Perl, Fortran, Lisp, Scheme, Visual BASIC,... ä Assembly language, machine language l Architecture ä building blocks of a computer ä Main memory, cache memory, disk, CPU, etc.

22 CS201 - Intro. to Computing @ Sabancı University22 Programming Languages l Formal language, with its own syntax and semantic rules, in order to express the algorithms to the computers l We cannot use natural languages (English, Turkish, Spanish, etc.) for this purpose, because they are ä vague ä ambiguous l Programming languages: ä C++, Java, C, C#, Perl, Python, Fortran, Lisp, Scheme, Visual BASIC,... ä Assembly language, machine language

23 CS201 - Intro. to Computing @ Sabancı University23 High-level Languages and Assembly l Rather than instruct computers at the level of 0s and 1s, higher level languages have been developed. ä Flexible and easier programming int main() { int x, y, z; x = 7; y = 12; z = x * y; return 0; } high-level main: pushl %ebp movl %esp,%ebp subl $12,%esp movl $7,-4(%ebp) movl $12,-8(%ebp) movl -4(%ebp),%eax imull -8(%ebp),%eax movl %eax,-12(%ebp) xorl %eax,%eax jmp.L1.align 4 xorl %eax,%eax jmp.L1 low-level (assembly) lowest-level (binary)

24 CS201 - Intro. to Computing @ Sabancı University24 High-level Languages and Assembly l Compilers translate a high level language, such as C++, into machine-specific executable program (0s and 1s) ä The compiler is a program, input is C++ program, output is an executable program ä In theory, C++ source code works on any machine given a compiler for the machine ä for other languages different compilers are needed l Between machine code and high-level languages: assembly language ä human understandable form of machine code instructions

25 CS201 - Intro. to Computing @ Sabancı University25 Levels of Programming Language - high level int main() { int x, y, z; x = 7; y = 12; z = x*y; return 0; }

26 CS201 - Intro. to Computing @ Sabancı University26 Levels of Programming Language - assembly l Machine specific assembly language, Sparc on left, Pentium on right, both generated from the same C++ code main: save %sp,-128,%sp pushl %ebp mov 7,%o0 movl %esp,%ebp st %o0,[%fp-20] subl $12,%esp mov 12,%o0 movl $7,-4(%ebp) st %o0,[%fp-24] movl $12,-8(%ebp) ld [%fp-20],%o0 movl -4(%ebp),%eax ld [%fp-24],%o1 imull -8(%ebp),%eax call.umul,0 movl %eax,-12(%ebp) nop xorl %eax,%eax st %o0,[%fp-28] jmp.L1 mov 0,%i0.align 4 b.LL1 xorl %eax,%eax nop jmp.L1

27 CS201 - Intro. to Computing @ Sabancı University27 Basic Program Development Steps Analyze Problem Develop Algorithm Design Program Write code on paper Code over the computer Source Code Compile & Build Syntax Errors? Yes Correct it No Run Correct Results? Yes - Done No Correct (Debug)

28 CS201 - Intro. to Computing @ Sabancı University28 A Simple Program l Input three integer numbers and display their sum l Algorithm ä display a prompt for data entry ä input (number 1, number 2, number 3 ) ä sum  number 1 + number 2 + number 3 ä output (sum) l Program ä First we will write the program and run it using MS Visual C++ (sum3num.cpp) ä Then we will see an animation about the steps taken during the execution

29 CS201 - Intro. to Computing @ Sabancı University29 A Simple Program – Execution steps

30 CS201 - Intro. to Computing @ Sabancı University30 Architecture l Von Neumann Model ä John von Neumann founder of game theory part of the Manhattan Project (atomic bomb) ENIAC ä Stored program concept Program is also stored as the data

31 CS201 - Intro. to Computing @ Sabancı University31 Von Neumann Model

32 CS201 - Intro. to Computing @ Sabancı University32 Von Neumann Model l Input Unit ä Provides instructions and data to system ä keyboards ä mouse ä Scanners ä Storage Units like DVD- ROMs, Harddisks, USB sticks, etc. Memory Unit Arithmetic and Logical Unit (ALU) Input Unit Output Unit Control Unit

33 CS201 - Intro. to Computing @ Sabancı University33 Von Neumann Model l Output Unit ä Returns data from system ä monitors ä Printers ä Storage Units like DVD- ROMs, Harddisks, USB sticks, etc. Memory Unit Arithmetic and Logical Unit (ALU) Input Unit Output Unit Control Unit

34 CS201 - Intro. to Computing @ Sabancı University34 Von Neumann Model l Memory ä Storage for instructions and data Memory Unit Arithmetic and Logical Unit (ALU) Input UnitOutput Unit Control Unit

35 CS201 - Intro. to Computing @ Sabancı University35 Von Neumann Model l ALU ä Processes data Memory Unit Arithmetic and Logical Unit (ALU) Input UnitOutput Unit Control Unit

36 CS201 - Intro. to Computing @ Sabancı University36 Von Neumann Model l Control Unit ä Directs processing Memory Unit Arithmetic and Logical Unit (ALU) Input UnitOutput Unit Control Unit

37 CS201 - Intro. to Computing @ Sabancı University37 Von Neumann Model l CPU ä ALU and Control Unit combined Memory Unit Arithmetic and Logical Unit (ALU) Input UnitOutput Unit Control Unit CPU

38 CS201 - Intro. to Computing @ Sabancı University38 Memory l Primary memory is generally RAM (Random Access Memory) ä fast data access ä volatile power goes, data go ä expensive l Secondary memory (storage) ä Disks, tapes, CD-ROMs, DVD-ROMs, usb sticks ä non-volatile ä slow data access ä cheap l ROM (Read-only memory) - Flash memory ä BIOS (Basic Input Output System) - to start the system (before the operating system)

39 CS201 - Intro. to Computing @ Sabancı University39 A Typical Computer System

40 CS201 - Intro. to Computing @ Sabancı University40 A Motherboard

41 CS201 - Intro. to Computing @ Sabancı University41 Central Processing Unit (CPU) l CPU chips ä Core 2 Duo (top) ä Intel 4004 (bottom) l Moore’s Law ä chip “size” (# transistors) doubles every 12--18 months for the same price (formulated in 1965) ä processing power increases ä Intel 4004: 2,300 transistors ä Intel Core i7: up to 1.4 billion transistors Intel 4004 Intel Core i7


Download ppt "CS201 - Intro. to Sabancı University1 CS 201 - Introduction to Computing Albert Levi FENS 1091"

Similar presentations


Ads by Google