Data_Structures_Assignment
Data_Structures_Assignment
---
Answer:
Concept: Stack follows LIFO (Last In First Out), Queue follows FIFO (First In First Out). We can use
Algorithm:
Initialization:
Push(x):
Pop():
Top():
1. Return front element of q1.
Pseudocode:
Function PUSH(x):
Enqueue x into q2
Swap q1 and q2
Function POP():
If q1 is empty:
return error
return Dequeue(q1)
Function TOP():
return Front(q1)
Example:
---
Answer:
Concept: Postfix has operators after operands. No parentheses needed.
Algorithm:
Example:
Evaluate: 6 2 3 + - 3 8 2 / + *
Answer = 7
---
Answer:
Stack:
Checking Parentheses:
Expression: ( [ { } ] )
Expression: ( [ { ] } )
---
Q4. Circular Queue with C/C# Functions for Insertion and Deletion
Answer:
Circular Queue:
C Functions:
Enqueue:
Dequeue:
Key Conditions:
Answer:
Fixed Expression: A + (B / C) * (D + E) - F
ABC/DE++F-
---
End of Assignment