Challenge: Build a Simple B-Tree
Aufgabe
Swipe to start coding
In this challenge, you will implement a simplified B-Tree — a balanced search tree widely used in databases and file systems.
Your task is to complete the implementation so that the tree supports:
insert(key):
- Inserts a new key into the B-Tree.
- Splits nodes when they overflow to maintain B-Tree properties.
- The root must split correctly when full.
- Insertion must always place keys in sorted order.
search(key):
- Returns
Trueif the key is present in the B-Tree. - Returns
Falseif the key is not found.
Additional Rules:
- The minimum degree
tdetermines the minimum/maximum number of keys in each node. - You do not need to implement deletion or disk storage.
- The tree must correctly handle multiple insertions and node splits.
Lösung
War alles klar?
Danke für Ihr Feedback!
Abschnitt 2. Kapitel 4
single
Fragen Sie AI
Fragen Sie AI
Fragen Sie alles oder probieren Sie eine der vorgeschlagenen Fragen, um unser Gespräch zu beginnen
Großartig!
Completion Rate verbessert auf 7.69
Challenge: Build a Simple B-Tree
Swipe um das Menü anzuzeigen
Aufgabe
Swipe to start coding
In this challenge, you will implement a simplified B-Tree — a balanced search tree widely used in databases and file systems.
Your task is to complete the implementation so that the tree supports:
insert(key):
- Inserts a new key into the B-Tree.
- Splits nodes when they overflow to maintain B-Tree properties.
- The root must split correctly when full.
- Insertion must always place keys in sorted order.
search(key):
- Returns
Trueif the key is present in the B-Tree. - Returns
Falseif the key is not found.
Additional Rules:
- The minimum degree
tdetermines the minimum/maximum number of keys in each node. - You do not need to implement deletion or disk storage.
- The tree must correctly handle multiple insertions and node splits.
Lösung
War alles klar?
Danke für Ihr Feedback!
Abschnitt 2. Kapitel 4
single