{"id":"code-col-hash-probing-practice-set","audience":"college","category":"coding","track":"coding","technique":"examples","title":"Generate hash table practice problems that match your lecture","free":false,"task":"Your Data Structures exam uses only linear probing with a table of size 7 and h(k) = k mod 7. Make exactly 4 numbered practice problems, each inserting a short list of keys into an empty table and asking for the final index of one key, getting harder, with problem 4 requiring wraparound past index 6 to index 0. Then an 'Answers' heading with 4 numbered answers that show the probe sequence, like '3 -> 4 -> 5'. No code blocks, under 170 words in total.","materialLabel":"Your lecture notes (attached to your prompt automatically)","material":"CS 260 Data Structures - Week 9 notes - Hash tables\n\nHash table = array of buckets + hash function that maps a key to an index.\n\nCollision = two keys hash to the same index.\n\nWays to handle collisions (Prof. Hartley covered 3):\n  1. separate chaining - each bucket holds a linked list\n  2. linear probing - if index i is full, try i+1, i+2, ... (wrap at the end)\n  3. quadratic probing - try i+1, i+4, i+9, ...\n  (she said only #2 is on the exam, chaining is on the next homework)\n\nLecture example: table size 7, h(k) = k mod 7\n  insert 10 -> 10 mod 7 = 3 -> index 3\n  insert 17 -> 17 mod 7 = 3 -> full -> index 4\n  insert 24 -> 24 mod 7 = 3 -> full, 4 full -> index 5\n\nLoad factor = number of items / table size. Keep it under 0.7.\n\nBook uses size 11 in chapter 5 examples (don't mix them up!!)\n\nThings I got wrong on the quiz:\n  - forgot to wrap around: from index 6 the next try is index 0\n  - used k mod 10 out of habit\n  - counted the first try as a \"probe\" sometimes and not others","rules":[{"type":"questionCount","count":4},{"type":"codeBlocks","count":0},{"type":"maxProseWords","max":170}],"mistakes":[{"title":"Mixing up the table size","why":"The notes mention size 11 and mod 10 mistakes, and the AI may use either.","fix":"Say: \"Only size 7, h(k) = k mod 7, linear probing.\"","checks":["r0"]},{"title":"No wraparound problem","why":"The AI's easy problems never reach the end of the table, the exact mistake you made on the quiz.","fix":"Add: \"Problem 4 must wrap past index 6 to index 0.\"","checks":["r1"]},{"title":"Answers without the work","why":"The AI gives just a number, so you can't see where your probe went wrong.","fix":"Ask: \"Show the probe sequence like 3 -> 4 -> 5.\"","checks":["r2"]},{"title":"Too many problems, or code","why":"The AI writes 8 problems and a Python hash table.","fix":"Add: \"Exactly 4 numbered problems, then an Answers heading. No code.\"","checks":["questionCount","codeBlocks","maxProseWords"]}],"promptHints":[{"label":"Pins the table rules","patterns":["size 7","mod 7","linear probing"]},{"label":"Sets the number of problems","patterns":["\\b(4|four)\\b.{0,20}(problem|question)"]},{"label":"Asks for wraparound","patterns":["wrap","index 0","past (index )?6"]},{"label":"Asks for worked answers","patterns":["->","probe sequence","show (the )?(work|steps)"]},{"label":"Separates the answers","patterns":["answers? (heading|section|at the end|after)","answer key"]}],"hint":"Practice only helps if it matches the exam and your weak spots. Tell the AI the exact table rules, how many problems, which one must wrap around, and how to show the answers.","rubricLabels":["Every problem uses a table of size 7, h(k) = k mod 7 and linear probing only (no size 11, mod 10, chaining or quadratic probing)","Problem 4 needs wraparound: one key's probe sequence goes past index 6 to index 0 or higher, and its answer shows that sequence (e.g. 6 -> 0)","After a line reading Answers there are exactly 4 numbered answers, each showing its probe sequence with arrows like '3 -> 4 -> 5', and each final index is correct for the keys given"]}