02_Data_Structures - 1 15.082 and 6.855J February 6 2003...

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

View Full Document Right Arrow Icon

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

View Full Document Right Arrow Icon

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

View Full Document Right Arrow Icon

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

View Full Document Right Arrow Icon

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

View Full Document Right Arrow Icon
This is the end of the preview. Sign up to access the rest of the document.

Unformatted text preview: 1 15.082 and 6.855J February 6, 2003 Data Structures 2 Overview of this Lecture ◆ A very fast overview of some data structures that we will be using this semester lists, sets, stacks, queues, networks, trees a variation on the well known heap data structure 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). 3 Two standard data structures 1 1 1 1 1 1 2 3 4 5 6 7 8 9 10 Array : a vector: stored consecutively in memory, and typically allocated in advance cells : hold fields of numbers and pointers to implement lists. 1 3 4 6 8 first This is a singly linked list 4 Two standard data structures 1 1 1 1 1 1 2 3 4 5 6 7 8 9 10 Each has its advantages. Each can be more efficient than the other. It depends on what operations you want to perform. Let’s consider which data structure to use for working with node subsets, or arc subsets. 1 3 4 6 8 first 5 Two key concepts Abstract data types : a descriptor of the operations that are permitted, e.g., abstract data type : set S initialize(S) : creates an empty set S add(S, s) : replaces S by S ∪ {s}. delete(S, s): replaces S by S \{s} FindElement(S, s) : s := some element of S 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. doubly linked list, etc 6 A note on data structures ◆ Preferences Simplicity Efficiency In case there are multiple good representations, we will choose one 7 Storing a subset S of Nodes Operations create an empty set S add an element to S delete an element from 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 S = ∅ S = {2} S = {2, 7} S = {2, 4, 7} S = {2, 4} Is 7 ∈ S? 8 Animating the List of Nodes 2 4 first 1 2 3 4 5 6 7 8 9 10 Bucket Operation: insert node 8 into the list This is a doubly linked list 9...
View Full Document

{[ snackBarMessage ]}

Page1 / 32

02_Data_Structures - 1 15.082 and 6.855J February 6 2003...

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

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