CSE 373, Copyright S. Tanimoto, 2002 Abstract Data Types - 1 Abstract Data Types Motivation Abstract Data Types Example Using math. functions to describe.

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

Digital Lesson An Introduction to Functions. Copyright © by Houghton Mifflin Company, Inc. All rights reserved. 2 A relation is a rule of correspondence.
CHAPTER 3 COLLECTIONS Abstract Data Types. 2 A data type consists of a set of values or elements, called its domain, and a set of operators acting on.
Stacks. What is a stack? Last-in first-out data structure (LIFO) New objects are placed on top Removal restricted to top object Examples?
Stacks.
HAWKES LEARNING SYSTEMS math courseware specialists Copyright © 2011 Hawkes Learning Systems. All rights reserved. Hawkes Learning Systems: College Algebra.
Abstract Data Types (ADTs) and data structures: terminology and definitions A type is a collection of values. For example, the boolean type consists of.
Chapter 3 Functions Functions provide a means of expressing relationships between variables, which can be numbers or non-numerical objects.
TECH Computer Science Data Abstraction and Basic Data Structures Improving efficiency by building better  Data Structure Object IN  Abstract Data Type.
Math – What is a Function? 1. 2 input output function.
SWEN 5130Requirements Engineering Algebraic Specification Slide 1 Algebraic Specification u Specifying abstract types in terms of relationships between.
2004 Hawaii Inter Conf Comp Sci1 Specifying and Proving Object- Oriented Programs Arthur C. Fleck Computer Science Department University of Iowa.
HAWKES LEARNING SYSTEMS math courseware specialists Copyright © 2011 Hawkes Learning Systems. All rights reserved. Hawkes Learning Systems: College Algebra.
Write a function rule for a graph EXAMPLE 3 Write a rule for the function represented by the graph. Identify the domain and the range of the function.
CSCI 383 Object-Oriented Programming & Design Lecture 25 Martin van Bommel.
Click to edit Master text styles Stacks Data Structure.
Code: BCA302 Data Structures with C Prof.(Dr.) Monalisa Banerjee By.
Advanced Data Structures Lecture 1
Functions and relations
Using the Java Collection Libraries COMP 103 # T2
Sections 3.4 Formal Specification
G64ADS Advanced Data Structures
September 29 – Stacks and queues
Today’s Topics: Function Notation Domain & Range Recognizing Functions
Relations Objectives The student will be able to:
Chapter 2: Relational Model
GC211Data Structure Lecture2 Sara Alhajjam.
Grace && Allison  && Judy 
Abstract Data Types and Stacks
Math Analysis.
Queues Queues Queues.
Cinda Heeren / Geoffrey Tien
Algebra 1 Section 1.7 Identify functions and their parts
Stacks Chapter 4.
2-1 Relations and Functions
Chap 7. Building Java Graphical User Interfaces
Chapter 2 Sets and Functions.
Discrete Structure II: Introduction
structures and their relationships." - Linus Torvalds
Functions and relations
Lexical and Syntax Analysis
Identifying functions and using function notation
Real Numbers In this class, we will consider only real numbers.
Algorithm An algorithm is a finite set of steps required to solve a problem. An algorithm must have following properties: Input: An algorithm must have.
CSE 373, Copyright S. Tanimoto, 2002 Performance Analysis -
Functions Introduction.
Pushdown automata a_introduction.htm.
Mathematical Background 1
CSE 373, Copyright S. Tanimoto, 2002 Hashing -
Mathematical Background 1
Copyright © Cengage Learning. All rights reserved.
Abstract Data Types and Stacks
Warm Up 10/15/14 How much of a 25% solution would you need to mix with 20 ounces of a 46% solution to obtain a 32% solution? If Jack can fetch a pail.
Copyright © Cengage Learning. All rights reserved.
Functions Rules and Tables.
Mathematical Background
Abstract Data Type (ADT)
Unit 4: Functions Learning Target: Students can understand that a function is a rule that assigns to each input exactly one output. The graph of a function.
Algebraic Specification Software Specification Lecture 34
Copyright © Cengage Learning. All rights reserved.
An Introduction to Functions
Section 3.1 Functions.
Copyright © Cengage Learning. All rights reserved.
Common Core Math 8 India Walton
Copyright © Zeph Grunschlag,
Section 2.1 Functions.
structures and their relationships." - Linus Torvalds
A type is a collection of values
Functions What is a function? What are the different ways to represent a function?
LINEAR DATA STRUCTURES
Presentation transcript:

CSE 373, Copyright S. Tanimoto, 2002 Abstract Data Types - 1 Abstract Data Types Motivation Abstract Data Types Example Using math. functions to describe an ADT's operations.

CSE 373, Copyright S. Tanimoto, 2002 Abstract Data Types - 2 Motivation for ADTs To organize some data, we need to say what general form it has, and what we expect to do with it. Object-oriented programming provides one way of organizing data: using classes, with their data members and methods. It is often helpful to specify our data without having to choose the particular data structure yet.

CSE 373, Copyright S. Tanimoto, 2002 Abstract Data Types - 3 Abstract Data Type (Def.) An abstract data type consists of two parts: a description of the general form of some data. a set of methods. The data is usually a set of elements, but may also include relationships among the elements. { 2, 3, 5, 7, 11} [2 < 3, 3 < 5, 5 < 7, 7 < 11, etc.]

CSE 373, Copyright S. Tanimoto, 2002 Abstract Data Types - 4 ADT Methods Each method in an ADT names and specifies an operation. The operation can be described by a function. Normally, an instance of the ADT data is one of the arguments to the function. Examples of methods: INSERT(x) MEMBER(x) SMALLEST( ) CREATE( ) --- A "constructor" does not use an instance of the ADT, but creates one.

CSE 373, Copyright S. Tanimoto, 2002 Abstract Data Types - 5 Example ADT: Stack of Integers Data: (Ordered) list of integers. Methods: CREATE, PUSH, POP, TOP, DESTROY

CSE 373, Copyright S. Tanimoto, 2002 Abstract Data Types - 6 Using Math. Functions to Describe ADT Methods Why? Math. can be used to give a concise and unambiguous description of a method. What? 1. gives a clear indication of input & output. 2. clarifies how the data changes and what is returned by the operation.

CSE 373, Copyright S. Tanimoto, 2002 Abstract Data Types - 7 Math. Description of Methods: Domain and Range of the Method's function Example: the POP operation on a stack can be described by a mathematical function: f POP : stacks  elements  stacks stacks = the set of all possible stacks (according to this ADT). elements = the set of all acceptable elements in our stacks (e.g., integers). Because the operation produces an element and it causes a change to the stack, the range of f POP is a cartesian product.

CSE 373, Copyright S. Tanimoto, 2002 Abstract Data Types - 8 The Function's Effect Now we describe how the function changes the stack and produces a value. f POP : [e 0,e 1,...,e n-1 ] |  ( e n-1, [e 0,e 1,...,e n-2 ] ) The symbol " |  " means "maps to". On its left side is a description of a generic domain element. On its right side is a description of the corresponding range element. This formula indicates that the POP operation takes an n- element stack, returns the last element, and removes it from the stack.