Difference_Array_LinkedList_Stack_Queue
Difference_Array_LinkedList_Stack_Queue
|--------------------|-----------------------------------------------------------------------|----------------------------------------
----------------------------|
nodes, where each node contains data and a reference to the next node. |
pointers. |
Example:
- Linked List:
struct Node {
int data;
};
Difference Between Stack and Queue:
|--------------------|--------------------------------------------|------------------------------------------|
| Definition | Linear data structure following LIFO (Last In, First Out). | Linear data structure
| Operations | Push (add), Pop (remove), Peek (view top). | Enqueue (add), Dequeue (remove),
| Access | Only the top element is accessible. | Both front and rear elements are
accessible. |
Examples:
- Stack:
#include <stdio.h>
#define MAX 5
- Queue:
#include <stdio.h>
#define MAX 5