1. Implement Functions Registration and Matching
Implement two functions for a system that registers and finds matching functions based on their arguments. The first function, 'register', should accept a list of 'Function' objects, each with a 'name' and a list of 'args'. The second function, 'findMatch', should return all functions that match a given list of arguments. For example, if 'Function* A' is registered with 'Integer' as its argument, calling 'findMatch' with 'Integer' should return 'A'. If 'Function* B' and 'Function* C' are registered with 'Integer' and 'Boolean', calling 'findMatch' with 'Integer' and 'Boolean' should return 'B' and 'C'. Additionally, implement support for variadic functions indicated by a 'bool isCard' property. If 'Function* A' is variadic, calling 'findMatch' with any number of 'Integer' arguments should return 'A'.
2. Implement a Delay Scheduler Using Heap and Timer-Lock
Implement a DelayScheduler that schedules tasks to be executed after a certain delay. Use a heap data structure to manage the tasks and a timer-lock mechanism to handle the execution timing.
3. Design a Sharded TinyURL Service with DNS Considerations
Design a TinyURL service where each long URL can only be mapped to one short URL. Discuss how you would implement sharding and consider DNS in your design.
4. Implement Data Structures to Get, Put, and Retrieve Averages in O(1)
Implement data structures that support the following operations: 'get', 'put', and 'getAverage'. The 'get' operation retrieves the value associated with a key, 'put' inserts or updates the value for a key, and 'getAverage' calculates the average of all values. All operations should be performed in O(1) time complexity.
5. Design a KV store with WAL, Snapshot, and Recovery
Design a key-value store system on a single machine. Explain how you would implement write-ahead logging (WAL), snapshotting, and recovery mechanisms.