This repository contains C language implementations of stack and queue data structures using linked lists. Additionally, there are exercises to reinforce your understanding of these fundamental data structures.
Understanding stack and queue data structures is crucial in computer science. This repository provides implementations of stacks and queues using linked lists, which are dynamic data structures allowing efficient memory usage.
- push(Stack** head, int item): Adds an item to the stack.
- pop(Stack** head): Removes and returns the top item from the stack.
- peek(Stack** head): Returns the top item without removing it.
- isEmptyS(Stack* head): Checks if the stack is empty.
- enqueue(Queue** head, int item): Adds an item to the rear/end of the queue.
- dequeue(Queue** head): Removes and returns the item from the front of the queue.
- front(Queue* head): Returns the item at the front without removing it.
- isEmptyQ(Queue* head): Checks if the queue is empty.
-
Reverse a Queue:
- Reverse the elements of a queue using a stack.
-
Check if parentheses are balanced:
- Ckech if an expression has balanced parentheses or not using a stack.
-
Clone the repository:
git clone https://github.com/maryqu3en/stack-queue-in-LL.git
-
Navigate to the project directory:
cd stack-queue-in-LL
-
Compile the C files:
gcc -o main *.c
-
Run the program:
./main