A
LECTURE NOTE
File &Data Structure
Theory + Programming in Python
DEPARTMENT OF IT
Prepared by,
Miss. Palak Kumari
Assistant Professor
Department of IT
CIMAGE COLLEGE
Data Structure
Week 1: Foundations
Day 1: Intro to DSA & Complexity Analysis
Day 2: Arrays Part 1 (Basics & Operations)
Day 3: Arrays Part 2 (Patterns & Problems)
Day 4: Strings & Two-Pointer Technique
Day 5: Linked Lists (Basics)
Quiz
Week 2: Linear Structures
Day 6: Linked Lists (Advanced Operations)
Day 7: Stacks: Implementation & Applications
Day 8: Queues & Deque
Day 9: Recursion Fundamentals
Day 10: Searching (Linear & Binary)
Quiz
Data Structure
Week 3: Sorting & Trees
Day 11: Bubble, Selection & Insertion Sort
Day 12: Merge Sort & Quick Sort
Day 13: Hashing & Hash Tables
Day 14: Binary Trees (Basics)
Day 15: Binary Search Trees (BST)
Quiz
Week 4: Advanced Trees & Graphs
Day 16: Tree Traversals
Day 17: AVL Trees & Balanced Trees
Day 18: Heaps & Priority Queues
Day 19: Graphs: Representation & BFS
Day 20: Graph Traversal: DFS
Quiz
Data Structure
Week 5: Advanced Topics
Day 21: Graph Algorithms: Dijkstra & Bellman-Ford
Day 22: Minimum Spanning Tree: Prim & Kruskal
Day 23: Dynamic Programming: Introduction
Day 24: Greedy & Divide-and-Conquer
Day 25: Final Project & Course Review
Quiz
Course Overview
Course Goals Daily Format
❖ Core data structures and algorithms ❖ Learning Objectives
❖ Implement algorithms ❖ Theory Explanation
❖ Analyze time and space complexity ❖ Code Examples
❖ Solve practical problems with optimal solutions. ❖ Practice Problems
❖ Daily Quiz
Prerequisites ❖ Video Resources
❖ Basic programming knowledge (variables, loops,
conditionals) Assessment
❖ Functions and basic OOP concepts
❖ Daily Quizzes (25%)
❖ Familiarity with arrays and strings
❖ Weekly Mini-Projects (40%)
❖ Final Project (35%)
Tools & Environment
❖ Programming language (C, Python)
❖ IDE of your choice (Code Block, VSCode, etc.)
❖ Git/GitHub for code submission
Day 1: Intro to DSA & Complexity Analysis
What is Data?
❑ The Qualities, Characters or Symbols on which operations are performed by a
computer, which may be stored and transmitted in the form of electrical signals and
recorded on magnetic, optical or mechanical recording media.
❑ A collection of facts from which conclusion may be drawn.
❑ e.g. Data: Temperature 32 degree Celcius;
Conclusion: it is Hot.
Example: X =A+B
Data = IS COLLEGE NAME CIMAGE MY
Information = MY COLLEGE NAME IS CIMAGE
Data means raw facts — no meaning, no explanation, just
a basic value.
Example:
Data = "CIMAGE"
This is just a word.
We don’t know what CIMAGE is — a place? a person? a
code? a college?
So data = unprocessed facts.
Information is processed data — meaning is added,
context is given.
Example :
Information = "My college name is CIMAGE"
Now we understand what CIMAGE means — it is your
college.
Meaning + clarity = information. YouTube:
[Link]
So information = processed + meaningful data. [Link]
[Link]
▪ Data: Collection of raw facts.
▪ Data Structures is about how data can be stored in different structures.
▪ It is representation of the logical relationship existing between individual
elements of data. Alogorithm + Data
▪ DS can be defined as the group of data elements which provides an efficient way Structure
of storing and organizing data in the computer so that it can be used efficiently.
= Program
▪ Some examples of Data Structures are arrays, Linked List, Stack, Queue, etc
▪ Algorithms is about how to solve different problems, often by searching
through and manipulating data structures.
Structures .
• The arrangement of data in a sequential manner is known as a linear data structure.
• The arrangement of data in a not sequential manner is known as a non-linear data structure.
• The data structures used for this purpose are Arrays, Linked list, Stacks, and Queues.
• Theory about Data Structures and Algorithms (DSA) helps us to use large amounts of data to
solve problems efficiently.
What is DSA?
DSA stands for Data Structures and Algorithms.
➢ Data Structures define how data is stored, organized, and accessed efficiently.
➢ Algorithms are step-by-step procedures to process, manipulate, and analyze that data.
Examples:
→Data Structures: Array, Linked List, Stack, Queue, Tree, Graph, Heap
→Algorithms: Binary Search, Quick Sort, Merge Sort, Dijkstra’s Algorithm
What are Algorithms?
An algorithm is a set of step-by-step instructions to solve a given problem or achieve a specific goal.
Algorithm examples:
• Finding the fastest route in a GPS navigation system
• Navigating an airplane or a car (cruise control)
• Finding what users search for (search engine)
• Sorting, for example sorting movies by rating
Why Algorithms Matter?
Algorithms decide how fast, how efficiently, and how correctly a task can be done by a computer.
Better algorithms
• Faster software
• Saves memory
• Better performance for millions of users
• Lower cost
DATA STRUCTURE:
A data structure is a way to organize, store,
and manage data so it can be used
efficiently.
like organizing items in real life:
• Books on a shelf (ordered list)
• Files in folders (hierarchical structure)
• Contacts in your phone (searchable
structure).
In programming, data structures help us:
• Store data
• Access data quickly
• Modify data efficiently
• Perform operations like search, sort, insert,
delete
Applications of DSA
• Google Search → fast search algorithms
• Facebook/Instagram → graph algorithms
• Netflix → recommendation algorithms
• Banking → secure hashing & trees
• Maps → shortest path algorithms
Why Should You Learn DSA?
1. It’s the core foundation for almost all software
systems — like GPS, search engines, AI chatbots, gaming
apps, databases, and web applications.
1. Top tech companies (Google, Microsoft, Amazon,
Meta, Apple, etc.) test DSA skills rigorously during
technical interviews.
2. DSA enhances logical and analytical thinking, helping
you become a smarter and more efficient programmer.
[Link] improves your ability to write optimized and
scalable code for real-world applications.
Classification of Data Structure Data Structure
Non- Primitive
Primitive
Integer Character Float Boolean Linear Non - Linear
Byte(1 bytes) Bool(1byte)
Char(2byte) Float(4 bytes) Trees
Long(8 bytes)
Short(2 bytes) Ex :- Graphs
Ex :- Double(8byte)
Int (4 bytes) Bollean b=true
Char ch=‘x’ Dynamic
Ex :- Static
Ex :-
Float
Int num=22 Stack
num=5678.987
8 Arrays Queue
Linked list
Single Dimension
Two Dimension
Three Dimension
Primitive Data Structure
There are basic structures and directly operated upon by the machine
instructions.
Data structures that are directly operated upon the machinelevel
instructions are known as primitive data structures.
Integer, Floatingpoint number, Character constants, string constants,
pointers etc, fall in this category.
The most commonly used operation on data structure are broadly
categorized into following types:
• Create
• Selection
• Updating
• Destroy or Delete
Non Primitive Data Structure
The Data structures that are derived from the primitive data structures
are called Nonprimitive data structure.
The nonprimitive data structures emphasize on structuring a group of
homogeneous (same type) or heterogeneous (different type) data items.
Linear Data structures:
NonLinear Data structures:
Day 2: Arrays Part 1 (Basics & Operations)
Definition of Array
An array is a collection of elements of the same
data type, stored at contiguous (continuous) Examples of Arrays
memory locations, and accessed using index Example 1: Classroom Roll Numbers
numbers. A class stores roll numbers in a list → this is
➢ Fixed size an array in memory.
➢ Fast access using index Example 3: Image Pixels
➢ Elements stored sequentially in memory A digital image is stored as an array of pixel
values.
Example: Array of 5 integers
Index: 0 1 2 3 4
Array: [10] [20] [30] [40] [50]
Memory: 100 104 108 112 116 (if int = 4 bytes)
Array Representation
• Arrays and its representation is given below Array Index: The
location of an element in an array has an index, which identifies
the element. Array index starts from 0. Array
Elements
0 1 2 3 4 5 6 7
Array Indexes
Array Index: The location of an element in an array has an index, which identifies the element.
Array index starts from 0.
Array element: Items stored in an array is called an element. The elements can be accessed via its index.
Array Length: The length of an array is defined based on the number of elements an array can store. In
the above example, array length is 8 which means that it can store 6 elements.
#include <stdio.h>
int main() {
int shoes[5] = {1,2,3,4,5};
printf("Shoe in 3rd rack: %d", shoes[2]);
return 0;
}
Example:
A shoe rack has fixed compartments → each space = 1 index.
[Link]