Esempio n. 1
0
/**
 * Prints out all the words stored in the hashtable and the frequency of
 * each of them.
 *
 * @param h the htable to get the words from.
 * @param stream the output stream to write to.
 */
void htable_print(htable h){
    int i;

    for (i = 0; i < h->num_keys; i++){
        if ((h->keys[i]).key != NULL) {
            printf("%s\t", (h->keys[i]).key);
            flexarray_print((h->keys[i]).postings);
            printf("\n");
        }
    }
    printf("Number of words entered: %d", h->num_keys);
}
Esempio n. 2
0
int main(void) {
    int item;
    flexarray my_flexarray = flexarray_new();

    while (1 == scanf("%d", &item)) {
        flexarray_append(my_flexarray, item);
    }

    flexarray_sort(my_flexarray);
    flexarray_print(my_flexarray);
    flexarray_free(my_flexarray);

    return EXIT_SUCCESS;
}
Esempio n. 3
0
int main(void)
{
  int item;
  flexarray f1 = flexarray_new();

  while(1 == scanf("%d",&item))
    {
      flexarray_append(f1,item);
    }
  flexarray_sort(f1);
  flexarray_print(f1);
  flexarray_delete(f1);

  return EXIT_SUCCESS;
}