02computationalcomplexityanddatastructures

02computationalcomplexityanddatastructures - 15.082 and...

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

View Full Document Right Arrow Icon
1 15.082 and 6.855J February 6, 2003 Data Structures
Background image of page 1

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

View Full DocumentRight Arrow Icon
2 Overview of this Lecture ± A very fast overview of some data structures that we will be using this semester z lists, sets, stacks, queues, networks, trees z a variation on the well known heap data structure z binary search ± Illustrated using animation ± We are concerned with O( ) computation counts, and so do not need to get down to C- level (or Java level).
Background image of page 2
3 Two standard data structures 1 0 1 1 0 1 0 1 0 0 1234567891 0 Array : a vector: stored consecutively in memory, and typically allocated in advance 1 3 4 6 8 first This is a singly linked list cells : hold fields of numbers and pointers to implement lists.
Background image of page 3

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

View Full DocumentRight Arrow Icon
4 Two standard data structures 1 0 1 1 0 1 0 1 0 0 1234567891 0 Each has its advantages. Each can be more efficient than the other. It depends on what operations you want to perform. 1 3 4 6 8 first Let’s consider which data structure to use for working with node subsets, or arc subsets.
Background image of page 4
5 Two key concepts Abstract data types : a descriptor of the operations that are permitted, e.g., abstract data type : set S z initialize(S) : creates an empty set S z add(S, s) : replaces S by S {s}. z delete(S, s): replaces S by S \{s} z FindElement(S, s) : s := some element of S z IsElement(S, s) : returns true if s S Data structure : usually describes the high level implementation of the abstract data types, and can be analyzed for running time. z doubly linked list, etc
Background image of page 5

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

View Full DocumentRight Arrow Icon
6 A note on data structures ± Preferences z Simplicity z Efficiency z In case there are multiple good representations, we will choose one
Background image of page 6
7 Storing a subset S of Nodes Operations S = create an empty set S S = {2} S = {2, 7} S = {2, 4, 7} add an element to S S = {2, 4} delete an element from S Is 7 S? determine if a node is in S Array Bucket Bucket(i) points to i if i S use a doubly linked list to store the set S
Background image of page 7

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

View Full DocumentRight Arrow Icon
8 Animating the List of Nodes 2 4 first 1234567891 0 Bucket This is a doubly linked list Operation: insert node 8 into the list
Background image of page 8
9 Operation: Insert node 8 into list 1234567891 0 4 2 first Bucket 2
Background image of page 9

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

View Full DocumentRight Arrow Icon
Image of page 10
This is the end of the preview. Sign up to access the rest of the document.

This note was uploaded on 03/15/2010 for the course IE 505 taught by Professor Yok during the Spring '10 term at Galatasaray Üniversitesi.

Page1 / 32

02computationalcomplexityanddatastructures - 15.082 and...

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

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