0% found this document useful (0 votes)
4 views3 pages

UNIT I Data Structures Notes

The document provides an overview of data structures, defining them as methods for organizing and storing data efficiently. It covers various types of data structures, operations, abstract data types, algorithms, and complexities, including time-space trade-offs and algorithmic notations. Additionally, it discusses control structures and asymptotic notations to describe algorithm efficiency.

Uploaded by

keerthana.m
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)
4 views3 pages

UNIT I Data Structures Notes

The document provides an overview of data structures, defining them as methods for organizing and storing data efficiently. It covers various types of data structures, operations, abstract data types, algorithms, and complexities, including time-space trade-offs and algorithmic notations. Additionally, it discusses control structures and asymptotic notations to describe algorithm efficiency.

Uploaded by

keerthana.m
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/ 3

UNIT I - Data Structures: Introduction and Overview

1. Definition of Data Structures:

A data structure is a way of organizing and storing data in a computer so that it can be accessed and

modified efficiently.

Types: Primitive (int, char), Non-primitive (Arrays, Lists, Stacks, Queues, Trees, Graphs)

2. Elementary Data Organization:

Basic ways of storing and organizing data: Variables, Constants, Pointers, Arrays.

Example:

int a = 10;

int arr[5] = {1, 2, 3, 4, 5};

3. Data Structures and Operations:

Operations: Insertion, Deletion, Traversal, Searching, Sorting.

Example:

for (int i = 0; i < 5; i++) { printf("%d ", arr[i]); }

4. Abstract Data Types (ADT):

ADT is a model that defines a data type by its behavior (operations), not implementation.

Example: Stack ADT (push, pop), Queue ADT (enqueue, dequeue)

5. Algorithms:

A finite set of instructions to solve a problem.

Example (Linear Search):

int linearSearch(int arr[], int size, int key) {

for(int i = 0; i < size; i++) {

if(arr[i] == key) return i;


}

return -1;

6. Complexity of Algorithms:

Time Complexity - Time taken with input size

Space Complexity - Memory used

Linear Search: O(n)

7. Time-Space Trade-Off:

Improving time may use more space and vice versa.

Example: Hash tables - more memory, faster search.

8. Preliminaries: Mathematical Notations and Functions:

Used to express algorithm behavior: O(1), O(log n), O(n), O(n^2)

Example:

int sum(int n) { return (n * (n + 1)) / 2; }

9. Algorithmic Notations:

Standard representations like pseudocode or flowcharts.

Pseudocode (Factorial):

function factorial(n):

if n == 0 then return 1

else return n * factorial(n - 1)

10. Control Structures:

Flow control in code: Sequential, Conditional (if, else), Looping (for, while)
Example:

if (a > b) { printf("A is greater"); }

11. Asymptotic Notations:

Used to describe efficiency: Big O (O), Omega (Omega), Theta (Theta)

Examples:

Linear Search - O(n), Binary Search - O(log n), Bubble Sort - O(n^2)

You might also like