Search structures
0-day streakReview

Your progress

Level 1

0 XP100 XP to level 2
0day streak
0best streak
0topics started
0cards reviewed
    Review cards

    Progress is stored only in this browser. No account is required.

    Layer 3 · Go deeper · 8 min

    Go deeper

    Size it, build it, then make the calls an interviewer will push you on.

    Back of the envelope

    Size it up

    Tap through each step of the arithmetic.

    How big is one common term’s postings list?

      Does a keyword-stuffed listing outrank an honest kurta title?

        How much memory does one cached filter take?

          Build-up · 5 steps

          Build the index from four Bazaar titles

          Analyse four product titles, flip them into postings lists, then answer an AND and a phrase query. Every list stays sorted by doc ID.

          Step 1 of 5

          Four titles, four doc IDs

          D1 to D4 are small, dense integers in insertion order, not product IDs. That density makes gap encoding and bitsets work; 32-bit IDs cap one shard at about 2.1 billion documents.

          4 interview moments

          You’re the candidate

          The interviewer pushes on the hard parts. Pick an approach and see how it holds up.

          1. Deep dive 1 of 4

            Interviewer

            “Bazaar wants the 5–10 most popular completions of a prefix on every keystroke, within a few milliseconds. What do you build?”

            Your move. Pick an approach:

          2. Deep dive 2 of 4

            Interviewer

            “Typo tolerance is on, but fuzzy queries crawl as the term dictionary grows. How should the engine find terms near kurtha?”

            Your move. Pick an approach:

          3. Deep dive 3 of 4

            Interviewer

            “Shoppers filter kurtas by price, 300 to 500 rupees, across 50 million products. How do you index price?”

            Your move. Pick an approach:

          4. Deep dive 4 of 4

            Interviewer

            “Bazaar sorts matching kurtas by price and counts sizes for the sidebar. Where should those values come from?”

            Your move. Pick an approach: