cs 15-121 data structures

27
Ananda Gunawardena (“Guna”) Summer 2010 Lecture 1 - Introduction

Upload: russell-ryan

Post on 30-Dec-2015

41 views

Category:

Documents


2 download

DESCRIPTION

CS 15-121 Data Structures. Lecture 1 - Introduction. Ananda Gunawardena (“Guna”) Summer 2010. Course Description 15-121. 15-121 Introduction to Data Structures Fall and Spring: 10 units - PowerPoint PPT Presentation

TRANSCRIPT

Page 1: CS 15-121 Data Structures

Ananda Gunawardena (“Guna”)

Summer

2010

Lecture 1 - Introduction

Page 2: CS 15-121 Data Structures

Course Description 15-121 15-121 Introduction to Data Structures Fall and Spring: 10 units

An introduction to the process of program design and analysis using the Java programming language for students with some prior programming experience (functions, loops, and arrays) in a language other than Java. Topics to be covered include an overview of fundamental programming concepts using Java as well as object-oriented programming techniques, data aggregates, data structures (e.g., linked lists, stacks, queues, trees, and graphs), and an introduction to the analysis of algorithms that operate on those data structures. This course, along with 21-127, serves as a prerequisite for 15-211. NOTE: students who receive a grade of C or less in 15-111 should discuss whether they are adequately prepared for 15-211 with their academic advisor. .

Page 3: CS 15-121 Data Structures

This course is aboutUnderstanding Object Oriented Programming

ConceptsUnderstanding computers and storageUnderstanding Data OrganizationUnderstanding applications that require

complex data structures and algorithmsUnderstanding algorithmsUnderstanding complexity of large programsUnderstanding debugging techniquesUnderstanding large software development

environments

Page 4: CS 15-121 Data Structures

Course StaffAnanda Gunawardena (instructor)

[email protected] – Gates 6005Office hours – M,W,F – 3-4PM or by appointment

Lincoln Roop(TA) and Rafee [email protected] , [email protected] hours – TBAAll questions regarding assignments to

Lincoln/Rafee

Page 5: CS 15-121 Data Structures

Course Components6 Assignments – 36%5 Quizzes – 15%1 Written Midterm – 20%1 Written Final Exam – 20%Reading Assignments – 9%

Page 6: CS 15-121 Data Structures

About ClassworkAll lectures available online (no printouts

given)Annotated lectures saved onlineReading assignments are 9% of grade

Create an account on classroomsalonhttp://www.classroomsalon.orgCode: 23456

There will be many opportunities for class participationAll are expected to participate

Page 7: CS 15-121 Data Structures

Programming AssignmentsRequires clear understanding of the

problemUse salon discussions to understand the

specsAbility to read and understand starter

codeAbility to modify code to accomplish the

tasksAbility to debug and test codeTypically requires 2-3 days of work – a

total of 5-10 hours of coding, debugging and testing

Page 8: CS 15-121 Data Structures

Submitting AssignmentsWe use AFS for assignment handin

/afs/andrew.cmu.edu/course/15/111M08/handinAuthenticate and submit into the correct folder

– we will show you how to do this in classYou will receive feedback on your assignments

on the handback folderWe will also record your grades at

/afs/andrew.cmu.edu/course/15/111M08/grades/YourID

Start early – late programs will lose 25% per day

No program accepted after 48 hoursStart early and seek help

Page 9: CS 15-121 Data Structures

Important things to RememberAll assignments are due Sunday at 11:59PMAny assignment that is more than 24 hours late

automatically loses 50% of the gradeNo assignment is graded if it is more than 2 days late.All assignments are individual. You are encouraged to

discuss things with others, but final product is “yours”

Academic honesty is very importantStart early, so you don’t get into unpleasant

situationsSeek help from instructor and TA

Guna and Lincoln/RafeeAll course material from

http://www.cs.cmu.edu/~ab/15-121N10http://blackboard.andrew.cmu.edu

Page 10: CS 15-121 Data Structures
Page 11: CS 15-121 Data Structures

