21
Introduction to Computer Science and Programming in C Session 1: September 2, 2008 Columbia University

Introduction to Computer Science and Programming in Cbert/courses/1003/lecture1.pdf · Introduction to Computer Science and Programming in C Session 1: September 2, 2008 Columbia

Embed Size (px)

Citation preview

Page 1: Introduction to Computer Science and Programming in Cbert/courses/1003/lecture1.pdf · Introduction to Computer Science and Programming in C Session 1: September 2, 2008 Columbia

Introduction to Computer

Science and Programming in

CSession 1: September 2, 2008

Columbia University

Page 2: Introduction to Computer Science and Programming in Cbert/courses/1003/lecture1.pdf · Introduction to Computer Science and Programming in C Session 1: September 2, 2008 Columbia

Administrative

Page 3: Introduction to Computer Science and Programming in Cbert/courses/1003/lecture1.pdf · Introduction to Computer Science and Programming in C Session 1: September 2, 2008 Columbia

About the course

General overview of Computer Science while learning how to program in C.

Instructor: Bert Huang Tues. 2:30 - 4:30 PM CEPSR 624

TA: Deergha Sahni Wed. 3:00 - 5:00 PM TA roomhttp://ta.cs.columbia.edu/tamap.shtml

Tuesdays and Thursdays at 1:10 PM-2:25 PM

http://www.cs.columbia.edu/~bert/courses/1003

3

Page 4: Introduction to Computer Science and Programming in Cbert/courses/1003/lecture1.pdf · Introduction to Computer Science and Programming in C Session 1: September 2, 2008 Columbia

Requirements and Textbooks

Basic computer skills

CUNIX account

The C Programming Language (2nd Edition) by Brian Kernighan and Dennis Ritchie

Practical C Programming (3rd Edition) by Steve Oualline

4

Page 5: Introduction to Computer Science and Programming in Cbert/courses/1003/lecture1.pdf · Introduction to Computer Science and Programming in C Session 1: September 2, 2008 Columbia

Course Policies

Grading:

4 homework assignments, 15% each.

In-class Midterm Exam, 15%

Final Exam, 20%

Class Participation, %5

5

Page 6: Introduction to Computer Science and Programming in Cbert/courses/1003/lecture1.pdf · Introduction to Computer Science and Programming in C Session 1: September 2, 2008 Columbia

Course Policies

Grievances:

Type and print argument/correction on paper and deliver to TA.

Attendance and Reading

In your best interest.

6

Page 7: Introduction to Computer Science and Programming in Cbert/courses/1003/lecture1.pdf · Introduction to Computer Science and Programming in C Session 1: September 2, 2008 Columbia

Academic Honesty

Assignments in this course should be done individually.

http://www.cs.columbia.edu/education/honesty/

7

Page 8: Introduction to Computer Science and Programming in Cbert/courses/1003/lecture1.pdf · Introduction to Computer Science and Programming in C Session 1: September 2, 2008 Columbia

Courseworks

We will be using the courseworks message board. http://courseworks.columbia.edu

8

Page 9: Introduction to Computer Science and Programming in Cbert/courses/1003/lecture1.pdf · Introduction to Computer Science and Programming in C Session 1: September 2, 2008 Columbia

Who am I?PhD student in Computer Science department.

I do Machine Learning research:

A mix of Artificial Intelligence and Statistics.

I learned to program in C eight years ago.

Still use it often when I need very efficient programs. For everyday research I use MATLAB.

9

Page 10: Introduction to Computer Science and Programming in Cbert/courses/1003/lecture1.pdf · Introduction to Computer Science and Programming in C Session 1: September 2, 2008 Columbia

Who are you?

Non-CS majors looking for programming skills.

Potential CS majors (warning).

You will learn C but you should be able to quickly pick up other programming languages.

10

