L2 mt print

# L2 mt print - CSE 12 Basic data structures and...

This preview shows pages 1–3. Sign up to view the full content.

CSE 12 : Basic data structures and object-oriented design Jacob Whitehill [email protected] Lecture Two 2 Aug 2011 Tuesday, August 2, 2011 Review from last lecture In computer science, all data must ultimately be represented as a binary sequence. Data structures are necessary to encode useful information in binary sequences. Data structures may vary in their time complexity, space complexity, and “code complexity” (human effort). Tuesday, August 2, 2011 Review from last lecture It is important to learn the fundamental data structures of computer science so you don’t keep having to “rediscover the wheel”. The fundamental data structures covered in this course include: lists , stacks queues heaps trees hash tables , and graphs . Tuesday, August 2, 2011 Fundamental data structures 5 of these structures (list, stack, queue, heap, hash table) are useful as collections to support add / retrieve / remove operations. In coarse English, a collection is useful if the user wants to “put data in it”, and later “pull data out of it.” E.g., you’re writing a program to manage the f nancial aid of all UCSD students. You want “some structure” (collection) to hold all the UCSDStudent objects -- you don’t want to manage them yourself. Tuesday, August 2, 2011 Fundamental data structures Different collections have different time and space costs for the add/retrieve/remove operations. often. Tuesday, August 2, 2011 Which collection is best depends on which operations your code calls most Fundamental data structures 2 of these structures (tree, graph) are useful to represent connectivity relationships among data: Trees can represent hierarchical relationships (e.g., heredity). Graphs can represent arbitrary relationships between pairs of data (e.g., Facebook friends). Tuesday, August 2, 2011 Fundamental data structures In this course we will develop all of these data structures as Abstract Data Types (ADTs). In this lecture I hope to: Explain abstraction from a computer system’s perspective. Motivate building data structures as ADTs. Introduce our f rst ADT of the course: the list . Tuesday, August 2, 2011 (ADTs) Data structures you’re already familiar with. Tuesday, August 2, 2011

This preview has intentionally blurred sections. Sign up to view the full version.

View Full Document
Data structures you already know In prior coursework you have already worked with some simple data structures: Arrays : collection of related variables speci f ed by an index: int[] numbers = new int[100]; ... numbers[5] = 16; More convenient than declaring 100 variables! int number1, number2, number3, ... number100; Tuesday, August 2, 2011 Data structures you already know Strings : a f nite sequence of characters: String firstName = “Jimmy”; String lastName = “Carter”; String fullName = firstName + “ “ + lastName; System.out.println(“Hello, “ + fullName); String data structure allows you to “add” strings together.
This is the end of the preview. Sign up to access the rest of the document.

## This note was uploaded on 11/02/2011 for the course CSE 12 taught by Professor Gary during the Summer '08 term at UCSD.

### Page1 / 10

L2 mt print - CSE 12 Basic data structures and...

This preview shows document pages 1 - 3. Sign up to view the full document.

View Full Document
Ask a homework question - tutors are online