Skip to content
Azhimathi Mayam logoDSA Study HubPCCST303 · KTU · S3
Module 1 · syllabusLesson live

Data abstraction and ADTs

Abstract data types separate WHAT a structure does from HOW it is built — plus the five properties every algorithm must have.

Syllabus says: “Data Abstraction”

On this page · 10 sections
ormakkurippu ✎
Never-forget card

ADT = the MENU card, not the KITCHEN. Algorithm properties = “FIDEO” (like VIDEO with an F).

Picture it

At a thattukada you order “one omelette” from the menu. You don't care which pan or stove is used — that is the implementation. The menu (what you can order) is the ADT.

Write this in the exam

An abstract data type specifies the objects and the operations on them, independent of how they are represented and implemented.

എന്ത് ചെയ്യും എന്ന് ADT പറയും, എങ്ങനെ ചെയ്യും എന്ന് implementation പറയും.

What you will be able to do

  • Explain data abstraction and abstract data types (ADTs).
  • Write an ADT specification (objects + functions).
  • State the five properties of an algorithm.

The story

You use a phone without knowing how its chip works. The buttons and screen are the interface; the circuits are the implementation. When the company changes the chip, your way of using the phone does not change. Programs work the same way: if the rest of the program uses only push and pop, you can swap an array stack for a linked stack and nothing else breaks.

Definitions

Definition

Data type: a collection of objects and a set of operations that act on them (e.g. int with +, −, *, /, %).

Definition

Abstract data type (ADT): a data type organised so that the specification of the objects and of the operations is separated from the representation of the objects and the implementation of the operations.

Definition

Algorithm: a finite set of instructions that, if followed, accomplishes a particular task.

Writing an ADT

An ADT specification lists the objects and, for every function, its name, its arguments and its result, written in plain words — no C code.

algorithm
ADT Stack is
  objects: a finite ordered list with zero or more elements
  functions: for all stack ∈ Stack, item ∈ Element, maxSize ∈ positive integer
    Stack  CreateS(maxSize)  ::= create an empty stack that can hold maxSize elements
    Boolean IsFull(stack)     ::= TRUE if the stack holds maxSize elements, else FALSE
    Stack  Push(stack, item)  ::= if IsFull(stack) then stackFull
                                  else insert item at the top of stack and return
    Boolean IsEmpty(stack)    ::= TRUE if stack has no elements, else FALSE
    Element Pop(stack)        ::= if IsEmpty(stack) then return error
                                  else remove and return the item on the top
end Stack

The five properties of an algorithm — FIDEO

LetterPropertyMeaning
FFinitenessTerminates after a finite number of steps for every input.
IInputZero or more inputs are supplied from outside.
DDefinitenessEach instruction is clear and unambiguous.
EEffectivenessEach instruction is basic enough to be carried out with pencil and paper.
OOutputAt least one output is produced.
Watch out

An OS keeps running forever — it is a program, but not an algorithm, because it violates finiteness.

Why abstraction helps

  • Change the implementation without touching the code that uses it.
  • Easier to reason about and test (you check the operations, not the internals).
  • Teams can work in parallel: one writes the ADT, another uses it.
  • The same ADT can have several implementations with different speeds.

Common mistakes

  • Writing C code inside the ADT specification.
  • Mixing up definiteness (clarity) and finiteness (termination).
  • Saying ‘ADT means a struct’ — a struct is one way to implement an ADT.

Quick check — can you get them all?

Question 1

Q1.Which statement describes an ADT?

Question 2

Q2.“The algorithm must stop after a finite number of steps” is the property of…

Question 3

Q3.A stack ADT can be implemented using…

Practice

Every visualizer has a Practice mode: predict the next state before the animation reveals it. You can also work through the topic's question set on the practice page.

Exam-ready summary

  • ADT = objects + operations, specified independently of representation.
  • Specification: function name, arguments, result — in words.
  • Algorithm properties: Finiteness, Input, Definiteness, Effectiveness, Output (FIDEO).

References

  • Horowitz, Sahni & Anderson-Freed, Fundamentals of Data Structures in C, 2/e — §1.3 (Data abstraction), §1.2 (Algorithm specification)

Explanations on this page are original. Textbook references point to where the standard treatment can be read; no text is reproduced from them.

Prefer revising from notes? Module-wise notes and question papers on Azhimathi Mayam (opens in a new tab)