class Hamster::SortedSet::PlainAVLNode

def self.from_items(items, from = 0, to = items.size-1) # items must be sorted

items must be sorted
def self.from_items(items, from = 0, to = items.size-1) # items must be sorted
  size = to - from + 1
  if size >= 3
    middle = (to + from) / 2
    PlainAVLNode.new(items[middle], PlainAVLNode.from_items(items, from, middle-1), PlainAVLNode.from_items(items, middle+1, to))
  elsif size == 2
    PlainAVLNode.new(items[from], PlainAVLNode::EmptyNode, PlainAVLNode.new(items[from+1], PlainAVLNode::EmptyNode, PlainAVLNode::EmptyNode))
  elsif size == 1
    PlainAVLNode.new(items[from], PlainAVLNode::EmptyNode, PlainAVLNode::EmptyNode)
  elsif size == 0
    PlainAVLNode::EmptyNode
  end
end