Prévia do material em texto
Chapter 1.1, Problem 2E Step-by-step solution Step 1 of 1 Algorithm to find the Second-Smallest Element Consider three numbers a, b, and C. We need to find the middle number. Here input parameters are three numbers a, b, and and Output parameter is X the second smallest among a, b, and C. Algorithm to find the second smallest among a, b and C is as follows: sec ondMin (a, b, c) if b > && b then // if b middle value. x = b if > x && b > x then // if is middle value. x = return