EduLearn - Online Education Platform

Welcome to EduLearn!

Start learning today with our wide range of courses taught by industry experts. Gain new skills, advance your career, or explore new interests.

Browse Courses

Java Code: Find Maximum Element in Binary Tree

Java Code: Find Maximum Element in Binary Tree // Node class definition class Node { int data; Node left, right;   public Node(int item) { data = item; left = right = null; } }   public class BinaryTreeMax {   // Function to find the maximum element in the binary tree int findMax(Node node) […]

Java data structures practice programs

  Traversing in binary tree   int countLeafNodes(Node root) { if(root==null) return 0;   Stack<Node> stack=new Stack<>(); stack.push(root); int leafcount=0;   while(!stack.isEmpty()) { Node current=stack.pop();   if(current.left==null && current.right==null) leafcount++; if(current.right!=null) stack.push(current.right); if(current.left!=null) stack.push(current.right); } return leafcount; }

Java data structures in binaru tree

Binary Tree: –>Binary tree is a hierarchical data structure where each node has at most 2 children left child and right child   Tree Terminology:   Node: An element in the tree. It contains data and links   Root: The topmost node in the tree(No parent)   Parent: A Node that has children   Child: […]

Java important practice programs

  TCS Codings – 2 def find_equilibrium_index(arr):     total_sum = sum(arr)     left_sum = 0       for i in range(len(arr)):         # right_sum = total_sum – left_sum – arr[i]         if left_sum == (total_sum – left_sum – arr[i]):             return […]

Queue in java data structures

Given a string s consisting of words and spaces, return the length of the last word in the string.   A word is a maximal substring consisting of non-space characters only.       Example 1:   Input: s = “Hello World” Output: 5 Explanation: The last word is “World” with length 5. Example 2: […]

Java counting number program in queue

Count the number of vowels in the given string by using queue   import java.util.*; class Count { public static void main(String args[]) { String input=”queue”;//4   Queue<Character> q=new LinkedList<>();   int count=0;   for(char ch:input.toCharArray())//e { q.add(ch);//e }   while(!q.isEmpty())//true { char ch=q.remove(); if(“aeiouAEIOU”.indexOf(ch)!=-1)//indexof returns -1 if value is not found { count++; } […]

Java data structures in reversing element

//reverse a elements of queue by using stack import java.util.*;   class ReverseQueue { public static void main(String args[]) { Queue<Integer> q=new LinkedList<>(); q.add(1); q.add(2); q.add(3);   Stack<Integer> s=new Stack<>(); while(!q.isEmpty()) { s.push(q.remove()); }   while(!s.isEmpty()) { q.add(s.pop()); } System.out.println(“Reverse queue=” +q); } }   output: Reverse queue=[3, 2, 1]

Java linked list simple program for practice

create a linkedlist and add 5 integer elements to that.calculate and print the sum of odd elements of the list   1 2 3 4 5   class Main { public static void main(String[] args) { LinkedList<Integer> list = new LinkedList<>(); for(int i = 1; i<=5; i++){ list.add(i);//1 2 3 4 5 } int sum […]

EduLearn - Online Education Platform

Welcome to EduLearn!

Start learning today with our wide range of courses taught by industry experts. Gain new skills, advance your career, or explore new interests.

Browse Courses

Popular Courses

[Course Image]

Introduction to Programming

Learn the fundamentals of programming with Python in this beginner-friendly course.

12 Hours Beginner
[Course Image]

Data Science Essentials

Master the basics of data analysis, visualization, and machine learning.

20 Hours Intermediate
[Course Image]

Web Development Bootcamp

Build modern websites with HTML, CSS, JavaScript and popular frameworks.

30 Hours Beginner
[Course Image]

Digital Marketing Fundamentals

Learn SEO, social media marketing, email campaigns and analytics.

15 Hours Beginner
Educational Website Footer