Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- int tabelDispersie[N] = { NULL };
- int altTabel[] = { 7, 13, 44, 18, 20, 4, 2, 99, 100, 5, 777 };
- int factorDeUmplere = (95 * N) / 100;
- //for (int i = 0; i < sizeof(altTabel) / sizeof(int); i++) {
- for (int i = 0; i < factorDeUmplere; i++){
- if (!(hashTableInsert(altTabel[i], tabelDispersie)))
- break;
- }
- printf("Tabel initial:");
- for (int i = 0; i < sizeof(altTabel) / sizeof(int); i++) {
- printf("%d ", altTabel[i]);
- }
- printf("\n");
- printf("Afisare tabela de dispersie:\n");
- for (int i = 0; i < N; i++) {
- printf("Pe pozitia %d avem: %d \n", i, tabelDispersie[i]);
- } //0: 20; 1: 100; 2: 2; 3: 13; 4: 44; 5: 4; 6: 5; 7: 7; 8: 18; 9: 99
- int nrS = 0;
- int nrMaxS = 1;
- int index = hashKeySearch(altTabel[7], tabelDispersie, &nrS, &nrMaxS);
- if (index)
- printf("Cheia %d a fost gasita la indexul: %d!\n", altTabel[7], index);
- else
- printf("Cheia nu a fost gasita in tabela!\n");
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement