Skip to main content

Posts

Problem Name: Binary Search Tree Problem Link:  https://www.urionlinejudge.com.br/judge/en/problems/view/1195 Solution in Java8: import java.util.Scanner; public class Main {     public static void main(String[] args) {         Scanner sc = new Scanner(System.in) ;         int t = sc.nextInt() ;         for(int i = 1 ; i <= t ; i ++ ) {             int n = sc.nextInt() ;             int root = sc.nextInt() ;             node tree = new node(root) ;             // inserting in tree             for(int j = 2 ; j <= n ; j ++ ) {                 int temp = sc.nextInt() ;                 tree.insert(temp);             }     ...