©Brooks/Cole, 2003 Chapter 12 Abstract Data Type.

Slides:



Advertisements
Similar presentations
ADVANCED DATA STRUCTURES AND ALGORITHM ANALYSIS Chapter 3 Lists, Stacks, and Queues.
Advertisements

1 Tree Traversal Section 9.3 Longin Jan Latecki Temple University Based on slides by Paul Tymann, Andrew Watkins, and J. van Helden.
Lecture 16: Tree Traversal.
©Brooks/Cole, 2003 Chapter 12 Abstract Data Type.
Abstract Data Types and Subprograms
Chapter 8, Part I Graph Algorithms.
© 2006 Pearson Addison-Wesley. All rights reserved14 A-1 Chapter 14 excerpts Graphs (breadth-first-search)
Advanced Data Structures
ITEC200 – Week 12 Graphs. 2 Chapter Objectives To become familiar with graph terminology and the different types of graphs To study.
Lists A list is a finite, ordered sequence of data items. Two Implementations –Arrays –Linked Lists.
Fall 2007CS 2251 Iterators and Tree Traversals. Fall 2007CS 2252 Binary Trees In a binary tree, each node has at most two subtrees A set of nodes T is.
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.
Liang, Introduction to Java Programming, Sixth Edition, (c) 2007 Pearson Education, Inc. All rights reserved L12 (Chapter 20) Lists, Stacks,
Trees Chapter 25 Slides by Steve Armstrong LeTourneau University Longview, TX  2007,  Prentice Hall.
Chapter 12 C Data Structures Acknowledgment The notes are adapted from those provided by Deitel & Associates, Inc. and Pearson Education Inc.
Transforming Infix to Postfix
© Copyright 1992–2004 by Deitel & Associates, Inc. and Pearson Education Inc. All Rights Reserved. Chapter 12 – Data Structures Outline 12.1Introduction.
Trees Chapter 23 Copyright ©2012 by Pearson Education, Inc. All rights reserved.
Tree Implementations Chapter 24 Copyright ©2012 by Pearson Education, Inc. All rights reserved.
Preorder Traversal with a Stack Push the root onto the stack. While the stack is not empty n pop the stack and visit it.
Binary Search Trees Chapter 7 Objectives
12 Abstract Data Types Foundations of Computer Science ã Cengage Learning.
By : Budi Arifitama Pertemuan ke Objectives Upon completion you will be able to: Create and implement binary search trees Understand the operation.
Chapter 8 Data Abstractions Introduction to CS 1 st Semester, 2015 Sanghyun Park.
Trees & Graphs Chapter 25 Carrano, Data Structures and Abstractions with Java, Second Edition, (c) 2007 Pearson Education, Inc. All rights reserved X.
Trees Chapter 15 Data Structures and Problem Solving with C++: Walls and Mirrors, Carrano and Henry, © 2013.
© 2006 Pearson Addison-Wesley. All rights reserved14 A-1 Chapter 14 Graphs.
9-1 Abstract Data Types Abstract data type A data type whose properties (data and operations) are specified independently of any particular implementation.
1 Chapter 17 Object-Oriented Data Structures. 2 Objectives F To describe what a data structure is (§17.1). F To explain the limitations of arrays (§17.1).
Computer Science: A Structured Programming Approach Using C Graphs A graph is a collection of nodes, called vertices, and a collection of segments,
Trees : Part 1 Section 4.1 (1) Theory and Terminology (2) Preorder, Postorder and Levelorder Traversals.
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.
Discrete Mathematics Chapter 5 Trees.
1 Chapter 7 Objectives Upon completion you will be able to: Create and implement binary search trees Understand the operation of the binary search tree.
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.
Copyright © 2007 Pearson Education, Inc. Publishing as Pearson Addison-Wesley. Ver Chapter 13: Graphs Data Abstraction & Problem Solving with C++
Chapter 8 Abstract Data Types and Subprograms. 2 Chapter Goals Distinguish between an array-based visualization and a linked visualization Distinguish.
© 2006 Pearson Addison-Wesley. All rights reserved 14 A-1 Chapter 14 Graphs.
Graphs Upon completion you will be able to:
Tree Implementations Chapter 24 © 2015 Pearson Education, Inc., Upper Saddle River, NJ. All rights reserved. Data Structures and Abstractions with Java,
Data Abstraction and Problem Solving with JAVA Walls and Mirrors Frank M. Carrano and Janet J. Prichard © 2001 Addison Wesley Data Abstraction and Problem.
1 Trees General Trees  Nonrecursive definition: a tree consists of a set of nodes and a set of directed edges that connect pairs of nodes.
Foundation of Computing Systems Lecture 4 Trees: Part I.
Hello Everyone!!! 1. Tree And Graphs 2 Features of Trees  Tree Nodes Each node have 0 or more children A node have must one parent  Binary tree Tree.
COSC 2P03 Week 21 Stacks – review A Last-In First-Out (LIFO) structure Basic Operations: –push : insert data item onto top of stack –pop : remove data.
Final Exam Review CS Total Points – 20 Points Writing Programs – 65 Points Tracing Algorithms, determining results, and drawing pictures – 50.
Computer Science: A Structured Programming Approach Using C1 Objectives ❏ To introduce the basic concepts of linked lists ❏ To introduce the basic concepts.
Breadth-first and depth-first traversal CS1114
Graph Traversal Text Weiss, § 9.6 Depth-First Search Think Stack Breadth-First Search Think Queue.
Chapter 7 Trees_ Part2 TREES. Depth and Height 2  Let v be a node of a tree T. The depth of v is the number of ancestors of v, excluding v itself. 
Data Structures: A Pseudocode Approach with C 1 Chapter 5 Objectives Upon completion you will be able to: Explain the design, use, and operation of a linear.
CPS120: Introduction to Computer Science Nell Dale John Lewis Abstract Data Types.
Final Exam Review CS 3358.
Binary Search Trees Chapter 7 Objectives
Chapter 12 Abstract Data Type.
Chapter 12 – Data Structures
Trees Chapter 15.
Lecture 1 (UNIT -4) TREE SUNIL KUMAR CIT-UPES.
Stacks – review A Last-In First-Out (LIFO) structure Basic Operations:
Fundamentals of Programming II Introduction to Trees
Chapter 15 Lists Objectives
Introduction to Data Structure
Stacks – review A Last-In First-Out (LIFO) structure Basic Operations:
Copyright ©2012 by Pearson Education, Inc. All rights reserved
Chapter 15 Lists Objectives
Slides by Steve Armstrong LeTourneau University Longview, TX
Binary Search Trees Chapter 7 Objectives
Binary Tree Iterators Tree Traversals: preorder, inorder, postorder
Presentation transcript:

©Brooks/Cole, 2003 Chapter 12 Abstract Data Type

©Brooks/Cole, 2003 Understand the concept of an abstract data type (ADT). Understand the concept of a linear list as well as its operations and applications. After reading this chapter, the reader should be able to: O BJECTIVES Understand the concept of a stack as well as its operations and applications. Understand the concept of a queue as well as its operations and applications. Understand the concept of a tree as well as its operations and applications. Understand the concept of a graph as well as its operations and applications.

©Brooks/Cole, 2003 BACKGROUNDBACKGROUND 12.1

The concept of abstraction means: 1. You know what a data type can do. 2. How it is done is hidden. Note:

©Brooks/Cole, 2003 Abstract Data Type 1.Declaration of data 2.Declaration of operations 3.Encapsulation of data and operations Note:

©Brooks/Cole, 2003 Figure 12-1 Model for ADT

©Brooks/Cole, 2003 LINEARLISTSLINEARLISTS 12.2

Figure 12-2 Linear list

©Brooks/Cole, 2003 Figure 12-3 Categories of linear lists

©Brooks/Cole, 2003 Figure 12-4 Insertion in a linear list

©Brooks/Cole, 2003 Figure 12-5 Deletion from a linear list

©Brooks/Cole, 2003 Figure 12-6 Retrieval from a linear list

©Brooks/Cole, 2003 Figure 12-7 Traversal of a linear list

©Brooks/Cole, 2003 STACKSSTACKS 12.3

Figure 12-8 Three representations of a stack

©Brooks/Cole, 2003 Figure 12-9 Push operation in a stack

©Brooks/Cole, 2003 Figure Pop operation in a stack

©Brooks/Cole, 2003 Example 1 Show the result of the following operations on a stack S. push (S, 10) push (S, 12) push (S, 8) if not empty (S), then pop (S) push (S, 2) Solution See Figure (next slide).

©Brooks/Cole, 2003 Figure Example 1

©Brooks/Cole, 2003 QUEUESQUEUES 12.4

Figure Queue representation

©Brooks/Cole, 2003 Figure Enqueue operation

©Brooks/Cole, 2003 Figure Dequeue operation

©Brooks/Cole, 2003 Example 2 Show the result of the following operations on a queue Q. enqueue (Q, 23) if not empty (Q), dequeue (Q) enqueue (Q, 20) enqueue (Q, 19) if not empty (Q), dequeue (Q) Solution See Figure (next slide).

©Brooks/Cole, 2003 Figure Example 2

©Brooks/Cole, 2003 TREESTREES 12.5

Figure Representation of a tree

©Brooks/Cole, 2003 Figure Tree terminology

©Brooks/Cole, 2003 Figure Subtrees

©Brooks/Cole, 2003 BINARYTREESBINARYTREES 12.6

Figure Binary tree

©Brooks/Cole, 2003 Figure Examples of binary trees

©Brooks/Cole, 2003 Figure Depth-first traversal of a binary tree

©Brooks/Cole, 2003 Figure Preorder traversal of a binary tree

©Brooks/Cole, 2003 Figure Inorder traversal of a binary tree

©Brooks/Cole, 2003 Figure Postorder traversal of a binary tree

©Brooks/Cole, 2003 Figure Breadth-first traversal of a binary tree

©Brooks/Cole, 2003 Figure Expression tree

©Brooks/Cole, 2003 GRAPHSGRAPHS 12.7

Figure Directed and undirected graphs

©Brooks/Cole, 2003 Figure Add vertex

©Brooks/Cole, 2003 Figure Delete vertex

©Brooks/Cole, 2003 Figure Add edge

©Brooks/Cole, 2003 Figure Delete edge

©Brooks/Cole, 2003 Figure Find vertex

©Brooks/Cole, 2003 Figure Depth-first traversal of a graph

©Brooks/Cole, 2003 Figure Breadth-first traversal of a graph

©Brooks/Cole, 2003 Figure 12-35: Part I Graph implementations

©Brooks/Cole, 2003 Figure 12-35: Part 2 Graph implementations