Skip to content

Instantly share code, notes, and snippets.

package kruskals;
import java.util.Arrays;
import java.util.Scanner;
class Edge implements Comparable<Edge>
{
int v1;
int v2;
int weight;
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];
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
package threadedbinarytree;
class Node
{
int data;
Node left;
Node right;
boolean leftthread;
boolean rightthread;
public Node(int data)
{
package BSTSearchPath;
import java.util.ArrayList;
import java.util.Iterator;
public class BSTSearch {
// deletion in Binary search tree
// 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;
}
package avl;
class Node
{
int data;
Node left;
Node right;
int height;
int balance;
public Node(int data)
{
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++) {
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);
package BSTSearchPath;
import java.util.ArrayList;
import java.util.Iterator;
public class BSTSearch {
public static void insert(Node root,Node newnode)
{
if(root== null)
{