Skip to content

Instantly share code, notes, and snippets.

View giovannicandido's full-sized avatar

Giovanni Silva giovannicandido

View GitHub Profile
@giovannicandido
giovannicandido / BuscaRecusiva.scala
Created February 25, 2015 17:10
Busca recusiva em grafo binario
object Main extends App {
case class Vertice(valor: Int, esquerda: Option[Vertice], direita: Option[Vertice]) {
override def toString = valor.toString
}
val v1 = Vertice(10,None,None)
val v3 = Vertice(30,None,None)
val v2 = Vertice(5,Some(v3),None)
val root = Vertice(3,Some(v1), Some(v2))
def imprimeGrafo(vertice: Vertice): Unit = {