Run Code
|
API
|
Code Wall
|
Misc
|
Feedback
|
Login
|
Theme
|
Privacy
|
Patreon
max & min binary search tree
Language:
Ada
Assembly
Bash
C#
C++ (gcc)
C++ (clang)
C++ (vc++)
C (gcc)
C (clang)
C (vc)
Client Side
Clojure
Common Lisp
D
Elixir
Erlang
F#
Fortran
Go
Haskell
Java
Javascript
Kotlin
Lua
MySql
Node.js
Ocaml
Octave
Objective-C
Oracle
Pascal
Perl
Php
PostgreSQL
Prolog
Python
Python 3
R
Rust
Ruby
Scala
Scheme
Sql Server
Swift
Tcl
Visual Basic
Layout:
Vertical
Horizontal
//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)); } }
Show compiler warnings
[
+
]
Show input
absolute service time: 0,12 sec
edit mode
|
history
|
discussion