Top Banner
Lecture1: Overview 9/9/2015 Daniel Bauer
29

Lecture1: Overview - Columbia Universitybauer/cs3134-f15/slides/w3134... · Lecture1: Overview 9/9/2015 Daniel Bauer. Contents 1. Organizational Overview 2. Introduction to Data Structures

May 31, 2020

Download

Documents

dariahiddleston
Welcome message from author
This document is posted to help you gain knowledge. Please leave a comment to let me know what you think about it! Share it to your friends and learn new things together.
Transcript
Page 1: Lecture1: Overview - Columbia Universitybauer/cs3134-f15/slides/w3134... · Lecture1: Overview 9/9/2015 Daniel Bauer. Contents 1. Organizational Overview 2. Introduction to Data Structures

Lecture1: Overview9/9/2015

Daniel Bauer

Page 2: Lecture1: Overview - Columbia Universitybauer/cs3134-f15/slides/w3134... · Lecture1: Overview 9/9/2015 Daniel Bauer. Contents 1. Organizational Overview 2. Introduction to Data Structures

Contents

1. Organizational Overview

2. Introduction to Data Structures

3. Abstract Data Types

2

Page 3: Lecture1: Overview - Columbia Universitybauer/cs3134-f15/slides/w3134... · Lecture1: Overview 9/9/2015 Daniel Bauer. Contents 1. Organizational Overview 2. Introduction to Data Structures

Instructors• Section 1:

• Daniel Bauer ([email protected])

• Office hours: Mon 4:00pm-5:00pm 7LW3 CEPSR (or by appointment)

• Section 2:

• Larry Stead ([email protected])

• Office hours: After class or by appointment3

Page 4: Lecture1: Overview - Columbia Universitybauer/cs3134-f15/slides/w3134... · Lecture1: Overview 9/9/2015 Daniel Bauer. Contents 1. Organizational Overview 2. Introduction to Data Structures

Class Coordination• The two sections will be mostly synced

• TAs are shared between the sections

• can go to anybody’s office hours or recitation

• Same homework for each section

• One piazza account shared between the sections

4

Page 5: Lecture1: Overview - Columbia Universitybauer/cs3134-f15/slides/w3134... · Lecture1: Overview 9/9/2015 Daniel Bauer. Contents 1. Organizational Overview 2. Introduction to Data Structures

Course Overview• Lectures:

Section 1: Mon & Wed, 5:40pm - 6:55pm, 301 PupinSection 2: Tue & Thu, 5:40pm - 6:55pm, 614 Schermerhorn

• Course Website: http://www.cs.columbia.edu/~bauer/cs3134

• GitHub used for homework, code examples.

• used for questions / discussions / announcements.

• Slides and Gradebook on Courseworks.

• Task for this week: Make sure you can access all resources!5

Page 6: Lecture1: Overview - Columbia Universitybauer/cs3134-f15/slides/w3134... · Lecture1: Overview 9/9/2015 Daniel Bauer. Contents 1. Organizational Overview 2. Introduction to Data Structures

Instructional Assistants

• IA hours, starting next week: Announced on course website.

• Will probably have three recitation sessions. Office hours (at least) on all other days of the week.

6

Linan Qiu ([email protected]) Anna Lawson

Evan Tarrh Joshua Keough Nick Mariconda

Ken Aizawa

Kunal Jasty Ruicong Xie

Harsha Vemuri Lily Wang

Zeynep Ejder

Page 7: Lecture1: Overview - Columbia Universitybauer/cs3134-f15/slides/w3134... · Lecture1: Overview 9/9/2015 Daniel Bauer. Contents 1. Organizational Overview 2. Introduction to Data Structures

Prerequisites• Knowledge of Java (e.g. W1004 - Introduction to

Computer Science and Programming in Java)

• Basic discrete math.

• Have some method for developing Java code - whatever works for you

• Eclipse, IntelliJ, SublimeText, Emacs, Vim

7

Page 8: Lecture1: Overview - Columbia Universitybauer/cs3134-f15/slides/w3134... · Lecture1: Overview 9/9/2015 Daniel Bauer. Contents 1. Organizational Overview 2. Introduction to Data Structures

Textbook• Weiss, Mark Allen (2012).

Data structures and Algorithm Analysis in Java. 3rd ed. Prentice Hall.

• ISBN: 9780132576277

• Errata: http://users.cis.fiu.edu/~weiss/dsaajava3/errata.html

• Source code: http://users.cis.fiu.edu/~weiss/dsaajava3/code/

8

