Data Structures and Algorithm Assignments
Data Structures and Algorithm Assignments
Algorithm:
Start
Stop.
1. start
2. declare a 2D array of size m x n
and an item to be searched
3. initialize a flag variable to false
4. for i = 0 to m-1 do
5. for j = 0 to n-1 do
6. if arr[i][j] == item then
7. set flag to true
8. print "Item found at
indices (" i ", " j ")"
9. break out of both loops
10. end if
11. end for
12. if flag == true then
13. break
14. end if
15. end for
16. if flag == false then
17. print "Item not found in the
array"
18. end if
19. stop