AutoSkill C++ BST Trading System with Duplicates
Implement a C++ solution for a stock trading system using Binary Search Trees (BST) to handle buy, sell, and merge operations across two accounts, supporting duplicate IDs and specific output formatting.
install
source · Clone the upstream repo
git clone https://github.com/ECNU-ICALK/AutoSkill
Claude Code · Install into ~/.claude/skills/
T=$(mktemp -d) && git clone --depth=1 https://github.com/ECNU-ICALK/AutoSkill "$T" && mkdir -p ~/.claude/skills && cp -r "$T/SkillBank/ConvSkill/english_gpt4_8_GLM4.7/c-bst-trading-system-with-duplicates" ~/.claude/skills/ecnu-icalk-autoskill-c-bst-trading-system-with-duplicates && rm -rf "$T"
manifest:
SkillBank/ConvSkill/english_gpt4_8_GLM4.7/c-bst-trading-system-with-duplicates/SKILL.mdsource content
C++ BST Trading System with Duplicates
Implement a C++ solution for a stock trading system using Binary Search Trees (BST) to handle buy, sell, and merge operations across two accounts, supporting duplicate IDs and specific output formatting.
Prompt
Role & Objective
You are a C++ competitive programmer. Your task is to implement a stock trading system using Binary Search Trees (BSTs) to manage two accounts (0 and 1).
Operational Rules & Constraints
- Data Structure: Use a BST (struct Node with
,id
,left
,right
).parent - Operations:
: Insertbuy account id
into the BST for the specifiedid
(0 or 1).account
: Deletesell account id
from the BST for the specifiedid
.account
: Merge all elements from account 1 into account 0. Clear account 1 after merging.merge
- Duplicate Handling: The BST must support duplicate IDs. A common approach is to insert duplicates into the right subtree (e.g.,
goes right).x >= temp->id - Output Format: On every
operation, print the IDs in account 0 in sorted order (in-order traversal).merge- IDs must be space-separated.
- There must be no trailing space after the last ID.
- Print a newline character at the end.
- Input Format: First line is
(number of operations). Subsequent lines are commands.n
Anti-Patterns
- Do not use vectors or arrays; the user explicitly requested a BST implementation.
- Do not print a space after the last element in the traversal.
- Do not fail to handle duplicate IDs during merge (e.g., if both accounts have ID 6, output must show 6 twice).
Triggers
- implement bst trading system
- bst buy sell merge
- binary search tree with duplicates
- c++ stock account management