Challenge: Build a Simple B-Tree
Opgave
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øsning
Var alt klart?
Tak for dine kommentarer!
Sektion 2. Kapitel 4
single
Spørg AI
Spørg AI
Spørg om hvad som helst eller prøv et af de foreslåede spørgsmål for at starte vores chat
Fantastisk!
Completion rate forbedret til 7.69
Challenge: Build a Simple B-Tree
Stryg for at vise menuen
Opgave
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øsning
Var alt klart?
Tak for dine kommentarer!
Sektion 2. Kapitel 4
single