This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import java.util.*; | |
public class CheckSum { | |
private class Node{ | |
public int val; | |
public Node left; | |
public Node right; | |
Node(int n){ | |
val=n; | |
left=null; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import java.util.*; | |
public class isSubtree { | |
private class Node{ | |
public int val; | |
public Node left; | |
public Node right; | |
public Object data; | |
Node(int n){ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import java.util.*; | |
public class AncestorFind { | |
private static Node root; | |
private class Node(int n){ | |
private Node left; | |
private Node right; | |
private Node parent; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import java.util.*; | |
public class isSuccessor { | |
private Node root; | |
private class Node(int n){ | |
private Node left; | |
private Node right; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import java.util.*; | |
public class ValidBST { | |
private Node root; | |
private class Node(int n){ | |
private Node left; | |
private Node right; | |
public int data; | |
public Node insert(int i, Node t) { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import java.util.*; | |
public class BList { | |
private class Node{ | |
public int val; | |
public Node left; | |
public Node right; | |
Node(int n){ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package minBST; | |
public class minBST { | |
class TreeNode{ | |
int val; | |
TreeNode left; | |
TreeNode right; | |
void TreeNode(int x){ | |
val=x; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import java.util.*; | |
public class checkRoute { | |
public void bfs() | |
{ | |
public static rootNode; | |
// BFS uses Queue data structure | |
Queue queue = new LinkedList(); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public class isBalanced { | |
private TreeNode root; | |
provate class Node{ | |
int data; | |
Node *left,*right; | |
} | |
public static int getHeight(TreeNode Root){ | |
if(root==null){ | |
return 0; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public class Animal { | |
String type; | |
Date arrive; | |
String name; | |
} | |
public class Cats extends Animal{ | |
public Cats(String name){ | |
this.name=name; | |
type="cats"; |