#include <stdlib.h>
#include <string.h>
#include <sys/time.h>
#include <stdio.h>
#include "report.h"
Functions | |
void | add (int *n1, int *n2, int *sum) |
Add implementation 1. | |
void | add2 (int *n1, int *n2, int *sum) |
Add implementation 2. | |
void | alt (int *n1, int *n2, int *sum) |
Add implementation 3. | |
void | last (int *n1, int *n2, int *sum) |
Add implementation 4. | |
void | randomNumber (int *num) |
Generate random number of size n directly into num. | |
void | generateTable () |
Generate full table. | |
int | main (int argc, char **argv) |
Launch program by generating table. | |
void | output (int *n1) |
Useful debugging function. | |
Variables | |
static struct timeval | before |
Time before process starts. | |
static struct timeval | after |
Time after process completes. | |
int | n |
Size of problem. |
void add | ( | int * | n1, | |
int * | n2, | |||
int * | sum | |||
) |
Add implementation 1.
void add2 | ( | int * | n1, | |
int * | n2, | |||
int * | sum | |||
) |
Add implementation 2.
void alt | ( | int * | n1, | |
int * | n2, | |||
int * | sum | |||
) |
Add implementation 3.
void generateTable | ( | ) |
Generate full table.
Timing as follows:
gettimeofday(&before, (struct timezone *) NULL); BEGIN OP HERE gettimeofday(&after, (struct timezone *) NULL); END
long usecs = diffTimer (&before, &after); SHOW RESULTS report (usecs);
void last | ( | int * | n1, | |
int * | n2, | |||
int * | sum | |||
) |
Add implementation 4.
int main | ( | int | argc, | |
char ** | argv | |||
) |
Launch program by generating table.
void output | ( | int * | n1 | ) |
Useful debugging function.
void randomNumber | ( | int * | num | ) |
Generate random number of size n directly into num.
num |
struct timeval after [static] |
Time after process completes.
struct timeval before [static] |
Time before process starts.
int n |
Size of problem.
Algorithm Development Kit 1.0