Starting from:
$24.99

$22.49

Lab 02 Finding your endianness

Lab 02

Finding your endianness
Download the endian.c file to your computer. Compile it with clang -Wall endian.c. Now pick a three letterwordandlookupthehexadecimalvaluesintheASCIItable(alongwiththenewlinecharacter). Create the proper 4-byte int to create that string. What is the endianness of your computer???
Greatest common divisor The greatest common divisor (GCD) of two numbers can be found by using Euclid’s algorithm. Implement the recursive Euclidean algorithm to solve the GCD of various values.
Memoization Finding a particular Fibonacci number is easy: given F(1) = F(2) = 1, one can build successively bigger valueswiththerecurrenceF(n)=F(n-1)+F(n-2). Theproblemisthatlotsofcomputationisrepeatedusing this method. One approach is to store the results of previous computation. For example, filling in an array with sentinel values of zero will let you check if that value has been computed already. If, for example, F(x) is non-zero then that value has already been computed and you can return that partial solution. Otherwise, you must compute F(x) as usual, possibly utilizing some pre-computed values. Prepend the time command to your normal command line e.g., time ./a.out 42 for both a naive and optimized versions. Is it a noticeable difference? What was the trade-off?

More products