0% found this document useful (0 votes)
50 views

An Abstract Data Type

An Abstract Data Type (ADT) is a data structure that provides operations to manipulate data without exposing its underlying implementation. Common ADTs include stacks, queues, linked lists, trees, and graphs. A stack is a Last In First Out (LIFO) structure where elements can be added to or removed from the top. A queue is a First In First Out (FIFO) structure where elements are added to the back and removed from the front. Linked lists contain nodes connected by pointers, allowing flexible implementations of stacks and queues. Trees and graphs represent hierarchical and network relationships between data.

Uploaded by

Ignacio Sanchez
Copyright
© © All Rights Reserved
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
50 views

An Abstract Data Type

An Abstract Data Type (ADT) is a data structure that provides operations to manipulate data without exposing its underlying implementation. Common ADTs include stacks, queues, linked lists, trees, and graphs. A stack is a Last In First Out (LIFO) structure where elements can be added to or removed from the top. A queue is a First In First Out (FIFO) structure where elements are added to the back and removed from the front. Linked lists contain nodes connected by pointers, allowing flexible implementations of stacks and queues. Trees and graphs represent hierarchical and network relationships between data.

Uploaded by

Ignacio Sanchez
Copyright
© © All Rights Reserved
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 1

An Abstract Data Type (ADT) is a data structure that provides a set of operations to

interact with and manipulate data. Unlike concrete data types such as integers,
arrays, and structures, ADTs abstract away the implementation details of how data is
stored and processed, allowing for a more flexible and modular design. Some of the
most commonly used ADTs are:

1. Stack: A Stack is a Last In, First Out (LIFO) data structure where elements are
added and removed from the top of the stack. This makes it well suited for
tasks such as keeping track of function calls in a program (known as a call
stack). The main operations on a stack include push (add an element to the
top), pop (remove the top element), and top (get the top element without
removing it).
2. Queue: A Queue is a First In, First Out (FIFO) data structure where elements
are added to the back and removed from the front. This makes it well suited
for tasks such as keeping track of incoming requests or tasks that need to be
performed in order. The main operations on a queue include enqueue (add an
element to the back), dequeue (remove the front element), and front (get the
front element without removing it).
3. Linked List: A Linked List is a data structure where each element (node)
contains a value and a pointer to the next node in the list. Linked lists can be
used to implement various other ADTs such as Stacks and Queues. The main
operations on a linked list include insert (add a new node), delete (remove a
node), and find (locate a node with a specific value).
4. Tree: A Tree is a hierarchical data structure where each node has a parent and
zero or more children. Trees can be used to implement various algorithms
such as searching and sorting, as well as to represent hierarchical relationships
between data (such as in a file system). The most commonly used type of tree
is a Binary Tree, where each node has at most two children. The main
operations on a tree include insert (add a new node), delete (remove a node),
and find (locate a node with a specific value).
5. Graph: A Graph is a collection of vertices (nodes) and edges (connections
between vertices). Graphs can be used to represent relationships between
data, such as the connections between friends on a social network. The main
operations on a graph include add_vertex (add a new node), add_edge (add a
connection between two nodes), and find (locate a node with a specific value).

Here's an example of how you could implement a Stack ADT in C++ using an array:

You might also like