Programming Languages

Language typesNaturalArtificial

Language componentsSyntax – Form of language constructsSemantics – their meaning

Examples of High-Level Languages?

Page 12: CS 15-121 Data Structures

Compilers

A compiler translates __________programs into target programs

Programs are written with static (compile-time) and dynamic (run-time) constructs

Target programs are machine executable and specifies run-time computations

The most important function of a compiler is static code checking and analysis

Compilers also “optimize” the user code for faster execution

Page 13: CS 15-121 Data Structures

Java CompilerJava is an ______________languagejavac command creates the ______file that

contains java byte codeJava byte code can be interpreted by

______________machineWe run java programs with > _____________ Where Driver is the class file that

contains main( ) method

Page 14: CS 15-121 Data Structures

A Java Programimport java.io.*public class Driver { public static void main( ) { System.out.println(“hello world”); } }

Question: Describe the components of this program

Page 15: CS 15-121 Data Structures
Page 16: CS 15-121 Data Structures

MemoryThe smallest measurable unit of memory is

1 bit, holding a zero(0) or one(1)A byte is typically defined as smallest

storage necessary to hold one ASCII character

One byte is 8 bits and _________ different characters can be represented using one byte

ASCII table has __________ characters

Page 17: CS 15-121 Data Structures

Sizes of Basic Data Types in Java

char __________Short _____, int _______, long ________float _______, double ___________Data sizes could vary based on machine

Page 18: CS 15-121 Data Structures

ASCII CharactersSome examples of ASCII characters are ‘A’ = 65 ‘B’ = 66 …. ‘ ‘ = 32 ‘a’ = 97

Express them in binary

Page 19: CS 15-121 Data Structures

MemoryMemory is cheap

RAMFlashHard Drives…..

Measures of memory1 kilobyte = 1K bytes = bytes1 megabyte = 1MB = bytes1 Gigabyte = 1GB = bytes1 Terabyte = 1TB = bytes1 PetaByte = 1PB = bytes1 exabyte = 1 XB = bytes

Page 20: CS 15-121 Data Structures

Storage FactsDigital Video

23.6 Mbytes per secondHow big is a movie that is 2 hrs long?

Digital Audio176.4 kbytes/secondHow big is your favorite MP3 song?

Page 21: CS 15-121 Data Structures

So how big is an exabyte?

It can hold Your whole life as a videoAll the words you have spokenAll the books and articles you readAll the songs you have ever heardAll movies you have ever watched

How much it will cost in 2050Prize of a Pizza?

Page 22: CS 15-121 Data Structures

QuestionI have a machine with 4GB of RAM. The OS

gives my program a maximum stack memory of 4MB. Can I store 1,000,000 integers in a simple array?

Page 23: CS 15-121 Data Structures
Page 24: CS 15-121 Data Structures

Why Data Structures

Data must be organized well to speed up the programsEg: imagine searching linearly through an

entire array versus searching data based on some heuristics

Why is Google so fast?Because it organizes the data for faster

retrievalIt may sometimes cache data for faster

search

Page 25: CS 15-121 Data Structures
Page 26: CS 15-121 Data Structures

107 4 322 354 381 405232 6 15 195 248 1897 1951 2192677 1 481713 3 42 312 802

WORD NDOCS PTR

jezebel 20

jezer 3

jezerit 1

jeziah 1

jeziel 1

jezliah 1

jezoar 1

jezrahliah 1

jezreel 39jezoar

34 6 1 118 2087 3922 3981 500244 3 215 2291 301056 4 5 22 134 992

DOCID OCCUR POS 1 POS 2 . . .

566 3 203 245 287

67 1 132. . .

“jezebel” occurs6 times in document 34,3 times in document 44,4 times in document 56 . . .

LEXICON

WORD INDEX

Page 27: CS 15-121 Data Structures

Next

We will discuss Arrays, basic java IO and Strings

Assignment 1 will be released WednesdayStart earlySubmit by no later than Tuesday July 6th

midnight