Lesson 1Choosing collision strategy fi static contexts: open addressing vs static separate chaining wid arraysCompares open addressing an static separate chaining fi fixed-memory systems, analyzing cache behavior, fragmentation, implementation complexity, an guidelines fi choosing a collision strategy in embedded C projects.
Review of open addressing propertiesReview of static separate chainingMemory layout an cache friendlinessComplexity an implementation effortGuidelines fi strategy selectionLesson 2Memory an time complexity: documenting worst an expected probes, table load factor recommendations fi embeddedAnalyzes memory an time complexity of static hash tables, documenting worst-case an expected probe counts, load factor limits, an practical sizing recommendations tailored fi embedded sensor applications.
Worst-case probe length analysisExpected probes under random hashingImpact of load factor pon performanceMemory footprint an table sizingEmbedded-specific tuning guidelinesLesson 3Safe pointer handling: using indices instead of pointers, bounds checks, an avoiding NULL dereferencesCovers safe pointer handling in static hash tables by using indices instead of raw pointers, enforcing bounds checks, an designing APIs dat prevent NULL dereferences an dangling references in C code.
Indices vs pointers in static tablesImplementing robust bounds checkingAvoiding NULL an dangling referencesConverting indices fi pointers safelyAPI patterns dat enforce safetyLesson 4Open addressing techniques: linear probing, quadratic probing, tombstones, an deletion semantics without dynamic memoryDetails open addressing in static tables, including linear an quadratic probing, tombstone markers, an deletion rules dat avoid dynamic allocation while preserving probe chains an predictable performance in C implementations.
Linear probing: algorithm an trade-offsQuadratic probing: clustering behaviorDesigning an using tombstone markersDeletion semantics an probe chain repairDetecting full table an failure modesLesson 5Integration wid circular buffer: keeping most recent reading an policies fi consistency (write-order, timestamps)Explores how a static hash table cooperates wid a circular buffer fi keep di latest sensor readings, define write ordering, use timestamps fi freshness, an maintain consistency when updates or concurrent-like accesses occur.
Mapping sensor IDs fi circular buffer slotsStoring only most recent reading per sensorTimestamp fields an monotonic orderingHandling overwrite an wrap-around casesConsistency rules fi concurrent-style accessLesson 6init_table: setting empty markers, initializing free lists or tombstonesExplains init_table responsibilities, such as setting empty markers, initializing free lists or tombstones, clearing metadata, an ensuring di table starts in a consistent, verifiable state before first use.
Choosing an setting empty markersInitializing tombstone an state flagsBuilding initial free-list structuresZeroing or sanitizing table memoryValidation checks after initializationLesson 7insert_or_update_reading: insert, update, handling full table, an return codesDescribes di insert_or_update_reading API, including insertion, in-place update, handling a full table, return codes, an how fi integrate collision handling while keeping di interface simple an robust in C.
Function prototype an parameter choicesInsert path fi new sensor IDsUpdate path fi existing sensor IDsHandling full table an error returnsDesigning clear status an error codesLesson 8Designing di bucket array: table size selection, prime sizing, an compile-time constantsDescribes how fi design di bucket array, including choosing table size, prime or power-of-two sizing, compile-time constants, an trade-offs between memory usage, speed, an hash function simplicity.
Prime vs power-of-two table sizesRelating table size fi key capacityUsing compile-time constants in CBalancing memory an performancePlanning fi future size adjustmentsLesson 9Static chaining wid arrays: node pool design, next indexes, an free-list management in static memoryCovers static separate chaining using arrays, including node pool layout, next index links, free-list management, an how fi implement insertion, deletion, an traversal without heap allocation in constrained environments.
Designing di node pool array layoutUsing next indexes instead of pointersManaging a free-list in static memoryInsertion an deletion in static chainsDetecting pool exhaustion an errorsLesson 10Key an value representations: using uint8_t sensor id an SensorReading copy semanticsExplains how fi represent keys an values using uint8_t sensor IDs an SensorReading structs, focusing pon copy semantics, alignment, padding, an avoiding aliasing or lifetime issues in a static hash table.
Choosing uint8_t fi sensor ID keysDesigning di SensorReading structCopy semantics vs pointer semanticsAlignment, padding, an struct layoutValidating an normalizing sensor IDsLesson 11Hash function choices fi small keyspace: identity, multiplicative, an masking fi 0–255 idsDiscusses hash functions fi small uint8_t keyspaces, including identity mapping, multiplicative hashing, masking, an how fi balance simplicity, distribution quality, an computational cost fi 0–255 sensor IDs.
Identity hash fi dense ID rangesMultiplicative hashing fi uint8_t keysBit masking an table index derivationAvoiding systematic clustering patternsTesting distribution wid sample dataLesson 12find_reading_by_id: probe sequences, not-found vs found responses, an safe copy-out patternsFocuses pon find_reading_by_id, including probe sequences, distinguishing found from not-found, safe copying of SensorReading out of di table, an avoiding undefined behavior or stale data exposure in C.
Function signature an return patternsImplementing probe sequences fi lookupHandling not-found vs found resultsSafe copy-out of SensorReading valuesAvoiding stale or partially written data