Skip to content

Instantly share code, notes, and snippets.

View so77id's full-sized avatar
👶
Father in process

Miguel Rodriguez so77id

👶
Father in process
  • Santiago, Chile
View GitHub Profile
@so77id
so77id / 01-greater-of-4-numbers.cpp
Created April 27, 2021 15:44
Evaluacion I Programacion Seccion 8 2021 Semestre I
#include<iostream>
using namespace std;
int main() {
int a,b,c;
cin >> a >> b;
if(a > b) c = a;
else c = b;
import java.io.*;
import java.math.*;
import java.security.*;
import java.text.*;
import java.util.*;
import java.util.concurrent.*;
import java.util.function.*;
import java.util.regex.*;
import java.util.stream.*;
import static java.util.stream.Collectors.joining;
#include <vector>
using namespace std;
vector<int> getKnapSackIndex(vector<vector<int>> items, vector<vector<int>> dp, int capacity){
vector<int> sol;
int i=items.size();
int j=capacity;
while(i > 0) {
if(dp[i][j] == dp[i-1][j]){
@so77id
so77id / Bin2Dec.java
Created September 8, 2020 21:28
Sol ev 1 - intento 1
public static int bin2dec(SinglyLinkedListNode head) {
SinglyLinkedListNode tmp = head;
int count, num;
count = num = 0;
while(tmp != null) {
count++;
tmp = tmp.next;
}
tmp = head;
for(; count > 0; count--) {
@so77id
so77id / Main.java
Created September 4, 2020 19:58
Queue in java generic
import java.util.Scanner; // Import the Scanner class
public class Main {
public static void main(String[] args){
int n;
int buff;
Scanner scanner = new Scanner(System.in); // Create a Scanner object
Queue<Integer> myQueue = new Queue<Integer>();
@so77id
so77id / Main.java
Created September 4, 2020 19:53
Stack in Java Generic
import java.util.Scanner; // Import the Scanner class
public class Main {
public static void main(String[] args){
int n;
int buff;
Scanner scanner = new Scanner(System.in); // Create a Scanner object
Stack<Integer> myStack = new Stack<Integer>();
@so77id
so77id / List.java
Created September 4, 2020 19:47
Ordered linked list in Java generic
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);
@so77id
so77id / T1-basura.java
Created July 15, 2020 18:05
Soluciones de las Tareas
import java.util.Scanner;
class basura{
public static class Bolsa{
private int Volumen;
Bolsa(int V){
Volumen = V;
}
public void setVol(int V){
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();
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;
}