L2 mt - CSE 12: Basic data structures and object-oriented...

Info iconThis preview shows pages 1–11. Sign up to view the full content.

View Full Document Right Arrow Icon
CSE 12 : Basic data structures and object-oriented design Jacob Whitehill jake@mplab.ucsd.edu Lecture Two 2 Aug 2011 Tuesday, August 2, 2011
Background image of page 1

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

View Full DocumentRight Arrow Icon
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
Background image of page 2
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
Background image of page 3

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

View Full DocumentRight Arrow Icon
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 Fnancial 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
Background image of page 4
Fundamental data structures Different collections have different time and space costs for the add/retrieve/remove operations. Which collection is best depends on which operations your code calls most often. Tuesday, August 2, 2011
Background image of page 5

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

View Full DocumentRight Arrow Icon
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
Background image of page 6
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 Frst ADT of the course: the list . Tuesday, August 2, 2011
Background image of page 7

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

View Full DocumentRight Arrow Icon
Data structures you’re already familiar with. Tuesday, August 2, 2011
Background image of page 8
Data structures you already know In prior coursework you have already worked with some simple data structures: Arrays : collection of related variables speciFed 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
Background image of page 9

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

View Full DocumentRight Arrow Icon
already know Strings : a fnite 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. Tuesday, August 2, 2011
Background image of page 10
Image of page 11
This is the end of the preview. Sign up to access the rest of the document.

Page1 / 73

L2 mt - CSE 12: Basic data structures and object-oriented...

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

View Full Document Right Arrow Icon
Ask a homework question - tutors are online