You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 

729 B

btreemax

Instructions

Écrire une fonction, BTreeMax, qui retourne la node avec la valeur maximum de l'arbre donné par root.

Fonction attendue

func BTreeMax(root *TreeNode) *TreeNode {

}

Utilisation

Voici un éventuel programme pour tester votre fonction :

package main

import (
	"fmt"

	piscine ".."
)

func main() {
	root := &piscine.TreeNode{Data: "4"}
	piscine.BTreeInsertData(root, "1")
	piscine.BTreeInsertData(root, "7")
	piscine.BTreeInsertData(root, "5")
	max := piscine.BTreeMax(root)
	fmt.Println(max.Data)
}

Et son résultat :

student@ubuntu:~/student/test$ go build
student@ubuntu:~/student/test$ ./test
7
student@ubuntu:~/student/test$