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.Scanner; // Import the Scanner class | |
| import java.util.Vector; // import the ArrayList class | |
| import java.util.Collections; | |
| public class VectorExample { | |
| public static class Pair { | |
| private int first; | |
| private int second;; |
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.Vector; | |
| class Btree<T> { | |
| private Node<T> root; | |
| public Btree() { | |
| this.root = null; | |
| } | |
| public Btree(Node<T> root) { |
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.*; | |
| import java.util.*; | |
| public class Solution { | |
| public static class Step { | |
| public int x, y, dist; | |
| public Step(int x, int y, int dist) { | |
| this.x = x; |
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.*; | |
| import java.util.*; | |
| public class CopiarPegarBorrarDeshacer { | |
| static public int append(Stack<Character> stack, String buff) { | |
| int count = 0; | |
| for(char c:buff.toCharArray()){ | |
| stack.push(c); | |
| count++; | |
| } |
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
| // A Java program for Prim's Minimum Spanning Tree (MST) algorithm. | |
| // The program is for adjacency matrix representation of the graph | |
| import java.util.*; | |
| import java.lang.*; | |
| import java.io.*; | |
| class Prim { | |
| // A utility function to find the vertex with minimum key |
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.*; | |
| class Dijkstra { | |
| private static int minDistance(int dist[], boolean visited[]) { | |
| // Initialize min value | |
| int min = Integer.MAX_VALUE, min_index = -1; | |
| for (int v = 0; v < dist.length; v++) |
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.*; | |
| class TopologicalSort { | |
| public static class Edge{ | |
| int u; | |
| int w; | |
| public Edge(int u, int w) { | |
| this.u=u; | |
| this.w=w; | |
| } |
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.*; | |
| import java.util.*; | |
| public class Solution { | |
| static class KMP_String_Matching { | |
| public Vector<Integer> KMPSearch(String pat, String txt) | |
| { | |
| Vector<Integer> find_idxs = new Vector<Integer>(); | |
| int M = pat.length(); | |
| int N = txt.length(); |
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.Scanner; | |
| class basura{ | |
| public static class Bolsa{ | |
| private int Volumen; | |
| Bolsa(int V){ | |
| Volumen = V; | |
| } | |
| public void setVol(int V){ |
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
| class List<T extends Comparable<T>> { | |
| private Node<T> head; | |
| public List() { | |
| this.head = null; | |
| } | |
| // Insert in Order | |
| public void insert(T value) { | |
| Node<T> n_node = new Node<T>(value); |