This file contains hidden or 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.io.FileNotFoundException; | |
import java.util.*; | |
import java.io.File; | |
public class ClusterS { | |
int max = 99999999; | |
int ne=0; | |
int nn ; | |
int clusters; | |
HashMap<Integer, Nodes> hm = new HashMap<>(); | |
ArrayList<Edge> edges = new ArrayList<>(); |
This file contains hidden or 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.*; | |
import java.io.File; | |
public class ClusterB { | |
int n; | |
int bitsn; | |
int clusters ; | |
HashMap<String,Nodes> cl = new HashMap<>(); | |
void getInput() { | |
try { | |
File f = new File("C:\\Users\\vinir_000\\IdeaProjects\\Learn\\src\\input.txt"); |
This file contains hidden or 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
1) In java : When you are using Math.ceil or Math.floor(a/b) , a/b will not be a float number if a or b are integers . so , dont forget to | |
type cast to floor , either of the integers a or b before dividing. |
This file contains hidden or 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.HashMap; | |
import java.util.ArrayList; | |
import java.util.Scanner; | |
public class MST | |
{ | |
HashMap<Node,ArrayList<Pair>> al; //adjacency list to store the graph | |
ArrayList<Node> map; //map a vertex to its respective vertex object | |
Heap heap; | |
int nodes ; | |
int edges ; |
This file contains hidden or 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 CPU_SCHEDULING{ | |
public static void main(String []args){ | |
Scanner sc = new Scanner(System.in); | |
int n = sc.nextInt(); | |
int temp = n; | |
ArrayList<Node> ar = new ArrayList<>(); | |
while(n-->0) | |
{ |
This file contains hidden or 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 Sum | |
{ | |
public static void main(String args[]) | |
{ | |
Scanner sc = new Scanner(System.in); | |
TreeSet<Long> ts = new TreeSet<>(); | |
ArrayList<Long> al1 = new ArrayList<>(); | |
ArrayList<Long> al2 = new ArrayList<>(); | |
HashSet<Long> hs = new HashSet<>(); |
This file contains hidden or 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.*; | |
import java.lang.Math; | |
public class Dijkshtra{ | |
int xx = 201; | |
HashMap<Integer,ArrayList<Pair>> al; //adjacency list | |
boolean X[] = new boolean[xx]; | |
MinHeap heap = new MinHeap(); | |
int[] distance = new int[xx]; | |
Dijkshtra() |
This file contains hidden or 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.*; | |
import java.lang.Math; | |
public class Median | |
{ | |
public static void main(String args[]) | |
{ | |
long sum = 0; |
This file contains hidden or 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.*; | |
import java.lang.Math; | |
public class MaxHeap { | |
ArrayList<Integer> ar = new ArrayList<>(); | |
int size = 0; | |
void delete(int pos) | |
{ | |
ar.set(pos,ar.get(ar.size()-1)); |
This file contains hidden or 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.*; | |
import java.lang.Math; | |
public class MinHeap { | |
ArrayList<Integer> ar = new ArrayList<>(); | |
int size = 0; | |
void delete(int pos) | |
{ | |
ar.set(pos,ar.get(ar.size()-1)); |
NewerOlder