Nov 9, 2022Sorting AlgorithmsAll Sorting Algos 1. Bubble Sort class HelloWorld { public static void main(String[] args) { int arr[]= new int[]{-90, 6, 98, 34, 2, 11}; Bubble(arr)…2 min read2 min read
Nov 8, 2022Data Structures ImplementationImplementation Concepts DSA 1. Singly LinkedList class HelloWorld { static class Node{ int data; Node next…2 min read2 min read
Nov 8, 2022LinkedList Standard QuestionsGeeksForGeeks + LeetCode Q1. Find Middle of a LinkedList class Solution { int getMiddle(Node head) { if(head==null) return -1; Node fast = head; Node slow = head; while(fast != null && fast.next != null) { fast = fast.next.next; slow = slow.next; } return slow.data; } } Q2. Delete Middle of a LinkedList class Solution { Node deleteMid(Node head) {…4 min read4 min read
Nov 8, 2022Binary Tree Standard QuestionsGeeksForGeeks + LeetCode Q1. Height of Binary Tree class Solution { int height(Node node) { if(node == null) return 0; int left = height(node.left); int right = height(node.right); return Math.max(left, right) + 1; } } Q2. Convert to Mirror Tree class Solution { int height(Node node) {…4 min read4 min read