medium
Implement a Binary Search Tree
Create a Binary Search Tree (BST) data structure with basic operations including insertion, search, and traversal.
Implement a Binary Search Tree (BST) in your preferred programming language. Your implementation should include the following methods:
1. `insert(value)`: Insert a new value into the BST.
2. `search(value)`: Return true if the value exists in the BST, false otherwise.
3. `inOrderTraversal()`: Return an array with all values in the BST in ascending order.
4. `preOrderTraversal()`: Return an array with all values in the BST following pre-order traversal.
5. `postOrderTraversal()`: Return an array with all values in the BST following post-order traversal.
6. `delete(value)`: Remove a value from the BST if it exists.
Your implementation should handle edge cases such as duplicate values, empty tree operations, and deletion of nodes with 0, 1, or 2 children.
Consider the time and space complexity of your operations and provide comments explaining your approach.
Expert
Scalable Microservices Architecture Design
Designs a high-level system architecture for a high-concurrency application with specific constraints.
Design a high-level system architecture for a scalable real-time collaborative document editing platform handling 10 million concurrent users. Specify the database choices, conflict resolution strategies (CRDTs vs OT), load balancing techniques, and message queue protocols. Discuss the trade-offs between consistency and availability (CAP theorem) in your design.
Intermédiaire
OpenAPI Specification
Generate an OpenAPI 3.0 spec documentation for a hypothetical API.
Design an OpenAPI 3.0 specification (in YAML format within a code block) for a RESTful API that manages a 'Task Management' system. Include endpoints for creating, reading, updating, and deleting tasks. Define the schema for the 'Task' object, including parameters like ID, title, status, and due date. Implement authentication requirements using Bearer tokens.
Intermédiaire
Generate API Documentation
Create documentation for an API endpoint based on its specification.
Generate documentation for a REST API endpoint POST /users that accepts a JSON payload with 'name', 'email', and 'password'. Include the request body schema, success response (201), and error responses (400, 500).
Intermédiaire
Regex Generator
Generate a Regular Expression based on a specific text pattern description.
Write a Regular Expression that matches '[Insert Description of Pattern, e.g., email addresses or dates in DD/MM/YYYY format]'. Provide the regex pattern and a brief explanation of how each part of the expression works.