120 likes | 244 Views
What is Computer Science 1. We learn how to program a computer using a mixture of C and C++ Basic constructs of the C++ language How to design and use simple data structures Understand the issues that matter to Computer Scientists and Professional Programmers
E N D
What is Computer Science 1 • We learn how to program a computer using a mixture of C and C++ • Basic constructs of the C++ language • How to design and use simple data structures • Understand the issues that matter to Computer Scientists and Professional Programmers • How to write complex programs quickly and efficiently • How to develop algorithms • How to organize data • How to maximize the reuse of data and programs • This course is the first in a sequence • CS1 - basic programming • CS2 - data structure programming • DSA - advanced programming and data structures Computer Science I - Martin Hardwick
What you must ask yourself • Do I want to learn the details of programming? • Many computing activities such as using a spreadsheet or a database do not require you to understand how to write algorithms • Getting a program right can take a long time and be very tedious if you do not like sitting in front of a computer trying again and again • The experience and knowledge can be rewarding • Many problems in business, science and engineering can only be solved by writing a program • Most people will have to work with programmers during their careers so understanding what they do should be helpful • If you want to be a Computer Scientist and have not taken any Computer Science courses then you should start with CS1 Computer Science I - Martin Hardwick
Alternatives • If you think this course will be too hard but you still want to learn something about programming consider taking • CSCI 1190 Beginning C Programming for Engineers • BUT you cannot get credit for CS 1190 and any other CS course • If you think this course will be too easy consider going straight to CS II • Recommended for students with AP credit in Computer Science • You will not enjoy being bored • You will make it difficult for me to judge how well the course is progressing • Your fellow students will find it unpleasant watching you rush through the studios Computer Science I - Martin Hardwick
Organization of CS 1 • Lectures • On the topic of the previous and following Studio assignments • Background and context information that you will not get from just doing the studio assignment • There will be 10 quizzes during the lectures • Studios • Break into smaller sections – one TA per section – each section has its own lab time and location • Progressively learn how to write more complex C++ programs • Studio attendance is required and will be part of your grade • Exams • One final exam – which will also be your last chance to show you know how to write programs and algorithms • Homework • 4 Homework’s. First will be given at about Lecture 10. Computer Science I - Martin Hardwick
Grading • Look at the rules in the syllabus • I will follow these rules when computing your grade • 40% Quizzes (best 8 @ 5% each) • 20% Studios (best 20 @ 1% each) • 24% Homeworks (4 @ 6%) • 16% Final • A >= 90, B >= 80, C >= 70 D > = 60 F < 60 • I may raise your grade but I will never lower it unless you are caught cheating. • We make extensive use of RPI LMS in this course • Distribution of lecture notes (before the lecture) • Homework assignments • Distribution of grades for Studios, Homework’s and Exams • Announcements • The bulletin board • A good place to ask questions late at night. • Do not be rude to me, the TA’s or your fellow students. Computer Science I - Martin Hardwick
Getting Started • A computer is a device for solving problems. • its advantage is its speed • Programming is nothing more than telling a computer how to solve a specific problem. • you can’t do this unless you know how to solve the problem yourself • Steps in using a computer: • understand the problem to be solved • figure out how to solve it yourself • develop an algorithm to solve the problem • write a program to tell the computer how to solve the problem Computer Science I - Martin Hardwick
Algorithms • An algorithm is a step-by-step set of instructions for solving a problem. • must be complete • must be unambiguous • must be in terms that are understood by the reader (man or machine) • An algorithm must have enough detail for the purpose • Algorithm to be given to a knowledgeable programmer (less detail) • Algorithm to be compiled on a machine (more detail) • In CS 1 nearly all our algorithms will be for the machine Computer Science I - Martin Hardwick
An Algorithm for people • How to make a Rocky Road Egg • Input : One egg. One Piece of bread. One Frying pan. One vat of margarine. One knife. One stove with burner. • Algorithm : • Spread margarine on both sides of bread with knife. • Cut a hole in the center of the bread with the knife. • Turn the burner on the stove on. • Put the frying pan on the turned on burner. • Put the bread on the frying pan. • Crack egg in the hole in the bread. • Wait 1.5 minutes and then flip bread. • Wait 1 minute then remove bread with egg from frying pan. • Output : A Rocky Road Egg Computer Science I - Martin Hardwick
A machine Algorithm has to be very detailed • Because a computer can only: • add two numbers • subtract two numbers • multiply two numbers • divide two numbers • compare two numbers to determine which is bigger • based on a comparison, jump to a different part of a program • save a number in a word of memory or a register • fetch a number from a word of memory or a register • read data from an input device • write data to an output device • read and write data to secondary storage • interpret numbers as characters (e.g., letters of the alphabet) • Fortunately the compiler breaks our C++ algorithms into these really simple pieces • In CS 1 we will learn how to write C++ algorithms and how to use the C++ compiler to convert them into programs. Computer Science I - Martin Hardwick
Computer I/O Devices RAM (memory) Central Processing Unit (CPU) Registers Secondary Storage Computer Organization Our programs manipulate this. As we advance we will learn more about its details • Sometimes called random access memory (RAM). • Stores the numbers (data) that a program uses when it runs on the computer. • Also stores the instructions of the program that is running on the computer. • Divided into fixed size units of memory called words. • each word stores one number Data Program Instructions Computer Science I - Martin Hardwick
Number Systems • You are familiar with the base 10 number system in which each digit of a number is multiplied by a power of 10. • for example: 4325 = 4x103 + 3x102 + 2x101 + 5x100 • for example: 103.23 = 1x102 + 0x101 + 3x100 + 2x10-1 + 3x10-2 • Other number systems with a base different from 10 work in a similar fashion. • base 8 number system: 521.48 = 5x82 + 2x81 + 1x80 + 4x8-1 (337.5) • base 2 number system: 101.12 = 1x22 + 0x21 + 1x20 + 1x2-1 (5.5) • A base X number system uses X symbols for digits. • namely, the symbols: 0, 1, …, X-1 • Two number systems are widely used in computers • binary -- base 2 with digits 0 and 1 • hexadecimal -- base 16 with digits 0, 1, 2, …, 9, A, B, C, D, E, F • 12A4F16 = 1x164 + 2x163 + 10x162 + 4x161 + 15x160 (76367) Computer Science I - Martin Hardwick
Computer Number System Examples 10110101110001011001110011110110 binary number 11 5 12 5 9 12 15 6 equivalent base 10 value for each group of 4 consecutive binary digits (bits) B 5 C 5 9 C F 6 corresponding hexadecimal (base 16) digit B5C59CF6 equivalent hexadecimal number Computer Science I - Martin Hardwick