UNIT I Data Structures Notes
UNIT I Data Structures Notes
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)
Basic ways of storing and organizing data: Variables, Constants, Pointers, Arrays.
Example:
int a = 10;
Example:
ADT is a model that defines a data type by its behavior (operations), not implementation.
5. Algorithms:
return -1;
6. Complexity of Algorithms:
7. Time-Space Trade-Off:
Example:
9. Algorithmic Notations:
Pseudocode (Factorial):
function factorial(n):
if n == 0 then return 1
Flow control in code: Sequential, Conditional (if, else), Looping (for, while)
Example:
Examples:
Linear Search - O(n), Binary Search - O(log n), Bubble Sort - O(n^2)