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.

Slides:



Advertisements
Similar presentations
STACKS & QUEUES. Stacks Abstract data types An abstract data type (ADT) is an abstraction of a data structure An ADT specifies : –Data stored –Operations.
Advertisements

©Brooks/Cole, 2003 Chapter 12 Abstract Data Type.
CS 307 Fundamentals of Computer Science 1 Abstract Data Types many slides taken from Mike Scott, UT Austin.
Lists A list is a finite, ordered sequence of data items. Two Implementations –Arrays –Linked Lists.
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.
©Brooks/Cole, 2003 Chapter 12 Abstract Data Type.
1 Data Structures  We can now explore some advanced techniques for organizing and managing information  Chapter 12 of the book focuses on: dynamic structures.
COMP 110 Introduction to Programming Mr. Joshua Stough.
© 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.
© 2004 Pearson Addison-Wesley. All rights reserved12-1 Chapter 12 : Collections Intermediate Java Programming Summer 2007.
Data Structures Winter What is a Data Structure? A data structure is a method of organizing data. The study of data structures is particularly important.
Chapter 3 List Stacks and Queues. Data Structures Data structure is a representation of data and the operations allowed on that data. Data structure is.
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.
ECE 103 Engineering Programming Chapter 61 Abstract Data Types Herbert G. Mayer, PSU CS Status 6/4/2014 Initial content copied verbatim from ECE 103 material.
9-1 Abstract Data Types Abstract data type A data type whose properties (data and operations) are specified independently of any particular implementation.
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’
© 2005 Pearson Education, Inc., Upper Saddle River, NJ. All rights reserved. Data Structures for Java William H. Ford William R. Topp Chapter 8 Collection.
Foundation of Computing Systems Lecture 3 Stacks and Queues.
Cousin of the Stack.  An abstract data type (container class) in which items are entered at one end and removed from the other end  First In First.
Chapter 16 – Data Structures and Recursion. Data Structures u Built-in –Array –struct u User developed –linked list –stack –queue –tree Lesson 16.1.
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.
Chapter 12 Abstract Data Type. Understand the concept of an abstract data type (ADT). Understand the concept of a linear list as well as its operations.
Data Structures for Midterm 2. C++ Data Structure Runtimes.
ITEC 2620M Introduction to Data Structures Instructor: Prof. Z. Yang Course Website: ec2620m.htm Office: Tel 3049.
Graphs Upon completion you will be able to:
Computer Engineering Rabie A. Ramadan Lecture 6.
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.
Chapter 9 Abstract Data Types and Algorithms Nell Dale John Lewis.
CPS120: Introduction to Computer Science Nell Dale John Lewis Abstract Data Types.
Week 15 – Monday.  What did we talk about last time?  Tries.
9/27/2016IT 1791 Abstraction A tool (concept) to manage complexity Hide irrelevant details; focus on the features needed Primitive date types are already.
Stacks and Queues. DCS – SWC 2 Stacks A stack is an abstract data structure, with some special properties: –Insertion and deletion is only allowed at.
Collections (Stack, queue, tree, graph). References as Links References can be used to create a variety of linked structures, such as a linked list.
Queues Chapter 8 (continued)
Chapter 12 Abstract Data Type.
Sami Rollins Spring 2006 CS312 Algorithms Sami Rollins Spring 2006.
12 Collections Software Solutions Lewis & Loftus java 5TH EDITION
G64ADS Advanced Data Structures
Chapter 12 – Data Structures
COSC160: Data Structures: Lists and Queues
Data Structure Interview Question and Answers
Chapter 15 Lists Objectives
Abstraction A tool (concept) to manage complexity
Chapter 12: Data Structures
Data Structures Data Structure is a way of collecting and organising data in such a way that we can perform operations on these data in an effective.
Stacks and Queues.
Week 15 – Monday CS221.
Introduction to Data Structure
structures and their relationships." - Linus Torvalds
Abstract Data Types (ADTs)
structures and their relationships." - Linus Torvalds
Java Collections Framework
ITEC 2620M Introduction to Data Structures
Stacks and Queues.
ITEC 2620M Introduction to Data Structures
Dynamic Sets (III, Introduction)
Cs212: Data Structures Computer Science Department Lecture 7: Queues.
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.
Mutable Data (define mylist (list 1 2 3)) (bind ((new (list 4)))
Abstract Data Type (ADT)
Important Problem Types and Fundamental Data Structures
Queues cont. Chapter 8 © 2011 Pearson Addison-Wesley. All rights reserved.
structures and their relationships." - Linus Torvalds
Abstract Data Types (ADTs)
Data Structures & Programming
Presentation transcript:

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 that duplicate values are not allowed. Applications typically use Set collections for operations set union, set intersection, and set difference.

Student Question Given the following sets: Find the following sets: A = {3, 4, 8, 2} B = {16, 4, 12, 8} C = {2, 3, 4, 5, 6} Find the following sets: (A  B)  C A – B – C (A  C)  (B  C)

Map Collection A Map is a collection of key-value pairs. The key uniquely identifies the element while the value field typically has associated data. Access to an element requires only the key and returns the value component. For this reason, a Map is referred to as an associative array.

Stack Collection A Stack is a collection with a single reference point called the top of the stack. An element is added at the top of the stack (push operation) and removed from the top of the stack (pop operation). Elements come off a stack in the reverse order of their insertion and so a stack has last-in-first-out (LIFO) ordering.

Queue Collection A Queue is a collection that allows access only at the front and the back. Items enter at the back (push or enqueue operation) and exit from the front of the queue (pop or dequeue operation). Elements come off a queue in the same order of their insertion and so a queue has first-in-first-out (FIFO) ordering.

Priority Queue A Priority Queue is a collection that has restricted access operations, like a stack and a queue. An element can enter the queue in any order. Once in the collection, a delete operation removes the maximum (minimum) value, depending on the specified type of priority.

Student Question How can you use a linked list to implement a priority queue? What is the complexity of the insert and delete operations? How can you use an ordered list to implement a priority queue? What is the complexity of the insert and delete operations?

Graph Collection A Graph is a set of vertices connected by links, called edges. Depending on the application, an edge may or may not have a direction and/or a weight. A digraph has directed edges; a weighted graph has edges with weights.

Student Question We learned about binary search trees in CS2440. Are trees an example of a collection? How are trees related to graphs?

Java Collection Framework The Java Collection Framework is a group of collections defined using interfaces abstract classes, and inheritance.