compsci 105 ss 2005 principles of computer science lecture 1 lecturer: santokh singh

39
CompSci 105 SS 2005 Principles of Computer Science Lecture 1 Lecturer: Santokh Singh

Upload: arleen-jones

Post on 28-Dec-2015

215 views

Category:

Documents


0 download

TRANSCRIPT

CompSci 105 SS 2005

Principles of Computer Science

Lecture 1

Lecturer: Santokh Singh

Introduction to the CourseLecturerCourse OverviewTeaching StylePolicies

Numbers in the ComputerMagnitude PrefixesRepresenting information in a machineBinary representation of integers

“Welcome to COMPSCI 105 ”

Santokh’s Contact Details:

Office: Room 303 488

4th floor new science bldg. (City)

Telephone: 82283

Email: [email protected]

http://www.cs.auckland.ac.nz/~ssin080

- Santokh

Office Hours

• See COMPSCI 105SS 2005 web pages for details and updates.

• Brief discussions before and after all lectures.

COMPSCI 105 SS Team 2005

Lecturer & Supervisor:

Santokh Singh

Tutor:

Cheung Ling Kelly Yu

Introduction to the Course

Lecturer

Course Overview

Teaching Style

Policies

Numbers in the Computer

Magnitude Prefixes

Representing information in a machine

Binary representation of integers

COMPSCI 101 :

Principles of Computer Programming

COMPSCI 105 :

Principles of Computer Science

Data Structures

Algorithms

Introduction to the Course

Lecturer

Course Overview

Teaching Style

Policies

Numbers in the Computer

Magnitude Prefixes

Representing information in a machine

Binary representation of integers

Summer School

• More intense

• Fewer Lecture Hours

• Better Staff/Student Ratio

• Better Weather (hopefully ;-)

Two Books

TextbookCourse Book

The Course Book

• One free printed and bound copy per student

The Textbook

Carrano and Prichard, “Data Abstraction and Problem Solving with JAVA: Walls and Mirrors”, Addison-Wesley, 2004.

(Can also use 2001 Edition, shown above)

Available from UBS

Lectures

• Outlines

• Readings

• Focus Questions

Tutorials

• 9 Assessed

• 1 “Optional”

• Worth 8%

• Outlines, Readings, Focus Questions

Assignments

Due on Friday of:

Week 2

Week 3

Week 5

Worth 17% total

Test and Exam

Test, Week 4, Worth 10%

Exam, Worth 65%

Class Reps

• Need one from each of the tutorials.

• Their names and contact details will be posted on the course web page.

Introduction to the Course

Lecturer

Course Overview

Teaching Style

Policies

Numbers in the Computer

Magnitude Prefixes

Representing information in a machine

Binary representation of integers

2,000 meters

2 kilometers

2 x 103 meters

Peta- 1015 1,000,000,000,000,000

Tera- 1012 1,000,000,000,000

Giga- 109 1,000,000,000

Mega- 106 1,000,000

Kilo- 103 1,000

Milli- 10-3 .001

Micro- 10-6 .000001

Nano- 10-9 .000000001

Pico- 10-12 .000000000001

Femto- 10-15 .000000000000001

How long does light take to travel 30cm?

• About a millisecond (10-3)• About a microsecond (10-6)• About a nanosecond (10-9)• About a picosecond (10-12)• About a femtosecond (10-15)

Speed of light is approximately 3 x 108 m/s.

Introduction to the Course

Lecturer

Course Overview

Teaching Style

Policies

Numbers in the Computer

Magnitude Prefixes

Representing information in a machine

Binary representation of integers

Human Symbols (Characters)

1 2 3 4 5 6 7 8 …

A B C D E F G H …

£ * ∞ ® ™ § ¶ & …

♠ ♣ ♥ ♦ ♪ ♫ ☺ ♂ …

Binary Symbols (Bits)

• 0 1

int i = 2173;

float f = 3.14159285;

String s = “Anything!”;

One Bit

• Two Patterns:

1

0

Two Bits

• Four Patterns:

01 11

00 10

Three Bits

0 0 1

0 1 0

0 0 0

0 1 1

1 0 1

1 1 0

1 0 0

1 1 1

• Eight Patterns:

Three Bits

0 10

1 00

0 00

1 10

0 11

1 01

0 01

1 11

• Eight Patterns:

n Bits

• 1 bit 2 things

• 2 bits 4 things

• 3 bits 8 things

• 4 bits 16 things

• 5 bits 32 things

• n bits

How many bits do I need to assign a unique bit pattern to everyone in the class?

How many bits do I need to assign a unique bit pattern to everyone in the class?

20 121 222 423 824 1625 32

26 6427 12828 25629 512210 1024211 2048

How many bits for x things?

Need b bits, where

2b-1 < x and

2b ≥ x

Exponents and Logarithms

be = x

logbx = e

How many bits for x things?

log2x

Course Book

Notes for this section are in the Course Book:-

• Pages 62 - 64: Numbers in the Computer

• Pages 65 - 92: Data Representations

Late Enrolment Fee

if ( not_enrolled_by_deadline){ liable_to_pay_$50_extra_fee (“not covered by Student Loans”);

}.

// Welcome again & enjoy COMPSCI 105// SS 2005.