PracHub
QuestionsPremiumLearningGuidesCheatsheetNEWCoaches
|Home/Coding & Algorithms/Airtable

Implement BFS serializer and deserializer

Last updated: Mar 29, 2026

Quick Overview

This question evaluates the skill of serializing and deserializing Python object graphs using BFS, including handling primitives, dictionaries, shared subobjects, and circular references while preserving object identity.

  • Medium
  • Airtable
  • Coding & Algorithms
  • Software Engineer

Implement BFS serializer and deserializer

Company: Airtable

Role: Software Engineer

Category: Coding & Algorithms

Difficulty: Medium

Interview Round: Onsite

Implement two functions, serialize(obj) -> representation and deserialize(representation) -> obj, for a Python object graph containing str, int, and dict, including possible circular references. Use a BFS traversal to produce a structure of the form: { 'root_id': <id_str>, 'value_map': { <id_str>: <value_or_mapping>, ... } }, where each visited object gets a unique string identifier (e.g., str(id(obj))). For dictionaries, store a mapping of field names to child identifiers; for primitives (str, int), store the raw value under their identifiers. Ensure shared subobjects reuse the same identifier and that cycles are preserved without duplication. Deserialization should reconstruct the original graph from value_map by allocating nodes, wiring references by identifiers, and returning the object at root_id. Discuss correctness, determinism of traversal/ID assignment, and the time/space complexity.

Quick Answer: This question evaluates the skill of serializing and deserializing Python object graphs using BFS, including handling primitives, dictionaries, shared subobjects, and circular references while preserving object identity.

Related Interview Questions

  • Implement undo/redo with two stacks - Airtable (medium)
  • Count business days excluding holidays - Airtable (medium)
  • Implement spreadsheet undo/redo operations - Airtable (medium)
Airtable logo
Airtable
Sep 6, 2025, 12:00 AM
Software Engineer
Onsite
Coding & Algorithms
21
0

Implement two functions, serialize(obj) -> representation and deserialize(representation) -> obj, for a Python object graph containing str, int, and dict, including possible circular references. Use a BFS traversal to produce a structure of the form: { 'root_id': <id_str>, 'value_map': { <id_str>: <value_or_mapping>, ... } }, where each visited object gets a unique string identifier (e.g., str(id(obj))). For dictionaries, store a mapping of field names to child identifiers; for primitives (str, int), store the raw value under their identifiers. Ensure shared subobjects reuse the same identifier and that cycles are preserved without duplication. Deserialization should reconstruct the original graph from value_map by allocating nodes, wiring references by identifiers, and returning the object at root_id. Discuss correctness, determinism of traversal/ID assignment, and the time/space complexity.

Comments (0)

Sign in to leave a comment

Loading comments...

Browse More Questions

More Coding & Algorithms•More Airtable•More Software Engineer•Airtable Software Engineer•Airtable Coding & Algorithms•Software Engineer Coding & Algorithms
PracHub

Master your tech interviews with 7,500+ real questions from top companies.

Product

  • Questions
  • Learning Tracks
  • Interview Guides
  • Resources
  • Premium
  • For Universities
  • Student Access

Browse

  • By Company
  • By Role
  • By Category
  • Topic Hubs
  • SQL Questions
  • Compare Platforms
  • Discord Community

Support

  • support@prachub.com
  • (916) 541-4762

Legal

  • Privacy Policy
  • Terms of Service
  • About Us

© 2026 PracHub. All rights reserved.