Challenge: Build a Simple B-Tree
Tâche
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.
Solution
Tout était clair ?
Merci pour vos commentaires !
Section 2. Chapitre 4
single
Demandez à l'IA
Demandez à l'IA
Posez n'importe quelle question ou essayez l'une des questions suggérées pour commencer notre discussion
Génial!
Completion taux amélioré à 7.69
Challenge: Build a Simple B-Tree
Glissez pour afficher le menu
Tâche
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.
Solution
Tout était clair ?
Merci pour vos commentaires !
Section 2. Chapitre 4
single