Page 11: Introduction to Computer Science and Programming in Cbert/courses/1003/lecture1.pdf · Introduction to Computer Science and Programming in C Session 1: September 2, 2008 Columbia

Introduction to “Introduction to

Computer Science and Programming in C”

Page 12: Introduction to Computer Science and Programming in Cbert/courses/1003/lecture1.pdf · Introduction to Computer Science and Programming in C Session 1: September 2, 2008 Columbia

What is Computer Science?

Scientific study of computers.

“What can and can’t computers do?”

“If a computer can do something, how can we do it efficiently?”

12

Page 13: Introduction to Computer Science and Programming in Cbert/courses/1003/lecture1.pdf · Introduction to Computer Science and Programming in C Session 1: September 2, 2008 Columbia

What is a computer?

A device that executes a sequence of computations and instructions.

Modern computers are electronic and digital.

Does pencil and paper count as a computer?

13

Page 14: Introduction to Computer Science and Programming in Cbert/courses/1003/lecture1.pdf · Introduction to Computer Science and Programming in C Session 1: September 2, 2008 Columbia

Programs

These sequences of instructions and computations is called a program.

We’ll be designing programs in this course.

These programs will be based on algorithms.

Algorithm - a step-by-step problem-solving procedure.

14

Page 15: Introduction to Computer Science and Programming in Cbert/courses/1003/lecture1.pdf · Introduction to Computer Science and Programming in C Session 1: September 2, 2008 Columbia

Algorithms

Example Problem to solve: Add a list of large numbers.123 + 456 + 789 = ?

Too much to compute in one step, so break down into smaller steps.

123 + 456 + 789 = 1,368

15

Page 16: Introduction to Computer Science and Programming in Cbert/courses/1003/lecture1.pdf · Introduction to Computer Science and Programming in C Session 1: September 2, 2008 Columbia

Algorithms

Why are algorithms important?

Need to break down tasks into instructions computers are able to execute.

By defining algorithms, we can describe how to solve even more complex tasks.

(123 + 456) + 789

16

Page 17: Introduction to Computer Science and Programming in Cbert/courses/1003/lecture1.pdf · Introduction to Computer Science and Programming in C Session 1: September 2, 2008 Columbia

Languages

Computers operate on binary circuits:

bits are either on (1) or off (0).

Basic operations (adding, multiplying, etc).

But we do not want to write our programs in 0’s and 1’s!

Instead we use programming languages.

17

Page 18: Introduction to Computer Science and Programming in Cbert/courses/1003/lecture1.pdf · Introduction to Computer Science and Programming in C Session 1: September 2, 2008 Columbia

Languages

Want language to be close to English, but more precise.

PCP describes legal system as attempting to program using imprecise English.

Many disputes over interpretation of wording in legal text.

18

Page 19: Introduction to Computer Science and Programming in Cbert/courses/1003/lecture1.pdf · Introduction to Computer Science and Programming in C Session 1: September 2, 2008 Columbia

LanguagesWe will learn the C programming language.

C is a “high-level” language; close to English.

C was designed in the 1970’s by Dennis Ritchie for programming operating systems: Unix.

C is very popular and is the basis for a few other popular languages:

C++, Java, Objective-C, C#19

Page 20: Introduction to Computer Science and Programming in Cbert/courses/1003/lecture1.pdf · Introduction to Computer Science and Programming in C Session 1: September 2, 2008 Columbia

Characteristics of C

C is both praised and criticized for the amount of freedom given to the programmer.

C is a compiled language

a compiler analyzes your code and translates it to efficient machine code.

We will be using the open-source GNU Compiler Collection or “gcc”

20

Page 21: Introduction to Computer Science and Programming in Cbert/courses/1003/lecture1.pdf · Introduction to Computer Science and Programming in C Session 1: September 2, 2008 Columbia

Reading

Read Chapter 1 in Practical C Programming.

Short introduction which basically goes over what we talked about today, in more detail in some parts and less detail in others.

21