Basics to understand searches

What is a Queue?

A Queue is a data structure that follows the rule:

FIFO → First In, First Out

That means the element that goes in first, comes out first — like a line at a ticket counter .

 Enqueue

Enqueue means adding an element to the end of the queue.

Example:
Queue = [A, B]
If we enqueue C,
→ Queue becomes [A, B, C]

You are pushing C to the end.

 Dequeue

Dequeue means removing the element from the front of the queue.

Example:
Queue = [A, B, C]
If we dequeue,
→ A is removed, and now Queue = [B, C]

ConceptData StructureExample analogyUsed in
Queue (FIFO)First In, First OutLike people standing in a line for tickets – first person in goes firstBFS
Stack (LIFO)Last In, First OutLike a stack of plates – the last one kept is picked firstDFS

Common Concepts to Introduce Before BFS/DFS

Before explaining, remind them:

ConceptMeaning
StateA possible situation in the problem space
Start StateThe node from where search begins
Goal StateThe desired destination or solution
PathSequence of actions from start to goal
FrontierList of nodes generated but not yet expanded
Explored SetNodes already expanded (visited)

Breadth-First and Depth-First Search

These two are the basic Uninformed Search algorithms
meaning they don’t use any heuristic or prior knowledge.
They simply explore the search space systematically.

Both BFS and DFS are fundamental algorithms used to explore or traverse trees and graphs.
In AI, they are used by problem-solving agents to find a path from a start state to a goal state.