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

Data structures: definitions and classification

What a data structure is, and the family tree you need for every "classify data structures" question.

Syllabus says: “Basic Concepts of Data Structures — Definitions”

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

LINEAR = standing in a LINE. NON-LINEAR = a family NETWORK.

Picture it

A sadhya leaf: items are served one after another along the leaf (linear). A family WhatsApp group: everyone is connected to many people (non-linear).

Write this in the exam

A data structure is a way of organising data in memory together with the operations allowed on it, so that the data can be used efficiently.

ഒരു വരിയിൽ = linear · വല പോലെ = non-linear

What you will be able to do

  • Define a data structure in one exam-ready sentence.
  • Classify data structures: primitive / non-primitive, linear / non-linear, static / dynamic.
  • List the basic operations every data structure supports.

The story

Your room has the same things whether they are thrown on the bed or arranged on a shelf, but finding your hall ticket takes 5 seconds in one case and 15 minutes in the other. Data in a program is the same: how it is arranged decides how fast you can find, add or remove things. That arrangement, together with the operations you can perform on it, is a data structure.

Definition

Definition

A data structure is a particular way of storing and organising data in memory, together with the set of operations allowed on it, so that the data can be accessed and modified efficiently.

Program = Algorithm + Data structure (Niklaus Wirth). Choosing the right structure often matters more than clever code.

The family tree (classification)

intPrimitivecharDSArrayLinearStackNonPrimitiveTreeNonLinearGraph
Classification of data structures (queues and linked lists are linear too; float, double and pointers are primitive).
TypeMeaningExamples
PrimitiveBuilt into the language; the CPU handles them directlyint, float, double, char, pointer
Non-primitiveBuilt from primitive typesarray, structure, list, tree, graph
LinearElements form a sequence; each has one predecessor and one successor (except the ends)array, stack, queue, linked list
Non-linearAn element may connect to many others; no single sequencetree, graph
StaticSize fixed at compile timeint a[100]
DynamicSize changes at run time (malloc/free)linked list, dynamically built tree

Operations on a data structure

  • Traversal — visit every element once.
  • Search — find an element with a given value.
  • Insertion — add an element.
  • Deletion — remove an element.
  • Sorting — arrange in order.
  • Merging — combine two structures into one.
Pro tipMemory trick for operations

“The Smart Indian Doctor Should Marry” — Traverse, Search, Insert, Delete, Sort, Merge.

Where each kind shows up

NeedStructure
Undo in an editorstack
Printer jobs in arrival orderqueue
Folders inside folderstree
Roads between cities, Google Mapsgraph
Marks of 60 studentsarray

Common mistakes

  • Calling an array ‘dynamic’ — a C array declared with a fixed size is static.
  • Putting linked lists under non-linear — a linked list is still a sequence, so it is linear.
  • Defining a data structure without mentioning operations.

Quick check — can you get them all?

Question 1

Q1.Which of these is a NON-linear data structure?

Question 2

Q2.An int, a char and a pointer are…

Question 3

Q3.A linked list that grows with malloc at run time is…

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

  • Data structure = organisation of data + allowed operations.
  • Primitive vs non-primitive; linear (array, stack, queue, list) vs non-linear (tree, graph); static vs dynamic.
  • Operations: traverse, search, insert, delete, sort, merge.

References

  • Horowitz, Sahni & Anderson-Freed, Fundamentals of Data Structures in C, 2/e — Ch. 1
  • Cormen, Leiserson, Rivest & Stein, Introduction to Algorithms, 3/e — Part III introduction

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)