Algorithm to find smallest element

  • Thread starter Thread starter Bucs44
  • Start date Start date
  • Tags Tags
    Algorithm Element
Join the discussion
Registration is free. Ask a follow-up in this thread, or start your own.
6 replies · 7K views
Bucs44
Messages
57
Reaction score
0
I'm working on an algorithm that finds the smallest element among a, b, and c.

Here is what I have so far:

Input: a,b,c
Output: small; smallest element in the sequence a,b,c
a = 2, b = 4, c = 3
Small = a
If b < small, then small = b
If c < small, then small = c

Is this right?
 
Physics news on Phys.org
I'm just wondering if I worded it correct and it constitutes as an algorithm?
 
I actually added the a = 2, b = 4, c = 3 portion as I thought that was what was needed in order to perform the algorithm