Thanks to visit codestin.com
Credit goes to www.scribd.com

0% found this document useful (0 votes)
7 views7 pages

Data Structures Notes

The document provides an overview of data structures, including their definitions, classifications, and operations such as traversing, inserting, deleting, searching, sorting, and merging. It covers various types of data structures like arrays, linked lists, stacks, queues, and hashing, along with their applications and algorithms. Additionally, it discusses complexities, including time and space complexity, and concepts like recursion and different notations for expressions.

Uploaded by

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

Data Structures Notes

The document provides an overview of data structures, including their definitions, classifications, and operations such as traversing, inserting, deleting, searching, sorting, and merging. It covers various types of data structures like arrays, linked lists, stacks, queues, and hashing, along with their applications and algorithms. Additionally, it discusses complexities, including time and space complexity, and concepts like recursion and different notations for expressions.

Uploaded by

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

Data Structures Notes

Unit I: Introduction and Arrays

Definition of Data Structures:

A data structure is a particular way of organizing and storing data in a computer

so that it can be accessed and modified efficiently.

Classification of Data Structures:

1. Primitive Data Structures: Integer, Float, Character, Pointer

2. Non-Primitive Data Structures:

- Linear: Array, Linked List, Stack, Queue

- Non-Linear: Tree, Graph

- File Structures

Operations on Data Structures:

- Traversing

- Inserting

- Deleting

- Searching

- Sorting

- Merging

Algorithms:

An algorithm is a finite set of instructions to accomplish a particular task.

Complexity:
- Time Complexity: The amount of time an algorithm takes.

- Space Complexity: The amount of memory an algorithm uses.

- Time-Space Trade-off: More memory may reduce time complexity and vice

versa.

Arrays:

- Definition: A collection of elements identified by index or key.

- Classification:

- One-Dimensional Arrays

- Two-Dimensional Arrays

- Multi-Dimensional Arrays

Representation of Linear Arrays in Memory:

- Stored in contiguous memory locations.

- Address of any element A[i] = Base Address + (i * size of element)

Operations on Linear Arrays:

- Traversing: Visiting each element once.

- Inserting: Adding element at a position.

- Deleting: Removing element from a position.

- Searching:

- Linear Search

- Binary Search

- Sorting:

- Bubble Sort

- Selection Sort

- Insertion Sort
- Merging: Combining two sorted arrays.

Two-Dimensional Arrays:

- Represented in memory either in row-major or column-major order.

- Used to represent matrices.

Matrices and Sparse Matrices:

- Matrix: Rectangular array of numbers.

- Sparse Matrix: Matrix with many zero elements, stored efficiently using arrays

of triples (row, column, value).

Multi-Dimensional Arrays:

- Arrays with more than two dimensions. Used in complex applications.

Unit II: Linked Lists and Hashing

Linked Lists:

- Definition: A linear data structure where elements are stored in nodes and

connected by pointers.

- Comparison with Arrays:

- Dynamic size

- Efficient insertions/deletions

- No random access

Types of Linked Lists:

1. Singly Linked List

2. Doubly Linked List


3. Circular Linked List

Operations:

- Traversing

- Inserting

- Deleting

- Searching

Applications:

- Polynomial addition using linked lists.

Hashing and Collision:

- Hashing: Technique to convert a range of key values into a range of indexes.

- Hash Tables: Data structure that uses hashing to store key-value pairs.

- Hash Functions:

- Division Method

- Multiplication Method

- Mid-Square Method

- Folding Method

- Collision: When two keys hash to the same index.

- Collision Resolution:

- Open Addressing (Linear Probing, Quadratic Probing, Double Hashing)

- Chaining (Separate Chaining with Linked Lists)

Unit III: Stacks, Recursion, and Queues

Stacks:
- Definition: A linear data structure following LIFO (Last In First Out)

- Representation:

- Using Arrays

- Using Linked Lists

- Operations:

- Push (Insert)

- Pop (Delete)

- Peek (Top element)

Applications of Stacks:

- Arithmetic expression evaluation

- Expression conversion (Infix to Postfix)

- Backtracking (e.g., maze solving, undo features)

Polish Notation:

- Infix: A + B

- Prefix (Polish): +AB

- Postfix (Reverse Polish): AB+

Conversion of Infix to Postfix:

- Use stack and precedence rules

Evaluation of Postfix Expression:

- Use stack to evaluate from left to right

Recursion:

- Definition: Function calls itself to solve a problem


- Recursive Notation: f(n) = f(n-1) + f(n-2)

- Runtime Stack: Used to store activation records of recursive calls

Applications of Recursion:

- Factorial of a Number

- GCD

- Fibonacci Series

- Tower of Hanoi

Queues:

- Definition: Linear data structure following FIFO (First In First Out)

- Representation:

- Using Arrays

- Using Linked Lists

Types of Queues:

1. Simple Queue

2. Circular Queue

3. Double-Ended Queue (Deque)

4. Priority Queue

Operations:

- Enqueue (Insert)

- Dequeue (Delete)

Applications of Queues:

- CPU Scheduling
- Disk Scheduling

- Printer Queue

You might also like