Class Notes: Data Structures
Introduction
Data structures are foundational concepts in computer science that allow us to store, organize, and
manage data efficiently. They define how data is stored and how operations like retrieval, insertion, and
deletion are performed.
Arrays
Arrays are fixed-size, ordered collections of elements of the same type. Elements are accessed by their
index.
Use-cases: Storing a list of student names, numerical data in scientific computing.
Linked Lists
Linked lists consist of nodes, where each node contains data and a reference to the next node.
Use-cases: Implementing stacks and queues, dynamic memory allocation.
Stacks and Queues
Stacks (LIFO): Useful for undo functionality in applications.
Queues (FIFO): Useful for printer queues, task scheduling.
Trees
Hierarchical structures with a root node and child nodes. Binary trees, AVL trees, and B-trees are
common examples.
Use-cases: File system representation, hierarchical data like HTML DOM.
Graphs
Graphs consist of vertices and edges, representing networks like social connections or transportation
systems.