Data Structure Selector Skill
Purpose
Select the optimal data structure based on required operations, their frequencies, and time/space constraints.
Capabilities
- Analyze required operations (insert, delete, query, update)
- Match to optimal data structure
- Consider time/space trade-offs
- Suggest augmentations for custom requirements
- Compare alternatives with complexity analysis
Target Processes
- data-structure-implementation
- algorithm-implementation
- complexity-optimization
Selection Framework
Operation Analysis
- What operations are needed?
- What are the frequency/priority of each operation?
- What are the constraints (N, Q, time limit)?
- Is persistence needed?
- Are range operations required?
Common Selection Patterns
| Operations |
Best Choice |
| Insert, Delete, Search |
BST / Hash Map |
| Range sum, Point update |
Fenwick Tree |
| Range query, Range update |
Segment Tree + Lazy |
| Union, Find |
DSU |
| Min/Max with add/remove |
Multiset / Heap |
| Predecessor/Successor |
Ordered Set / BST |
Input Schema
{
"type": "object",
"properties": {
"operations": {
"type": "array",
"items": {
"type": "object",
"properties": {
"name": { "type": "string" },
"frequency": { "type": "string" },
"constraints": { "type": "string" }
}
}
},
"constraints": { "type": "object" },
"preferences": { "type": "array" }
},
"required": ["operations"]
}
Output Schema
{
"type": "object",
"properties": {
"success": { "type": "boolean" },
"recommended": { "type": "string" },
"complexities": { "type": "object" },
"alternatives": { "type": "array" },
"augmentations": { "type": "array" },
"reasoning": { "type": "string" }
},
"required": ["success", "recommended"]
}
1---2name: data-structure-selector3description: Select optimal data structure based on operation requirements4---5
6# Data Structure Selector Skill
7
8## Purpose
9
10Select the optimal data structure based on required operations, their frequencies, and time/space constraints.
11
12## Capabilities
13
14- Analyze required operations (insert, delete, query, update)
15- Match to optimal data structure
16- Consider time/space trade-offs
17- Suggest augmentations for custom requirements
18- Compare alternatives with complexity analysis
19
20## Target Processes
21
22- data-structure-implementation
23- algorithm-implementation
24- complexity-optimization
25
26## Selection Framework
27
28### Operation Analysis
291. What operations are needed?
302. What are the frequency/priority of each operation?
313. What are the constraints (N, Q, time limit)?
324. Is persistence needed?
335. Are range operations required?
34
35### Common Selection Patterns
36
37| Operations | Best Choice |
38|------------|-------------|
39| Insert, Delete, Search | BST / Hash Map |
40| Range sum, Point update | Fenwick Tree |
41| Range query, Range update | Segment Tree + Lazy |
42| Union, Find | DSU |
43| Min/Max with add/remove | Multiset / Heap |
44| Predecessor/Successor | Ordered Set / BST |
45
46## Input Schema
47
48```json
49{
50 "type": "object",
51 "properties": {
52 "operations": {
53 "type": "array",
54 "items": {
55 "type": "object",
56 "properties": {
57 "name": { "type": "string" },
58 "frequency": { "type": "string" },
59 "constraints": { "type": "string" }
60 }
61 }
62 },
63 "constraints": { "type": "object" },
64 "preferences": { "type": "array" }
65 },
66 "required": ["operations"]
67}
68```
69
70## Output Schema
71
72```json
73{
74 "type": "object",
75 "properties": {
76 "success": { "type": "boolean" },
77 "recommended": { "type": "string" },
78 "complexities": { "type": "object" },
79 "alternatives": { "type": "array" },
80 "augmentations": { "type": "array" },
81 "reasoning": { "type": "string" }
82 },
83 "required": ["success", "recommended"]
84}
85```