thumbnail

Hash

Quiz by
Hralyb
Rate:
Last updated: May 14, 2025
You have not attempted this quiz yet.
First submittedMay 14, 2025
Times taken1
Average score100.0%
Report this quizReport
30:00
Enter answer here
0
 / 46 guessed
The quiz is paused. You have remaining.
Scoring
You scored / = %
This beats or equals % of test takers also scored 100%
The average score is
Your high score is
Your fastest time is
Keep scrolling down for answers and more stats ...
Hint
Answer
hash funkce (pid+pg)
int hashPg(int pid, int pg);
HashTBRec
struct HashTBRec {
 
int pid;
 
int pg;
 
int fr;
 
struct HashTBRec *next;
 
};
pg2fr
int pg2fr(int pid, int pg) {
 
struct HashTBRec *rec = hashTb[hashPg(pid, pg)];
 
while (rec != NULL) {
 
if (rec->pid == pid && rec->pg == pg)
 
return rec->fr;
 
rec = rec->next;
 
}
 
return -1;
 
}
hash funkce (reg+pg)
int hashPg(int reg, int pg);
HashTBRec
struct HashTBRec {
 
int reg;
 
int pg;
 
int fr;
 
struct HashTBRec *next;
 
};
Hint
Answer
local to global
int local_to_global(int pid, int local_reg);
pg2fr
int pg2fr(int pid, int reg, int pg) {
 
int global_reg = local_to_global(pid, reg);
 
struct HashTBRec *rec = hashTb[hashPg(global_reg, pg)];
 
while (rec != NULL) {
 
if (rec->reg == global_reg && rec->pg == pg)
 
return rec->fr;
 
rec = rec->next;
 
}
 
return -1;
 
}
invTBItem deklarace
struct InvTBItem {
 
int pid;
 
int pg;
 
};
velikost ramcove pameti
struct InvTBItem InvTb[N];
pg2fr_inv
int pg2fr_inv(int pid, int pg) {
 
for (int i = 0; i < N; i++) {
 
if (InvTb[i].pid == pid && InvTb[i].pg == pg)
 
return i;
 
}
 
return -1;
 
}
Save Your Stats
Your Next Quiz
Name all 50 states in the USA. Easy, right?
Can you identify these brands based on their logos?
Drag the flag onto the correct country. Careful, though! One wrong move and the game ends.
Click the people, places, and things that are mentioned in the Bible? But don't click any of the ones that aren't!
Comments
No comments yet