Page 9: Lecture1: Overview - Columbia Universitybauer/cs3134-f15/slides/w3134... · Lecture1: Overview 9/9/2015 Daniel Bauer. Contents 1. Organizational Overview 2. Introduction to Data Structures

Deliverables and Grading• 50% - 7 homework assignments, weakest dropped

+ homework 0 (ungraded).

• 20% - In-class midterm (late October).

• 25% - Final exam.

• 5% - Participation (class attendance/participation, activity on Piazza).

• Grading Range A+ to F

9

Page 10: Lecture1: Overview - Columbia Universitybauer/cs3134-f15/slides/w3134... · Lecture1: Overview 9/9/2015 Daniel Bauer. Contents 1. Organizational Overview 2. Introduction to Data Structures

Expectations• Attend class, participate!

• Do reading assignments.

• Start homework early.

• Get help when you need it and help others on Piazza.

• Make sure you have the registration status you want!

• Academic Honesty - read the statement on course website carefully. You MUST submit original work!

10

Page 11: Lecture1: Overview - Columbia Universitybauer/cs3134-f15/slides/w3134... · Lecture1: Overview 9/9/2015 Daniel Bauer. Contents 1. Organizational Overview 2. Introduction to Data Structures

Asking Questions

11

of interest toother

students?

ask in classInstructorInstructor office hours

TA hours

Y

urgent clarification question in class

Y

organization

Nabout homework

grading?

recitation session

about course content or organization?

course content

N

YN

N Y

Instructor office hoursTA

about course content?

TATA hours

Page 12: Lecture1: Overview - Columbia Universitybauer/cs3134-f15/slides/w3134... · Lecture1: Overview 9/9/2015 Daniel Bauer. Contents 1. Organizational Overview 2. Introduction to Data Structures

Contents

1. Organizational Overview

2. Introduction to Data Structures

3. Abstract Data Types

12

Page 13: Lecture1: Overview - Columbia Universitybauer/cs3134-f15/slides/w3134... · Lecture1: Overview 9/9/2015 Daniel Bauer. Contents 1. Organizational Overview 2. Introduction to Data Structures

Why should I take Data Structures?

• Requirement.

• Core software engineering skills.

• Develop problem solving skills using a “top-down” approach.

• Coding interviews usually focus on data structures and algorithms.

13

Page 14: Lecture1: Overview - Columbia Universitybauer/cs3134-f15/slides/w3134... · Lecture1: Overview 9/9/2015 Daniel Bauer. Contents 1. Organizational Overview 2. Introduction to Data Structures

Data Structures

• Data Structures: Ways of representing and organizing data so that they can be used efficiently.

• Tasks: organize, search, filter, update, add, delete, combine

14

Page 15: Lecture1: Overview - Columbia Universitybauer/cs3134-f15/slides/w3134... · Lecture1: Overview 9/9/2015 Daniel Bauer. Contents 1. Organizational Overview 2. Introduction to Data Structures

Digital Data

15

Text

Video

TablesSocialNetworks

Audio

Bio data

Maps

Images

Page 16: Lecture1: Overview - Columbia Universitybauer/cs3134-f15/slides/w3134... · Lecture1: Overview 9/9/2015 Daniel Bauer. Contents 1. Organizational Overview 2. Introduction to Data Structures

Example Applications• Document Retrieval

• Machine Learning

• Microarray Data Analysis

• Route Planning

• Computer Graphics

16

Page 17: Lecture1: Overview - Columbia Universitybauer/cs3134-f15/slides/w3134... · Lecture1: Overview 9/9/2015 Daniel Bauer. Contents 1. Organizational Overview 2. Introduction to Data Structures

17

Page 18: Lecture1: Overview - Columbia Universitybauer/cs3134-f15/slides/w3134... · Lecture1: Overview 9/9/2015 Daniel Bauer. Contents 1. Organizational Overview 2. Introduction to Data Structures

Algorithms + Data Structures = Programs

• Niklaus Wirth, 1976 (inventor of Pascal)

• Problem solving requires:

1. Creating the right data model for thinking about a problem.

2. Devising the appropriate methods to solve the problem.

18

Page 19: Lecture1: Overview - Columbia Universitybauer/cs3134-f15/slides/w3134... · Lecture1: Overview 9/9/2015 Daniel Bauer. Contents 1. Organizational Overview 2. Introduction to Data Structures

Example: Finding an Entry x in a Sorted List

19

0 5 10 13 15 23 42 217 1024 4929

• Approach 1: Linear search. Start at position 0, scan list until we reach the correct entry.

A =

• In the worst case, we need length(A) steps to find the entry!

Page 20: Lecture1: Overview - Columbia Universitybauer/cs3134-f15/slides/w3134... · Lecture1: Overview 9/9/2015 Daniel Bauer. Contents 1. Organizational Overview 2. Introduction to Data Structures

Example: Finding an Entry x in a Sorted List

20

0 5 10 13 15 23 42 217 1024 4929

• Approach 2: Use the property that the list is sorted.• Find entry y in the middle if A: y = A[A.length/2] • if (y == x) we found the entry. • if (y < x) continue search on second half of A. • if (y > x) continue search on first half of A.

A = 23 x = 10241024

•In the worst case we need log2(length(A)) steps.

Page 21: Lecture1: Overview - Columbia Universitybauer/cs3134-f15/slides/w3134... · Lecture1: Overview 9/9/2015 Daniel Bauer. Contents 1. Organizational Overview 2. Introduction to Data Structures

Big Data

• Ever faster hardware available, more memory.

• Amazon cloud has machines with 244Gigs of main memory!

• Can now store and process huge data sets.

• Ironically, algorithmic efficiency matters even more!

21

Page 22: Lecture1: Overview - Columbia Universitybauer/cs3134-f15/slides/w3134... · Lecture1: Overview 9/9/2015 Daniel Bauer. Contents 1. Organizational Overview 2. Introduction to Data Structures

Levels of Abstraction• Hardware, bit representations

• Assembly language, registers, memory abstraction

• Higher-level languages (Java, C++, Python, …)

• Applications, User interfaces

22

L1: MV EDX, 00 INC EDX CMP EDX, 10 JLE L1

public class Dag<E> extends Graph<E> {…}

010101010101001011100101001101

Page 23: Lecture1: Overview - Columbia Universitybauer/cs3134-f15/slides/w3134... · Lecture1: Overview 9/9/2015 Daniel Bauer. Contents 1. Organizational Overview 2. Introduction to Data Structures

Contents

1. Organizational Overview

2. Introduction to Data Structures

3. Abstract Data Types

23

Page 24: Lecture1: Overview - Columbia Universitybauer/cs3134-f15/slides/w3134... · Lecture1: Overview 9/9/2015 Daniel Bauer. Contents 1. Organizational Overview 2. Introduction to Data Structures

Data Types

• Basic data types: booleans, bytes, integers, floats, characters…

• Simple abstractions: Array, String

• More complex data types (this class): Lists, Stacks, Trees, Sets, Graphs

24

Page 25: Lecture1: Overview - Columbia Universitybauer/cs3134-f15/slides/w3134... · Lecture1: Overview 9/9/2015 Daniel Bauer. Contents 1. Organizational Overview 2. Introduction to Data Structures

Abstract Data Types• An Abstract Data Type (ADT) is an collection of

data together with a set of operations.

• ADT specification does not mention how operations are implemented.

• Example:

• Set ADT might provide “add”, “remove”, “contains”, “union”, and “intersection” operations.

25

Page 26: Lecture1: Overview - Columbia Universitybauer/cs3134-f15/slides/w3134... · Lecture1: Overview 9/9/2015 Daniel Bauer. Contents 1. Organizational Overview 2. Introduction to Data Structures

ADTs vs. Data Structures

• An abstract data type is a well-defined collection of data with a well-defined set of operations on it.

• A data structure is an actual implementation of a particular abstract data type.

26

Page 27: Lecture1: Overview - Columbia Universitybauer/cs3134-f15/slides/w3134... · Lecture1: Overview 9/9/2015 Daniel Bauer. Contents 1. Organizational Overview 2. Introduction to Data Structures

ADTs in Java• ADTs can be specified as interfaces. Interfaces

define behavior, but say nothing about implementation or performance issues

• ADTs can be implemented as classes. Careful class design hides implementation details from users, enabling “plug and play”.

• Encourage re-usability of components!

27

Page 28: Lecture1: Overview - Columbia Universitybauer/cs3134-f15/slides/w3134... · Lecture1: Overview 9/9/2015 Daniel Bauer. Contents 1. Organizational Overview 2. Introduction to Data Structures

ADTs in Java• Example: Java Strings

• We can call methods such as length() and concat(String str).

• We don’t have to know how Strings are stored in memory or how methods are implemented.

• How many bytes does it take to represent a character?

28

Page 29: Lecture1: Overview - Columbia Universitybauer/cs3134-f15/slides/w3134... · Lecture1: Overview 9/9/2015 Daniel Bauer. Contents 1. Organizational Overview 2. Introduction to Data Structures

Some ADTs we will study• Lists

• Stacks

• Queues

• Priority Queues (Heaps)

• Search Trees

• Graphs

29