(追è¨)Scalaã§ã®å®è£ ã abstract class Node case class Leaf() extends Node case class R(left: Node, key: int, right: Node) extends Node case class B(left: Node, key: int, right: Node) extends Node def balance(left: Node, key: int, right: Node) = { (left, key, right) match { case (R(a, x, b), y, R(c, z, d)) => new R(new B(a, x, b), y, new B(c, z, d)) case (R(R(a, x, b), y, c), z, d) => new R(new B(a, x, b),
{{#tags}}- {{label}}
{{/tags}}