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 kruskals; | |
import java.util.Arrays; | |
import java.util.Scanner; | |
class Edge implements Comparable<Edge> | |
{ | |
int v1; | |
int v2; | |
int weight; |
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 prims_algorithm; | |
import java.util.Scanner; | |
public class Prims { | |
public static void prims(int matrix[][]) | |
{ | |
int n = matrix.length; | |
boolean visited[] = new boolean[n]; | |
int parent[] = new 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 graph; | |
import java.util.*; | |
public class Graph1 { | |
HashMap<Integer, List<Integer>>obj; | |
public Graph1() | |
{ | |
obj = new HashMap<Integer,List<Integer>>(); | |
} | |
// Single Source Shortest Path using BFS |
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 threadedbinarytree; | |
class Node | |
{ | |
int data; | |
Node left; | |
Node right; | |
boolean leftthread; | |
boolean rightthread; | |
public Node(int data) | |
{ |
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 BSTSearchPath; | |
import java.util.ArrayList; | |
import java.util.Iterator; | |
public class BSTSearch { | |
// deletion in Binary search tree |
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
// Binay tree by using the Array | |
package BTree; | |
public class BTest { | |
int arr[]; | |
int lastusedindex; | |
public BTest(int size) { | |
arr = new int[size+1]; | |
this.lastusedindex = 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
package avl; | |
class Node | |
{ | |
int data; | |
Node left; | |
Node right; | |
int height; | |
int balance; | |
public Node(int data) | |
{ |
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.lang.invoke.SwitchPoint; | |
public class Test { | |
public static void main(String[] args) { | |
String str = "two four triple three"; | |
String ans = ""; | |
String strArray[] = str.split(" "); | |
String ans1=""; | |
System.out.println("String : " + str); | |
for (int i = 0; i < strArray.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
import java.lang.invoke.SwitchPoint; | |
public class Test { | |
public static void main(String[] args) { | |
String str = "three four eight nine four"; | |
String ans = ""; | |
String strArray[] = str.split(" "); | |
System.out.println("String : " + str); |
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 BSTSearchPath; | |
import java.util.ArrayList; | |
import java.util.Iterator; | |
public class BSTSearch { | |
public static void insert(Node root,Node newnode) | |
{ | |
if(root== null) | |
{ |
NewerOlder