Starting from:
$30

$24

Assignment-II Solution

Solve the following problems using recursion only.

Find the count of odd digits in a given number (Upload Assign2Aa.c)
Find the largest and smallest digit in a given number (Upload Assign2Ab.c)



Write a function which prints a binary equivalent of a given number. (Upload Assign2Ac.c)



Write a recursive sorting routing using a recursive routine for finding max-min. (Upload Assign2Ad.c)



Find recursive sum of a given number (Upload Assign2Ae.c) Example of recursive sum: 75123



Implement search in sorted list using following strategies:



Split the input not into two sets of almost-equal sizes, but into three sets of sizes approximately one-third. (Upload Assign2Ba.c)



Split the input not only into two sets of almost equal sizes, but into two sets of sizes approximately two-fifth and three-fifth. (Upload Assign2Bb.c)






Read a positive integer value, and compute the following sequence using a recursive function: If the number is even, halve it; if it's odd, multiply by 3 and add 1. Repeat this process until the value is 1, printing out each value. Finally, print out how many of these operations you performed. If the input value is less than 1, print a message containing the word “Error”. (Upload Assign2C.c)






Typical output might be: Initial value is 9




Next value is 28 Next value is 14 Next value is 7 Next value is 22 Next value is 11 Next value is 34 Next value is 17 Next value is 52 Next value is 26 Next value is 13 Next value is 40 Next value is 20 Next value is 10 Next value is 5 Next value is 16 Next value is 8 Next value is 4 Next value is 2




Final value 1, number of steps 19

More products