Abstract Data Type - Maple Programming Help

Online Help

All Products    Maple    MapleSim


Home : Support : Online Help : Math Apps : Computer Science : MathApps/AbstractDataType

Abstract Data Type

Main Concept

An abstract data type (ADT) is a mathematical model defined by a set of behavioral properties, including possible values and possible operations on stored data. Note that the difference between an ADT and a data structure is that ADTs are conceptual models and data structures are actual representations of data used to implement ADTs.

 

This application illustrates the behaviors of three common ADTs: Stack, Queue, and Deque.

Stack

A stack has two principle operations, Push, which inserts elements to the existing stack, and Pop, which returns the most recent item and deletes it from the stack. It is a First-In-Last-Out (FILO) structure. An additional operation is Top/Peek, which returns the most recent item without removing it. Common applications of Stack includes backtracking and recursion support.

Queue

A queue also has two major operations, Enqueue, which inserts elements to the existing queue, and Dequeue, which returns the first item added to the queue (earliest entry) and deletes it from the queue. It is a First-In-First-Out (FIFO) structure. An additional operation is Front, which returns the most first (earliest) item without removing it. Common applications of Queue includes breadth-first search and operating system.

Deque

A deque is a double-ended queue. It behaves very similar to a Queue, the difference is that deque allows insertion, deletion, and peek at both ends of the data collection. Deques are used to model situations where entities enter and leave at both ends, and can also be implemented as stacks or queues if needed. Common applications of a deque include palindrome checking and undo-redo functionality for software.

 

1. Choose an ADT

2. Select an operation

3. (optional) Enter the input value

4. Execute the selected operation

   

 

More MathApps

MathApps/ComputerScience