codeparrot/xlcost-text-to-code huggingface dataset:
Sum of range in a series of first odd then even natural numbers | Java program to find sum in the given range in the sequence 1 3 5 7. ... . N 2 4 6. . . N - 1 ; Function that returns sum in the range 1 to x in the sequence 1 3 5 7. ... . N 2 4 6. . . N - 1 ; number of odd numbers ; number of extra even numbers required ; Driver Code
class GFG { static double sumTillX ( double x , double n ) { double odd = Math . ceil ( n / 2.0 ) ; if ( x <= odd ) return x * x ; double even = x - odd ; return ( ( odd * odd ) + ( even * even ) + even ) ; } static double rangeSum ( double N , double L , double R ) { return sumTillX ( R , N ) - sumTillX ( L - 1 , N ) ; } public static void main ( String args [ ] ) { long N = 10 , L = 1 , R = 6 ; int n = 101 ; System . out . println ( ( int ) rangeSum ( N , L , R ) ) ; } }
Twin Prime Numbers between 1 and n | Java program to print all Twin Prime Numbers using Sieve of Eratosthenes ; Create a boolean array " prime [ 0 . . n ] " and initialize all entries it as true . A value in prime [ i ] will finally be false if i is Not a prime , else true . ; If prime [ p ] is not changed , then it is a prime ; Update all multiples of p ; to check for twin prime numbers display th twin prime ; Driver Program to test above function ; Calling the function
import java . io . * ; class GFG { static void printTwinPrime ( int n ) { boolean prime [ ] = new boolean [ n + 1 ] ; for ( int i = 0 ; i <= n ; i ++ ) prime [ i ] = true ; for ( int p = 2 ; p * p <= n ; p ++ ) { if ( prime [ p ] == true ) { for ( int i = p * 2 ; i <= n ; i += p ) prime [ i ] = false ; } } for ( int i = 2 ; i <= n - 2 ; i ++ ) { if ( prime [ i ] == true && prime [ i + 2 ] == true ) System . out . print ( " ▁ ( " + i + " , ▁ " + ( i + 2 ) + " ) " ) ; } } public static void main ( String args [ ] ) { int n = 25 ; printTwinPrime ( n ) ; } }
Cube Free Numbers smaller than n | Java Program to print all cube free numbers smaller than or equal to n . ; Returns true if n is a cube free number , else returns false . ; check for all possible divisible cubes ; Print all cube free numbers smaller than n . ; Driver program
class GFG { public static boolean isCubeFree ( int n ) { if ( n == 1 ) return false ; for ( int i = 2 ; i * i * i <= n ; i ++ ) if ( n % ( i * i * i ) == 0 ) return false ; return true ; } public static void printCubeFree ( int n ) { for ( int i = 2 ; i <= n ; i ++ ) { if ( isCubeFree ( i ) ) { System . out . print ( i + " ▁ " ) ; } } } public static void main ( String [ ] args ) { int n = 20 ; printCubeFree ( n ) ; } }
Decimal Equivalent of Gray Code and its Inverse | Java Program to convert given decimal number of gray code into its inverse in decimal form ; Function to convert given decimal number of gray code into its inverse in decimal form ; Taking xor until n becomes zero ; Driver code
import java . io . * ; class GFG { static int inversegrayCode ( int n ) { int inv = 0 ; for ( ; n != 0 ; n = n >> 1 ) inv ^= n ; return inv ; } public static void main ( String [ ] args ) { int n = 15 ; System . out . println ( inversegrayCode ( n ) ) ; } }
Product of unique prime factors of a number | Java program to find product of unique prime factors of a number . ; A function to print all prime factors of a given number n ; Handle prime factor 2 explicitly so that can optimally handle other prime factors . ; n must be odd at this point . So we can skip one element ( Note i = i + 2 ) ; While i divides n , print i and divide n ; This condition is to handle the case when n is a prime number greater than 2 ; Driver Code
import java . util . * ; import java . lang . * ; class GFG { public static long productPrimeFactors ( int n ) { long product = 1 ; if ( n % 2 == 0 ) { product *= 2 ; while ( n % 2 == 0 ) n = n / 2 ; } for ( int i = 3 ; i <= Math . sqrt ( n ) ; i = i + 2 ) { if ( n % i == 0 ) { product = product * i ; while ( n % i == 0 ) n = n / i ; } } if ( n > 2 ) product = product * n ; return product ; } public static void main ( String [ ] args ) { int n = 44 ; System . out . print ( productPrimeFactors ( n ) ) ; } }
Maximizing Probability of one type from N containers | Java program to find maximum probability of getting a copy ' A ' from N ; Returns the Maximum probability for Drawing 1 copy of number A from N containers with N copies each of numbers A and B ; Pmax = N / ( N + 1 ) ; Driver code ; 1. N = 1 ; 2. N = 2 ; 3. N = 10
class GFG { static double calculateProbability ( int N ) { double probability = ( double ) N / ( N + 1 ) ; return probability ; } public static void main ( String [ ] args ) { int N ; double probabilityMax ; N = 1 ; probabilityMax = calculateProbability ( N ) ; System . out . println ( " Maximum ▁ Probability ▁ for " + " ▁ N ▁ = ▁ " + N + " ▁ is , ▁ " + Math . round ( probabilityMax * 10000.0 ) / 10000.0 ) ; N = 2 ; probabilityMax = calculateProbability ( N ) ; System . out . println ( " Maximum ▁ Probability ▁ for ▁ N ▁ = ▁ " + N + " ▁ is , ▁ " + Math . round ( probabilityMax * 10000.0 ) / 10000.0 ) ; N = 10 ; probabilityMax = calculateProbability ( N ) ; System . out . println ( " Maximum ▁ Probability ▁ for ▁ N ▁ = ▁ " + N + " ▁ is , ▁ " + Math . round ( probabilityMax * 10000.0 ) / 10000.0 ) ; } }
Program to implement standard deviation of grouped data | Java program to implement standard deviation of grouped data . ; Function to find mean of grouped data . ; Function to find standard deviation of grouped data . ; Formula to find standard deviation deviation of grouped data . ; Driver function . ; Declare and initialize the lower limit of interval . ; Declare and initialize the upper limit of interval . ; Calculating the size of array .
import java . io . * ; class GFG { static float mean ( float mid [ ] , int freq [ ] , int n ) { float sum = 0 , freqSum = 0 ; for ( int i = 0 ; i < n ; i ++ ) { sum = sum + mid [ i ] * freq [ i ] ; freqSum = freqSum + freq [ i ] ; } return sum / freqSum ; } static float groupedSD ( float lower_limit [ ] , float upper_limit [ ] , int freq [ ] , int n ) { float mid [ ] = new float [ n ] ; float sum = 0 , freqSum = 0 , sd ; for ( int i = 0 ; i < n ; i ++ ) { mid [ i ] = ( lower_limit [ i ] + upper_limit [ i ] ) / 2 ; sum = sum + freq [ i ] * mid [ i ] * mid [ i ] ; freqSum = freqSum + freq [ i ] ; } sd = ( float ) Math . sqrt ( ( sum - freqSum * mean ( mid , freq , n ) * mean ( mid , freq , n ) ) / ( freqSum - 1 ) ) ; return sd ; } public static void main ( String [ ] args ) { float lower_limit [ ] = { 50 , 61 , 71 , 86 , 96 } ; float upper_limit [ ] = { 60 , 70 , 85 , 95 , 100 } ; int freq [ ] = { 9 , 7 , 9 , 12 , 8 } ; int n = lower_limit . length ; System . out . println ( groupedSD ( lower_limit , upper_limit , freq , n ) ) ; } }
Average of first n even natural numbers | java implementation to find Average of sum of first n natural even number ; function to find average of sum of first n even numbers ; sum of first n even numbers ; calculating Average ; driver code
import java . io . * ; class GFG { static int avg_of_even_num ( int n ) { int sum = 0 ; for ( int i = 1 ; i <= n ; i ++ ) sum += 2 * i ; return ( sum / n ) ; } public static void main ( String [ ] args ) { int n = 9 ; System . out . print ( avg_of_even_num ( n ) ) ; } }
Average of first n even natural numbers | Java Program to find the average of sum of first n even numbers ; Return the average of sum of first n even numbers ; driver code
import java . io . * ; class GFG { static int avg_of_even_num ( int n ) { return n + 1 ; } public static void main ( String [ ] args ) { int n = 8 ; System . out . println ( avg_of_even_num ( n ) ) ; } }
Program to find simple moving average | Java program to calculate Simple Moving Average ; queue used to store list so that we get the average ; constructor to initialize period ; function to add new data in the list and update the sum so that we get the new mean ; Updating size so that length of data set should be equal to period as a normal mean has ; function to calculate mean ; Driver code
import java . util . * ; public class SimpleMovingAverage { private final Queue < Double > Dataset = new LinkedList < Double > ( ) ; private final int period ; private double sum ; public SimpleMovingAverage ( int period ) { this . period = period ; } public void addData ( double num ) { sum += num ; Dataset . add ( num ) ; if ( Dataset . size ( ) > period ) { sum -= Dataset . remove ( ) ; } } public double getMean ( ) { return sum / period ; } public static void main ( String [ ] args ) { double [ ] input_data = { 1 , 3 , 5 , 6 , 8 , 12 , 18 , 21 , 22 , 25 } ; int per = 3 ; SimpleMovingAverage obj = new SimpleMovingAverage ( per ) ; for ( double x : input_data ) { obj . addData ( x ) ; System . out . println ( " New ▁ number ▁ added ▁ is ▁ " + x + " , ▁ SMA ▁ = ▁ " + obj . getMean ( ) ) ; } } }
Sum of square of first n odd numbers | Efficient Java method to find sum of square of first n odd numbers . ; driver code
import java . io . * ; class GFG { static int squareSum ( int n ) { return n * ( 4 * n * n - 1 ) / 3 ; } public static void main ( String args [ ] ) { System . out . println ( squareSum ( 8 ) ) ; } }
Check whether given three numbers are adjacent primes | Java program to check given three numbers are primes are not . ; Function checks whether given number is prime or not . ; check if n is a multiple of 2 ; if not , then just check the odds ; return next prime number ; start with next number . ; breaks after finding next prime number ; check given three numbers are adjacent primes are not . ; check given three numbers are primes are not . ; find next prime of a ; If next is not same as ' a ' ; If next next is not same as ' c ' ; Driver code for above functions
import java . io . * ; import java . util . * ; class GFG { public static boolean isPrime ( int n ) { if ( n % 2 == 0 ) return false ; for ( int i = 3 ; i * i <= n ; i += 2 ) if ( n % i == 0 ) return false ; return true ; } public static int nextPrime ( int start ) { int next = start + 1 ; while ( ! isPrime ( next ) ) next ++ ; return next ; } public static boolean areAdjacentPrimes ( int a , int b , int c ) { if ( ! isPrime ( a ) || ! isPrime ( b ) || ! isPrime ( c ) ) return false ; int next = nextPrime ( a ) ; if ( next != b ) return false ; if ( nextPrime ( b ) != c ) return false ; return true ; } public static void main ( String [ ] args ) { if ( areAdjacentPrimes ( 11 , 13 , 19 ) ) System . out . print ( " Yes " ) ; else System . out . print ( " No " ) ; } }
Check whether a number is semiprime or not | Java Program to check whether number is semiprime or not ; Utility function to check whether number is semiprime or not ; If number is greater than 1 , add it to the count variable as it indicates the number remain is prime number ; Return '1' if count is equal to '2' else return '0' ; Function to print ' True ' or ' False ' according to condition of semiprime ; Driver code
class GFG { static int checkSemiprime ( int num ) { int cnt = 0 ; for ( int i = 2 ; cnt < 2 && i * i <= num ; ++ i ) while ( num % i == 0 ) { num /= i ; ++ cnt ; } if ( num > 1 ) ++ cnt ; return cnt == 2 ? 1 : 0 ; } static void semiprime ( int n ) { if ( checkSemiprime ( n ) != 0 ) System . out . printf ( "TrueNEW_LINE"); else System . out . printf ( "FalseNEW_LINE"); } public static void main ( String [ ] args ) { int n = 6 ; semiprime ( n ) ; n = 8 ; semiprime ( n ) ; } }
Program to find sum of series 1 + 2 + 2 + 3 + 3 + 3 + . . . + n | Java Program to find sum of series 1 + 2 + 2 + 3 + . . . + n ; Function that find sum of series . ; Driver Code ; Function call
public class GfG { static int sumOfSeries ( int n ) { int sum = 0 ; for ( int i = 1 ; i <= n ; i ++ ) sum = sum + i * i ; return sum ; } public static void main ( String args [ ] ) { int n = 10 ; System . out . println ( sumOfSeries ( n ) ) ; } }
Program to find sum of series 1 + 2 + 2 + 3 + 3 + 3 + . . . + n | Java Program to find sum of series 1 + 2 + 2 + 3 + . . . + n ; Function that find sum of series . ; Driver Code
public class GfG { static int sumOfSeries ( int n ) { return ( n * ( n + 1 ) * ( 2 * n + 1 ) ) / 6 ; } public static void main ( String s [ ] ) { int n = 10 ; System . out . println ( sumOfSeries ( n ) ) ; } }
Maximum binomial coefficient term value | Java Program to find maximum binomial coefficient term ; Returns value of Binomial Coefficient C ( n , k ) ; Calculate value of Binomial Coefficient in bottom up manner ; Base Cases ; Calculate value using previously stored values ; Return maximum binomial coefficient term value . ; if n is even ; if n is odd ; Driver Code
import java . io . * ; class GFG { static int binomialCoeff ( int n , int k ) { int [ ] [ ] C = new int [ n + 1 ] [ k + 1 ] ; for ( int i = 0 ; i <= n ; i ++ ) { for ( int j = 0 ; j <= Math . min ( i , k ) ; j ++ ) { if ( j == 0 j == i ) C [ i ] [ j ] = 1 ; else C [ i ] [ j ] = C [ i - 1 ] [ j - 1 ] + C [ i - 1 ] [ j ] ; } } return C [ n ] [ k ] ; } static int maxcoefficientvalue ( int n ) { if ( n % 2 == 0 ) return binomialCoeff ( n , n / 2 ) ; else return binomialCoeff ( n , ( n + 1 ) / 2 ) ; } public static void main ( String [ ] args ) { int n = 4 ; System . out . println ( maxcoefficientvalue ( n ) ) ; } }
Smallest n digit number divisible by given three numbers | Java program to find smallest n digit number which is divisible by x , y and z . ;  ; LCM for x , y , z ; returns smallest n digit number divisible by x , y and z ; find the LCM ; find power of 10 for least number ; reminder after ; If smallest number itself divides lcm . ; add lcm - reminder number for next n digit number ; this condition check the n digit number is possible or not if it is possible it return the number else return 0 ; driver code ; if number is possible then it print the number
import java . io . * ; public class GFG { static int __gcd ( int a , int b ) { if ( b == 0 ) { return a ; } else { return __gcd ( b , a % b ) ; } } static int LCM ( int x , int y , int z ) { int ans = ( ( x * y ) / ( __gcd ( x , y ) ) ) ; return ( ( z * ans ) / ( __gcd ( ans , z ) ) ) ; } static int findDivisible ( int n , int x , int y , int z ) { int lcm = LCM ( x , y , z ) ; int ndigitnumber = ( int ) Math . pow ( 10 , n - 1 ) ; int reminder = ndigitnumber % lcm ; if ( reminder == 0 ) return ndigitnumber ; ndigitnumber += lcm - reminder ; if ( ndigitnumber < Math . pow ( 10 , n ) ) return ndigitnumber ; else return 0 ; } static public void main ( String [ ] args ) { int n = 4 , x = 2 , y = 3 , z = 5 ; int res = findDivisible ( n , x , y , z ) ; if ( res != 0 ) System . out . println ( res ) ; else System . out . println ( " Not ▁ possible " ) ; } }
Sum of squares of first n natural numbers | Java Program to find sum of square of first n natural numbers . This program avoids overflow upto some extent for large value of n . ; Return the sum of square of first n natural numbers ; Driven Program
import java . io . * ; import java . util . * ; class GFG { public static int squaresum ( int n ) { return ( n * ( n + 1 ) / 2 ) * ( 2 * n + 1 ) / 3 ; } public static void main ( String [ ] args ) { int n = 4 ; System . out . println ( squaresum ( n ) ) ; } }
Program to calculate distance between two points | Java code to compute distance ; Function to calculate distance ; Calculating distance ; Driver code
class GFG { static double distance ( int x1 , int y1 , int x2 , int y2 ) { return Math . sqrt ( Math . pow ( x2 - x1 , 2 ) + Math . pow ( y2 - y1 , 2 ) * 1.0 ) ; } public static void main ( String [ ] args ) { System . out . println ( Math . round ( distance ( 3 , 4 , 4 , 3 ) * 100000.0 ) / 100000.0 ) ; } }
Check if a large number is divisibility by 15 | Java program to check if a large number is divisible by 15 ; function to check if a large number is divisible by 15 ; length of string ; check divisibility by 5 ; Sum of digits ; if divisible by 3 ; Driver code
import java . util . * ; class GFG { public static boolean isDivisible ( String S ) { int n = S . length ( ) ; if ( S . charAt ( n - 1 ) != '5' && S . charAt ( n - 1 ) != '0' ) return false ; int sum = 0 ; for ( int i = 0 ; i < S . length ( ) ; i ++ ) sum += ( int ) S . charAt ( i ) ; if ( sum % 3 == 0 ) return true ; else return false ; } public static void main ( String [ ] args ) { String S = "15645746327462384723984023940239" ; if ( isDivisible ( S ) == true ) System . out . println ( " Yes " ) ; else System . out . println ( " No " ) ; String S1 = "15645746327462384723984023940235" ; if ( isDivisible ( S1 ) == true ) System . out . println ( " Yes " ) ; else System . out . println ( " No " ) ; } }
Shortest path with exactly k edges in a directed and weighted graph | Dynamic Programming based Java program to find shortest path with exactly k edges ; Define number of vertices in the graph and inifinite value ; A naive recursive function to count walks from u to v with k edges ; Base cases ; Initialize result ; Go to all adjacents of u and recur ; driver program to test above function ; Let us create the graph shown in above diagram
import java . util . * ; import java . lang . * ; import java . io . * ; class ShortestPath { static final int V = 4 ; static final int INF = Integer . MAX_VALUE ; int shortestPath ( int graph [ ] [ ] , int u , int v , int k ) { if ( k == 0 && u == v ) return 0 ; if ( k == 1 && graph [ u ] [ v ] != INF ) return graph [ u ] [ v ] ; if ( k <= 0 ) return INF ; int res = INF ; for ( int i = 0 ; i < V ; i ++ ) { if ( graph [ u ] [ i ] != INF && u != i && v != i ) { int rec_res = shortestPath ( graph , i , v , k - 1 ) ; if ( rec_res != INF ) res = Math . min ( res , graph [ u ] [ i ] + rec_res ) ; } } return res ; } public static void main ( String [ ] args ) { int graph [ ] [ ] = new int [ ] [ ] { { 0 , 10 , 3 , 2 } , { INF , 0 , INF , 7 } , { INF , INF , 0 , 6 } , { INF , INF , INF , 0 } } ; ShortestPath t = new ShortestPath ( ) ; int u = 0 , v = 3 , k = 2 ; System . out . println ( " Weight ▁ of ▁ the ▁ shortest ▁ path ▁ is ▁ " + t . shortestPath ( graph , u , v , k ) ) ; } }
Shortest path with exactly k edges in a directed and weighted graph | Dynamic Programming based Java program to find shortest path with exactly k edges ; Define number of vertices in the graph and inifinite value ; A Dynamic programming based function to find the shortest path from u to v with exactly k edges . ; Table to be filled up using DP . The value sp [ i ] [ j ] [ e ] will store weight of the shortest path from i to j with exactly k edges ; Loop for number of edges from 0 to k ; for source ; for destination ; initialize value ; from base cases ; go to adjacent only when number of edges is more than 1 ; There should be an edge from i to a and a should not be same as either i or j ; driver program to test above function ; Let us create the graph shown in above diagram
import java . util . * ; import java . lang . * ; import java . io . * ; class ShortestPath { static final int V = 4 ; static final int INF = Integer . MAX_VALUE ; int shortestPath ( int graph [ ] [ ] , int u , int v , int k ) { int sp [ ] [ ] [ ] = new int [ V ] [ V ] [ k + 1 ] ; for ( int e = 0 ; e <= k ; e ++ ) { for ( int i = 0 ; i < V ; i ++ ) { for ( int j = 0 ; j < V ; j ++ ) { sp [ i ] [ j ] [ e ] = INF ; if ( e == 0 && i == j ) sp [ i ] [ j ] [ e ] = 0 ; if ( e == 1 && graph [ i ] [ j ] != INF ) sp [ i ] [ j ] [ e ] = graph [ i ] [ j ] ; if ( e > 1 ) { for ( int a = 0 ; a < V ; a ++ ) { if ( graph [ i ] [ a ] != INF && i != a && j != a && sp [ a ] [ j ] [ e - 1 ] != INF ) sp [ i ] [ j ] [ e ] = Math . min ( sp [ i ] [ j ] [ e ] , graph [ i ] [ a ] + sp [ a ] [ j ] [ e - 1 ] ) ; } } } } } return sp [ u ] [ v ] [ k ] ; } public static void main ( String [ ] args ) { int graph [ ] [ ] = new int [ ] [ ] { { 0 , 10 , 3 , 2 } , { INF , 0 , INF , 7 } , { INF , INF , 0 , 6 } , { INF , INF , INF , 0 } } ; ShortestPath t = new ShortestPath ( ) ; int u = 0 , v = 3 , k = 2 ; System . out . println ( " Weight ▁ of ▁ the ▁ shortest ▁ path ▁ is ▁ " + t . shortestPath ( graph , u , v , k ) ) ; } }
Multistage Graph ( Shortest Path ) | Java program to find shortest distance in a multistage graph . ; Returns shortest distance from 0 to N - 1. ; dist [ i ] is going to store shortest distance from node i to node N - 1. ; Calculating shortest path for rest of the nodes ; Initialize distance from i to destination ( N - 1 ) ; Check all nodes of next stages to find shortest distance from i to N - 1. ; Reject if no edge exists ; We apply recursive equation to distance to target through j . and compare with minimum distance so far . ; Driver code ; Graph stored in the form of an adjacency Matrix
class GFG { static int N = 8 ; static int INF = Integer . MAX_VALUE ; public static int shortestDist ( int [ ] [ ] graph ) { int [ ] dist = new int [ N ] ; dist [ N - 1 ] = 0 ; for ( int i = N - 2 ; i >= 0 ; i -- ) { dist [ i ] = INF ; for ( int j = i ; j < N ; j ++ ) { if ( graph [ i ] [ j ] == INF ) { continue ; } dist [ i ] = Math . min ( dist [ i ] , graph [ i ] [ j ] + dist [ j ] ) ; } } return dist [ 0 ] ; } public static void main ( String [ ] args ) { int [ ] [ ] graph = new int [ ] [ ] { { INF , 1 , 2 , 5 , INF , INF , INF , INF } , { INF , INF , INF , INF , 4 , 11 , INF , INF } , { INF , INF , INF , INF , 9 , 5 , 16 , INF } , { INF , INF , INF , INF , INF , INF , 2 , INF } , { INF , INF , INF , INF , INF , INF , INF , 18 } , { INF , INF , INF , INF , INF , INF , INF , 13 } , { INF , INF , INF , INF , INF , INF , INF , 2 } } ; System . out . println ( shortestDist ( graph ) ) ; } }
Reverse Level Order Traversal | A binary tree node ; Function to print REVERSE level order traversal a tree ; Print nodes at a given level ; Compute the " height " of a tree -- the number of nodes along the longest path from the root node down to the farthest leaf node . ; compute the height of each subtree ; use the larger one ; Driver program to test above functions ; Let us create trees shown in above diagram
class Node { int data ; Node left , right ; Node ( int item ) { data = item ; left = right ; } } class BinaryTree { Node root ; void reverseLevelOrder ( Node node ) { int h = height ( node ) ; int i ; for ( i = h ; i >= 1 ; i -- ) { printGivenLevel ( node , i ) ; } } void printGivenLevel ( Node node , int level ) { if ( node == null ) return ; if ( level == 1 ) System . out . print ( node . data + " ▁ " ) ; else if ( level > 1 ) { printGivenLevel ( node . left , level - 1 ) ; printGivenLevel ( node . right , level - 1 ) ; } } int height ( Node node ) { if ( node == null ) return 0 ; else { int lheight = height ( node . left ) ; int rheight = height ( node . right ) ; if ( lheight > rheight ) return ( lheight + 1 ) ; else return ( rheight + 1 ) ; } } public static void main ( String args [ ] ) { BinaryTree tree = new BinaryTree ( ) ; tree . root = new Node ( 1 ) ; tree . root . left = new Node ( 2 ) ; tree . root . right = new Node ( 3 ) ; tree . root . left . left = new Node ( 4 ) ; tree . root . left . right = new Node ( 5 ) ; System . out . println ( " Level ▁ Order ▁ traversal ▁ of ▁ binary ▁ tree ▁ is ▁ : ▁ " ) ; tree . reverseLevelOrder ( tree . root ) ; } }