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
class Node | |
{ | |
int data; | |
Node left; | |
Node right; | |
public Node(int data) | |
{ | |
this.data = data; | |
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
// implementation of AVL Tree | |
// It is self balancing binary search tree where the difference between heights of the | |
// left & right sub tree cannot be morethan one for all nodes | |
// or we can say that it is a Balanced binary search tree | |
// the benefit is it requires less time to traverse, insert, delete a node than a non AVL Tree | |
//We can convert a binary sub tree to AVL Tree by using the 4 methods called (AVL tree Rotations) |
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 Quick { | |
public static void main(String[] args) { | |
int[] intarray = {20,35,-15,7,55,1,-22}; | |
quickSort(intarray, 0,intarray.length); | |
for(int i = 0;i<intarray.length;i++) | |
{ |
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 Quick { | |
public static void main(String[] args) { | |
int[] intarray = {20,35,-15,7,55,1,-22}; | |
quickSort(intarray, 0,intarray.length); | |
for(int i = 0;i<intarray.length;i++) | |
{ |
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 Test { | |
public static void main(String[] args) { | |
String[] days = new String[] {"sun", "mon", "tue", "wed", "thr", "fri", "sat", "sun"} ; | |
for(int i =1;i<=days.length ;i++) | |
System.out.println (days[i]); | |
int arr[] = new int[] {10,20,30,40}; | |
} |
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 ConstructorDemo { | |
int num1, num2; // instance variable | |
// public void setvalue() | |
// { | |
// num1 = 10; | |
// num2 = 20; | |
// } | |
public ConstructorDemo() | |
{ |
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
class emp | |
{ | |
int empid; // instance variables | |
String name; //instance variables | |
// non parameterised constructor | |
emp() | |
{ | |
empid = 10; | |
name = "abc"; | |
//System.out.println("constructor invoked "); |
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
class emp | |
{ | |
int empid; | |
String name; | |
public emp() { | |
} |
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
class emp | |
{ | |
int empid; | |
String name; | |
public emp() { | |
} |
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 Constructor123 { | |
int rollno; // instance variable | |
String name; | |
Constructor123 () | |
{ | |
rollno = 10; | |
name = "ABC"; | |
} | |
Constructor123(String str) | |
{ |
OlderNewer