Problem Solving and search

Problem Solving and Search

Iha Algortima barak hodi rezolve ka solusiona problema, iha algoritma hanesan BFS, DFS, A*, Dijkstra. Algoritma hirak ne’e fasilita ita hodi rezolve ita nia problema ho lais no efisiente, uza maneira husi algoritma hirak ne’e.

Tipu Algoritma

Iha ne'e iha algoritma hirak ne'ebe baibain utilija

BFS

Breadth-First Search

Breadth-First Search maka algoritmu ba buka (seacrhing) iha graf ka ai-strutura tuir nivel husi node inisial, uza queue, no garante buka dalan ne'ebe badak liu

DFS

Depth-First Search

Depth-First Search maka algoritmu ba buka (seacrhing) iha graf ka ai-strutura, DFS uza stack ka rekursaun no nia diak liu ba graf ne'ebe klean tebes no la presija hetan dalan ne'ebe badak liu

A*

A* Search

A* (A-star) Search mak algoritmu buka dalan badak liu husi pontu hahú ba pontu objetivu ho dalan neebé efisiente liu. Algoritmu nee halo kombinasaun entre kustu neebé já passa ho estimasaun kustu ba objetivu.

Dijkstra

Dijkstra's Algorithm

lgoritmu Dijkstra mak algoritmu buka dalan badak liu husi pontu ida (source) ba pontu seluk iha grafu, ho kondisaun katak kustu (peso) hotu-hotu la bele negativu.

Algorithm Visualization

8 nodes
Medium

Current Algorithm

Algorithm: BFS
Nodes Visited: 0
Path Length: 0
Time Complexity: O(V+E)
Space Complexity: O(V)

Steps

Initializing graph...

Legend

Start Node
End Node
Visited Node
Path Node
Wall/Obstacle

Algorithm Details

Breadth-First Search (BFS)

BFS is a graph traversal algorithm that explores all neighbor nodes at the present depth before moving on to nodes at the next depth level.

How it works:

  1. Start from the root node
  2. Visit all adjacent nodes
  3. Move to next level nodes
  4. Repeat until target is found

Characteristics:

  • Completeness: Yes (for finite graphs)
  • Optimality: Yes (for unweighted graphs)
  • Time Complexity: O(V + E)
  • Space Complexity: O(V)

Use Cases:

  • Shortest path in unweighted graphs
  • Web crawling
  • Social network analysis
  • GPS navigation systems

Depth-First Search (DFS)

DFS explores as far as possible along each branch before backtracking. It uses a stack data structure.

A* Search Algorithm

A* uses heuristics to find the optimal path by minimizing f(n) = g(n) + h(n).

Dijkstra's Algorithm

Finds the shortest path between nodes in a graph with non-negative edge weights.