Insert into a 2-3 tree with one single node
سؤال
So, I'm trying to build a function for my 2-3 tree class, and this is the pseudocode that I've been following:
if T is empty replace it with a single node containing k
else if T is just 1 node m:
(a) create a new leaf node n containing k
(b) create a new internal node with m and n as its children,
and with the appropriate values for leftMax and middleMax
else call auxiliary method insert(T, k)
However, I don't understand what it does for the case when T is just 1 single node (or one leaf). What is n ? is it a misprint ? If m is already a root since T is just one node m, then how can it can be create as a new internal node as (b) instructs ? Any help would be greatly appreciated.
Any drawing would be much easier to understand the concept and I would really appreciate for that. Thank you
لا يوجد حل صحيح
لا تنتمي إلى StackOverflow