lecture_26_s2005

lecture_26_s2005 - 1.00 Lecture 26 Data Structures:...

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

View Full Document Right Arrow Icon
1.00 Lecture 26 Data Structures: Introduction Stacks Reading for next time: Big Java: 19.1-19.3 Data Structures Set of primitives used in algorithms, simulations, operating systems, applications to: Store and manage data required by algorithm Provide only the access that is required Disallow all other access There are a small number of common data structures We cover the basic version of the core structures Many variations exist on each structure It’s common to make application-specific modifications We’ll both build them and use the Java built-in versions!
Background image of page 1

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

View Full DocumentRight Arrow Icon
Stacks z d q b Top Single ended structure Last-in, first-out (LIFO) list Applications: 1. Simulation: robots, machines 2. Recursion: pending function calls 3. Reversal of data Queues e b w d u Front Rear Double ended structure First-in, first-out (FIFO) list Applications: 1. Simulation: lines 2. Ordered requests: device drivers, routers, … 3. Searches
Background image of page 2
Double ended Queues (Dequeues) d a b c e Double ended structure Applications: 1. Simulation: production, operations Train 1 2 2 3 1 2 1 3 2 3 3 Track 1 Track 2 Engine Engine Track 3 A dequeue can model both stacks and queues Priority Queues or Heaps e a b c d Top Bottom Highest priority element at top “Partial sort” All enter at bottom, leave at top Applications: 1. Simulations: event list 2. Emergency response modeling 3. Searching (next most likely)
Background image of page 3

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

View Full DocumentRight Arrow Icon
e c q d f e v t a a d a c a Binary Trees Level Nodes 0 2 0 m p e f d v n 1 2 1 2 2 2 k 2 k Binary tree has 2 (k+1) -1 nodes A maximum of k steps are required to find (or not find) a node E.g. 2 20 nodes, or 1,000,000 nodes, in 20 steps! Binary trees can be built in many ways: heaps, search trees…
Background image of page 4
Image of page 5
This is the end of the preview. Sign up to access the rest of the document.

This note was uploaded on 11/29/2011 for the course CIVIL 1.00 taught by Professor Georgekocur during the Spring '05 term at MIT.

Page1 / 16

lecture_26_s2005 - 1.00 Lecture 26 Data Structures:...

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

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