Run Code
|
API
|
Code Wall
|
Users
|
Misc
|
Feedback
|
Login
|
Theme
|
Privacy
|
Patreon
max & min binary search tree
//Rextester.Program.Main is the entry point for your code. Don't change it. //Compiler version 4.0.30319.17929 for Microsoft (R) .NET Framework 4.5 using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; namespace CodingAlgorithms { partial class BinarySearchTree { public int GetMin(NodeBT root) { NodeBT cur = root; while (cur.Left != null) cur = cur.Left; return cur.Data; } //Returns the data in the farthest right node public int GetMax(NodeBT root) { NodeBT cur = root; while (cur.Right != null) cur = cur.Right; return cur.Data; } ////Run in Program.cs to test //BinarySearchTree bst = new BinarySearchTree(); //bst.Add(5); //bst.Add(10); //bst.Add(15); //bst.Add(-7); //bst.Add(2); //bst.Add(26); //bst.Add(98); //Console.WriteLine(bst.GetMin(bst.Root)); //Console.WriteLine(bst.GetMax(bst.Root)); } }
run
|
edit
|
history
|
help
0
Please
log in
to post a comment.
singly linked list traversal
learning1
30272 Program Ex7_2 switch
Something
Linear search
Main3
Square Integer Matrix
Hash autoryzujący
/Users/svetlanakanevskaa/Downloads/ACDB.sql
Programa_01_01_Declaracion_de_clases
Please log in to post a comment.