二叉树

收录了 2 篇文章 · 0 人关注

  • 算法最短路径-Dijkstra(Golang)

    //假设有9个节点,图在代码下方,可以参考 shortTablePath存放着V0到Vx某节点的最短路径 该算法,第一次先将V0的节点连接的权值存入shortTablePath,没连接的,用MAXWEIGHT表示.package main import ( "fmt" ) const MAXVEX int = 9 const MAXWEIGHT int = 1000 var shortTablePath = [MAXVEX]int{MAXWEIGHT, MAXWEIGHT, MAXWEIGHT,...

  • golang实现树遍历

    package main import ( "container/list" "fmt" "strings" ) type MyStack struct { List *list.List } type MyQueue struct { List *list.List } type BinaryTree struct { Value interface{} Left *BinaryTree Right *BinaryTree } type Tree struct { Value interfac...