Data-structure-palooza Checkout DataStructures from SVN.

Slides:



Advertisements
Similar presentations
Stacks and Queues. Not really data structures – More of an enforcement of policy – Can be implemented using an array or linked list – Can store just about.
Advertisements

Stacks  a data structure which stores data in a Last-in First-out manner (LIFO)  has a pointer called TOP  can be implemented by either Array or Linked.
CHAPTER 4 Queues. Queue  The queue, like the stack, is a widely used data structure  A queue differs from a stack in one important way  A stack is.
CHAPTER 4 Queues MIDTERM THURSDAY, OCTOBER 17 IN LAB.
Queues Chapter 6. Chapter Objectives  To learn how to represent a waiting line (queue) and how to use the methods in the Queue interface for insertion.
Data Structures: Lists i206 Fall 2010 John Chuang Some slides adapted from Glenn Brookshear, Brian Hayes, or Marti Hearst.
Chapter 12: Data Structures
Copyright © 2009 Pearson Education, Inc. Publishing as Pearson Addison-Wesley Java Software Solutions Foundations of Program Design Sixth Edition by Lewis.
CS102 – Data Structures Lists, Stacks, Queues, Trees, Hash Collections Framework David Davenport Spring 2002.
CS 104 Introduction to Computer Science and Graphics Problems Data Structure & Algorithms (4) Data Structures 11/18/2008 Yang Song.
Heaps & Priority Queues Nelson Padua-Perez Bill Pugh Department of Computer Science University of Maryland, College Park.
1 Data Structures  We can now explore some advanced techniques for organizing and managing information  Chapter 12 of the book focuses on: dynamic structures.
Chapter 12 C Data Structures Acknowledgment The notes are adapted from those provided by Deitel & Associates, Inc. and Pearson Education Inc.
COMP 110 Introduction to Programming Mr. Joshua Stough.
Queues Chapter 6. Chapter 6: Queues2 Chapter Objectives To learn how to represent a waiting line (queue) and how to use the methods in the Queue interface.
© Copyright 1992–2004 by Deitel & Associates, Inc. and Pearson Education Inc. All Rights Reserved. Chapter 12 – Data Structures Outline 12.1Introduction.
Chapter 12 Collections. © 2004 Pearson Addison-Wesley. All rights reserved12-2 Collections A collection is an object that helps us organize and manage.
Abstract Data Types (ADTs) An ADT consists of: –a set of values –a set of operations on those values Rational numbers –15/7, -3/4, 123/1, 0/1 (but NOT.
Chapter 24 Dispensers and dictionaries. This chapter discusses n Dictionaries n Dispensers u stacks u queues u priority queues.
© 2004 Pearson Addison-Wesley. All rights reserved12-1 Chapter 12 : Collections Intermediate Java Programming Summer 2007.
Java Collections. Collections, Iterators, Algorithms CollectionsIteratorsAlgorithms.
Copyright © Wondershare Software Introduction to Data Structures Prepared by: Eng. Ahmed & Mohamed Taha.
Chapter 12 Data Structure Associate Prof. Yuh-Shyan Chen Dept. of Computer Science and Information Engineering National Chung-Cheng University.
Review C++ exception handling mechanism Try-throw-catch block How does it work What is exception specification? What if a exception is not caught?
COMP 121 Week 14: Queues. Objectives Learn how to represent a queue Learn how to use the methods in the Queue interface Understand how to implement the.
Stacks and queues Basic operations Implementation of stacks and queues Stack and Queue in java.util Data Structures and Algorithms in Java, Third EditionCh04.
CHAPTER 05 Compiled by: Dr. Mohammad Omar Alhawarat Stacks & Queues.
Data Structures and Abstract Data Types "Get your data structures correct first, and the rest of the program will write itself." - David Jones.
Stacks and Queues Introduction to Computing Science and Programming I.
Java Collections An Introduction to Abstract Data Types, Data Structures, and Algorithms David A Watt and Deryck F Brown © 2001, D.A. Watt and D.F. Brown.
Jan 12, 2012 Introduction to Collections. 2 Collections A collection is a structured group of objects Java 1.2 introduced the Collections Framework Collections.
Analysis of Algorithms continued Recursion.  On Capstone Project? ◦ Automatic extension to Monday morning ◦ If a team member does not wish to join the.
111 © 2002, Cisco Systems, Inc. All rights reserved.
CSS446 Spring 2014 Nan Wang.  Java Collection Framework ◦ Set ◦ Map 2.
CS 46B: Introduction to Data Structures July 9 Class Meeting Department of Computer Science San Jose State University Summer 2015 Instructor: Ron Mak
CMSC 202 Stacks and Queues. What’s a Queue? A queue is a linear collection of homogeneous data in which items added to the queue must be placed at the.
Data Structures (part 2). Stacks An Everyday Example Your boss keeps bringing you important items to deal with and keeps saying: “Put that last ‘rush’
Data structures Abstract data types Java classes for Data structures and ADTs.
ACM/JETT Workshop - August 4-5, 2005 Using Visualization Tools To Teach Data Structures and Algorithms Java applets by Dr. R. Mukundan, University of Canterbury,
HIT2037- HIT6037 Software Development in Java 22 – Data Structures and Introduction.
Queues Chapter 6. Chapter 6: Queues Chapter Objectives To learn how to represent a waiting line (queue) and how to use the five methods in the Queue interface:
Holding Your Objects Generics and type-safe containers One of the problems of using pre-Java SE5 containers was that the compiler allowed.
CSE 501N Fall ‘09 11: Data Structures: Stacks, Queues, and Maps Nick Leidenfrost October 6, 2009.
A data structure is a type of data storage ….similar to an array. There are many data structures in Java (Stacks, Queues, LinkedList, Sets, Maps, HashTables,
Chapter Objectives  Learn how to represent a waiting line (queue)  Become proficient using the methods in the Queue  Understand how to implement the.
Chapter 12: Collections by Lewis and Loftus (Updated by Dan Fleck) Coming up: Collections.
Foundation of Computing Systems Lecture 3 Stacks and Queues.
Queue What is a queue?. Queues A queue is similar to waiting in line for a service, e.g., at the bank, at the bathroom –The first item put on the queue.
Arrays and Collections Tonga Institute of Higher Education.
CS102 – Data Structures Lists, Stacks, Queues, Trees & HashTables. David Davenport.
1 Joe Meehean.  List of names  Set of names  Map names as keys phone #’s as values Phil Bill Will Phil Bill Will Phil Bill Will Phil: Bill:
AITI Lecture 18 Introduction to Data Structure, Stack, and Queue Adapted from MIT Course 1.00 Spring 2003 Lecture 23 and Tutorial Note 8 (Teachers: Please.
Data Structures academy.zariba.com 1. Lecture Content 1.Linear Data Structures 2.Trees and Graphs* 3.Dictionaries and Hash Tables 4.Homework 2.
Collections Data structures in Java. OBJECTIVE “ WHEN TO USE WHICH DATA STRUCTURE ” D e b u g.
Data Structures Chapter 6. Data Structure A data structure is a representation of data and the operations allowed on that data. Examples: 1.Array 2.Record.
Data Structures for Midterm 2. C++ Data Structure Runtimes.
Heaps & Priority Queues
ITEC 2620M Introduction to Data Structures Instructor: Prof. Z. Yang Course Website: ec2620m.htm Office: Tel 3049.
Linear Data Structures
Data Structures What The Course Is About Data structures is concerned with the representation and manipulation of data.
Stacks and Queues CMSC 201. Stacks and Queues Sometimes, when we use a data-structure in a very specific way, we have a special name for it. This is to.
Lecture 10 b Stacks b Queues. 2 Stacks b A stack ADT is linear b Items are added and removed from only one end of a stack b It is therefore LIFO: Last-In,
CS-2851 Dr. Mark L. Hornick 1 Stacks and Queues Behavior vs. Structure.
CSC 143T 1 CSC 143 Highlights of Tables and Hashing [Chapter 11 p (Tables)] [Chapter 12 p (Hashing)]
Set Collection A Bag is a general collection class that implements the Collection interface. A Set is a collection that resembles a Bag with the provision.
COSC160: Data Structures: Lists and Queues
structures and their relationships." - Linus Torvalds
structures and their relationships." - Linus Torvalds
Stack A data structure in which elements are inserted and removed only at one end (called the top). Enforces Last-In-First-Out (LIFO) Uses of Stacks Evaluating.
structures and their relationships." - Linus Torvalds
Presentation transcript:

Data-structure-palooza Checkout DataStructures from SVN

Understanding the engineering trade-offs when storing data

 Boil down data types (e.g., lists) to their essential operations  Choosing a data structure for a project then becomes: ◦ Identify the operations needed ◦ Identify the abstract data type that most efficiently supports those operations  Goal: that you understand several basic abstract data types and when to use them

 Array List  Linked List  Stack  Queue  Set  Map Implementations for all of these are provided by the Java Collections Framework in the java.util package.

Operations Provided Array List Efficiency Linked List Efficiency Random accessO(1)O(n) Add/remove itemO(n)O(1)

 A last-in, first-out (LIFO) data structure  Real-world stacks ◦ Plate dispensers in the cafeteria ◦ Pancakes!  Some uses: ◦ Tracking paths through a maze ◦ Providing “unlimited undo” in an application Operations Provided Efficiency Push itemO(1) Pop itemO(1) Implemented by Stack, LinkedList, and ArrayDeque in Java Q1

 A first-in, first-out (FIFO) data structure  Real-world queues ◦ Waiting line at the ARA  Some uses: ◦ Scheduling access to shared resource (e.g., printer) Operations ProvidedEfficiency Add (enqueue, offer) itemO(1) Remove (dequeue, poll) itemO(1) Implemented by LinkedList and ArrayDeque in Java Q2

Binary Tree Hash Table  Use if you need the items to be sorted  Log(n) height of tree  Uses “hash code”  O(1) to lookup, add or remove samjoety, ali …

 Collections without duplicates  Real-world sets ◦ Students ◦ Collectibles  Some uses: ◦ Quickly checking if an item is in a collection  Sorted? Depends on implementation! OperationsHashSetTreeSet Add/remove itemO(1)O(log n) Contains?O(1)O(log n) Can hog space Sorts items! Q3

 Associate keys with values  Real-world “maps” ◦ Dictionary ◦ Phone book  Some uses: ◦ Associating student ID with transcript ◦ Associating name with high scores OperationsHashMapTreeMap Insert key-value pairO(1)O(lg n) Look up value for keyO(1)O(lg n) Can hog space Sorts items by key! Q4

Binary Tree Hash Table  Use if you need the items to be sorted  Log(n) height of tree  Uses “hash code”  O(1) to lookup, add or remove samjoety, ali … Q5 - 8

Your chance to improve instruction, courses, and curricula.