Skip to content
Discussion options

You must be logged in to vote

We need to design a task management system that efficiently handles adding, editing, removing, and executing tasks based on their priority. The key challenge is to ensure that the system can quickly access the task with the highest priority (and highest task ID in case of ties) while supporting updates and removals without incurring high computational costs.

Approach

  1. Data Structures:

    • Task Information Storage: We use an associative array $taskInfo to store task details (user ID, priority, and generation number) keyed by task ID.
    • Generation Tracking: We maintain an associative array $generations to track the current generation number for each task ID. This helps in invalidating outdated …

Replies: 1 comment 2 replies

Comment options

You must be logged in to vote
2 replies
@basharul-siddike
Comment options

@mah-shamim
Comment options

mah-shamim Sep 18, 2025
Maintainer Author

Answer selected by basharul-siddike
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
question Further information is requested medium Difficulty
2 participants