Given a string, S, of n digits in the range from 0 to 9, describe an efficient algorithm for converting S into the integer it represents. What is the running time of your algorithm? Solution Answer: Algorithm to convert String to Integer: Step 1: String of length n, is stored in variable S Step 2: Traverse through String S of length n by reading character by character Step i) Convert the chracter to integer by conversion function Step ii) Display the integer Step 3: end Running Time: Traversing through the String of length n, using a loop. Loop varies from 0 to n-1. So the running time of the algorithm is O(n) .