datastructure_module1
datastructure_module1
Introduction to Algorithmic
Algorithm Efficiency
I
• Measured in terms of time
complexity and space complexity.
Types
Classification
Memory Representation
• Address formula:
; of A [i] = Base Address + (i x Size of each element)
Operations on Arrays
1 . Insertion
2. Deletion
3. Searching
4. Sorting
Stacks
Operations
int pop() {
if (top== -1) {
printf( 11 Stack Underflow");
return -1;
}
return stack[top--];
}
Applications of Stacks
• Expression Evaluation (Postfix/
Infix)
Operations
int dequeue() {
if (front== -1 I I front> rear) {
printf( 11 Queue Underflow");
return -1;
}
return queue[front++];
}
Applications of Queues