0% found this document useful (0 votes)
54 views12 pages

What Is An Abstract Data Type?

An abstract data type (ADT) is a mathematical model of data that defines the type's behavior from the point of view of a user, specifically in terms of possible values, possible operations on data of this type, and the behavior of these operations. An ADT describes a concept without depending on its concrete implementation. It focuses on what something does rather than how it is done. A data structure implements an ADT by providing concrete representations of values and algorithms that implement the ADT's operations.

Uploaded by

Syed Fahad
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
54 views12 pages

What Is An Abstract Data Type?

An abstract data type (ADT) is a mathematical model of data that defines the type's behavior from the point of view of a user, specifically in terms of possible values, possible operations on data of this type, and the behavior of these operations. An ADT describes a concept without depending on its concrete implementation. It focuses on what something does rather than how it is done. A data structure implements an ADT by providing concrete representations of values and algorithms that implement the ADT's operations.

Uploaded by

Syed Fahad
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
You are on page 1/ 12

What is an Abstract Data Type?

What is an Abstract Data Type?

Abstract Data Type (ADT) -

1) An opportunity for an acronym

2) Mathematical description of an object and the set of operations on the object.


 An ADT consists of a data declaration packaged
together with the operations that are meaningful
on the data while embodying the structured principles of encapsulation and data hiding.
Abstract Data Type

 ADT users are NOT concerned with how the task is done but rather what it can do.

 An abstract data type is a data declaration packaged together with the operations that are
meaningful for the data type.

 We encapsulate the data and the operations on the data, and then hide them from the user.

 All references to and manipulation of the data in a data structure are handled through
defined interfaces to the structure.
Data Structures : Algorithms

 Algorithm
 A high level, language independent description of a step-by-step process for solving a problem
 Data Structure
 A set of algorithms which implement an ADT
ADT Presentation Algorithm

 Present an ADT
 Motivate with some applications
 Repeat until browned entirely through
 develop a data structure for the ADT
 analyze its properties
 efficiency
 correctness
 limitations
 ease of programming
 Contrast data structure’s strengths and weaknesses
 understand when to use each one
Algorithm Efficiency

 To design and implement algorithms, programmers must have a basic understanding of what constitutes good, efficient
algorithms.
• Linear Loops
-Efficiency is a function of the number of intstructions.
- Loop update either adds or subtracts.
• Logarithmic Loops
-The controlling variable is either multiplied or divided in each iteration.
- The number of iteration is a function of the multiplier or divisor.
• Nested Loops
- The number of iterations is the total number which is the product of the number of iterations in the inner loop and
number of iterations in the outer loop.
• Big-O Notation
-Not concerned with exact measurement of efficiency but with the magnitude.
- A dominant factor determines the magnitute.
Applications of the Q

 Hold jobs for a printer


 Store packets on network routers
 Hold memory “freelists”
 Make waitlists fair
 Breadth first search
Stacks in Practice

 Function call stack


 Removing recursion
 Balancing symbols (parentheses)
 Evaluating Reverse Polish Notation
 Depth first search
Arrays – Linked Lists

 Limitations of Arrays 
 Fixed in size :
       Once an array is created, the size of array cannot be increased or decreased.
 Wastage of space :
       If no. of elements are less, leads to wastage of space. 
 Sequential Storage :
       Array elements are stored in contiguous memory locations. At the times it might so happen that enough contiguous locations might not be
available. Even though the total space requirement of an array can be met through a combination of non-contiguous blocks of memory, we would
still not be allowed to create the array.
 Possibility of overflow :
       If program ever needs to process more than the size of array, there is a possibility of overflow and code breaks.
 Difficulty in insertion and deletion :
       In case of insertion of a new element, each element after the specified location has to be shifted one position to the right. In case of deletion of 
an element, each element after the specified location has to be shifted one position to the left.
What is a Linked List

 What is a Linked List


   The elements of a linked list are not constrained to be stored in adjacent locations.
 The individual elements are stored “somewhere” in memory, rather like a family dispersed,
but still bound together.
 The order of the elements is maintained by explicit links between them.
What is a Linked List
What is a Linked List

  The Linked List is a collection of elements called nodes, each node of which stores two items of
information, i.e., data part and link field.
    -- The data part of each node consists  the data record of an entity.
    -- The link field is a pointer and contains the address of next node.
    -- The beginning of the linked list is stored in a pointer termed as head which points to the first node. 
    --  The head pointer will be passed as a parameter to any method, to perform an operation. 
    -- First node contains a pointer to second node, second node contains a pointer to the third node and
so on.
    -- The last node in the list has its next field set to NULL to mark the end of the list.

You might also like