#include <stdio.h>
#include <stdlib.h>
Functions | |
| void | fillList () |
| Required code to populate addr table with appropriate number of allocated memory pointers. | |
| int | totient (int i) |
| Compute the totient(i), which in number theory is the number of times to which you can add i until you get back to zero (modulo the mask). | |
| void | prepareInput () |
| Preprocess by computing the totient of the given array. | |
| void | execute () |
| Execute by invoking malloc(numElements) a total of numT times. | |
Variables | |
| int | numT |
| Number of instances that were allocated. | |
| void * | addr [] |
| The table of allocated memory. | |
| int | k |
| Using number theory, identify an integer 'k' that can be used to cycle through all elements in addr by simple addition and modulo arithmetic. | |
| int | mask |
| Use 32-bit mask rather than modulo for speed. | |
| void execute | ( | ) |
Execute by invoking malloc(numElements) a total of numT times.
| void fillList | ( | ) |
Required code to populate addr table with appropriate number of allocated memory pointers.
| void prepareInput | ( | ) |
Preprocess by computing the totient of the given array.
| int totient | ( | int | i | ) |
Compute the totient(i), which in number theory is the number of times to which you can add i until you get back to zero (modulo the mask).
| i |
| void* addr[] |
The table of allocated memory.
| int k |
Using number theory, identify an integer 'k' that can be used to cycle through all elements in addr by simple addition and modulo arithmetic.
| int mask |
Use 32-bit mask rather than modulo for speed.
| int numT |
Number of instances that were allocated.
Algorithm Development Kit 1.0