chapter

    Other Key Data Structures Practice Questions for Cmi M.sc. and Ph.d. Computer Science

    Solve 0+ Other Key Data Structures practice questions for CMI M.Sc. and Ph.D. Computer Science with answers and detailed solutions. Free sample questions belo

    Free preview ends here

    Login to view the complete practice questions and solutions

    Creating an account is free. You get the rest of this chapter, step-by-step solutions, and a study plan built around the topics you are actually weak at.

    Explore complete test series, official past papers, and chapter-wise study tools.

    Why MastersUp

    Personalised first. High quality throughout.

    Most platforms hand everyone the same content. Here the content moves with your performance, topic by topic.

    Built around you, not around a syllabus PDF

    Every answer you give moves your topic-level intelligence rate. The next question, the next revision card and tomorrow's plan all change with it.

    Revision that hits your weak spots

    We only revise topics you have actually attempted and are still below the safe bar on — never the same chapter on repeat.

    Questions calibrated to the real exam

    Each question carries a measured toughness. You are served a rung above your current level, so practice keeps stretching you.

    Notes written for recall, not for volume

    Full lesson cards for first study, curated short-note cards for the last mile — with derivations, traps and exam patterns marked.

    One place for everything

    Notes, chapter practice, previous-year questions, test series and full-length papers — all feeding one picture of your preparation.

    Honest progress

    No vanity streaks. Progress here means chapters mastered and accuracy that held up on harder questions.

    Unlock the whole course

    Full notes and short notes, the complete question bank with worked solutions, mock tests, full-length papers, and an adaptive plan that rebuilds itself as you improve.

    Other Key Data Structures Practice Questions for CMI M.Sc. and Ph.D. Computer Science

    Solve 0+ Other Key Data Structures practice questions for CMI M.Sc. and Ph.D. Computer Science with answers and detailed solutions. Free sample questions below.

    Hash table and hash function definition

    Intuition

    Hash table and hash function definition

    A hash function compresses the large key space into a small table of size .

    The problem it solves

    Imagine a library with one million possible book IDs but only five hundred books on the shelf. Storing them in a direct addressing table wastes most of the million slots. This analogy stops being valid when keys are not integers or when the universe is infinite.

    The idea made exact

    Formally, a hash function maps a universe of keys to indices . A hash table is an array where key lives at index . The exact version adds the requirement that be computable in constant time.

    We use keys 10, 22, 31, 4, 18 with table size . The hash function maps each key to a slot.

    constant time computable

    Modular hashing and slot assignment

    Derivation

    Modular hashing and slot assignment

    We compute the slot for each key using modular arithmetic and track collisions.

    keys are non-negative integers table size
    Step by step construction
    1. Compute . Key 10 goes to slot 3. first insertion
    2. Compute . Key 22 goes to slot 1. second insertion
    3. Compute . Key 31 goes to slot 3. collision with 10
    4. Compute . Key 4 goes to slot 4. fourth insertion
    5. Compute . Key 18 goes to slot 4. collision with 4
    6. Result: the slots used are 3, 1, 3, 4, 4 in insertion order. slots 3 and 4 each receive two keys
    7. The table size is prime, which helps spread keys that share factors. if were composite and shared a factor with many keys, they would cluster
    Result
    CHECK

    Verify since .

    More practice questions in this unit