Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <stdio.h>
- #include <malloc.h>
- typedef struct node {
- struct node *next;
- int value;
- } node;
- node *numbers[1000000];
- int calcHash(int value);
- void addNode(int index ,int value);
- int main(int argc, char *argv[])
- {
- FILE *input = fopen("input.txt", "r");
- FILE *output = fopen("output.txt", "w");
- int currNumber;
- while (fscanf(input, "%d", &currNumber) != EOF)
- {
- fprintf(output, "%d ", calcHash(currNumber));
- printf("%d ", calcHash(currNumber));
- }
- getchar();
- return 0;
- }
- int calcHash(int value)
- {
- return (value / 3169);
- }
- void addNode(int index, int value)
- {
- if (numbers[index]) {
- }
- else {
- numbers[index] = malloc(sizeof(node));
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement