Library › Coding AI › College students

Generate hash table practice problems that match your lecture

Practice: Showing an example of what you want. About 5 minutes.

About this exercise

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.

Common mistakes when you ask AI for this

  • Mixing up the table size. The notes mention size 11 and mod 10 mistakes, and the AI may use either. Try: Say: "Only size 7, h(k) = k mod 7, linear probing."
  • No wraparound problem. The AI's easy problems never reach the end of the table, the exact mistake you made on the quiz. Try: Add: "Problem 4 must wrap past index 6 to index 0."
  • Answers without the work. The AI gives just a number, so you can't see where your probe went wrong. Try: Ask: "Show the probe sequence like 3 -> 4 -> 5."
  • Too many problems, or code. The AI writes 8 problems and a Python hash table. Try: Add: "Exactly 4 numbered problems, then an Answers heading. No code."

What a strong prompt includes

  • Pins the table rules
  • Sets the number of problems
  • Asks for wraparound
  • Asks for worked answers
  • Separates the answers

Practice this now ↑

Related exercises