Challenge: Build a Simple B-Tree
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.
Soluzione
Grazie per i tuoi commenti!
single
Chieda ad AI
Chieda ad AI
Chieda pure quello che desidera o provi una delle domande suggerite per iniziare la nostra conversazione
Can you explain this in simpler terms?
What are the main points I should remember?
Can you give me an example?
Fantastico!
Completion tasso migliorato a 7.69
Challenge: Build a Simple B-Tree
Scorri per mostrare il menu
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.
Soluzione
Grazie per i tuoi commenti!
single