Professional Documents
Culture Documents
Lect 3 - 2024
Lect 3 - 2024
aft
Foundations of
Data Structures & Algorithms
Lect 3
Sameera Muhamed Salam
Dept of CSIS, BITS Pilani, Hyderabad Campus
Dr
Algorithm & Algorithm Analysis
Given an array A, write a pseudocode to find the smallest element in the array?
Example: 4 3 2 10 12 1 5 6
Algorithm?
Example: 7, 4, 8, 2, 5, 3, 9
I It Selects the smallest (or largest) element from the unsorted portion of the list
and swap it with current element.
Algorithm?