Unformatted text preview: What would % it be in terms of f('3',4)? %  If my input was f('312',4), what would my output be? What would % it be in terms of f('31',4)? % (etc.) %Constraints: %In order to receive credit for this problem, you MUST use recursion. %Also, you may not use dec2bin, bin2dec, base2dec, dec2base or any other %function which changes the base of a number for this problem. Problems %using these functions are subject to an automatic zero. if isempty(str) %terminating condition num = 0; %the number will equal 0 when there is an empty string else number = str2num(str(1)); %converts the first element of the string to a number so it can me %operated on mathematically num = chgBase(str(2:end),numin) + number.*numin.^(length(str)1); %clones the original function from the second position to the end, with %the same base, and adds the number from the first position in the %string multiplied by the base number raised to the length1 power end end...
View
Full
Document
This note was uploaded on 10/21/2010 for the course CS 1371 taught by Professor Stallworth during the Spring '08 term at Georgia Tech.
 Spring '08
 Stallworth
 Recursion

Click to edit the document details