Skip to content

Instantly share code, notes, and snippets.

View estebanz01's full-sized avatar
🤓
I'm scared, I see data everywhere.

Esteban Zapata Rojas estebanz01

🤓
I'm scared, I see data everywhere.
View GitHub Profile
@estebanz01
estebanz01 / BinaryTree.cpp
Last active November 14, 2017 05:06
Binary tree with multiple operations
// Example program
#include <iostream>
#include <string>
using namespace std;
class Leave {
public:
int data;
Leave* left;
@estebanz01
estebanz01 / Colas.cpp
Created October 13, 2017 01:58
Colas en C++
// Example program
#include <iostream>
#include <string>
using namespace std;
class Elemento {
public:
int dato;
Elemento* siguiente;
@estebanz01
estebanz01 / PilaConListas.cpp
Last active October 4, 2017 02:24
Pilas implementadas con listas
// Example program
#include <iostream>
#include <string>
using namespace std;
class Elemento {
public:
int dato;
Elemento* siguiente;
@estebanz01
estebanz01 / listaDobleLigadaCircular.cpp
Created September 20, 2017 02:21
Listas doblemente ligadas circulares
// Example program
#include <iostream>
#include <vector>
#include <string>
using namespace std;
class Node {
public:
int data;
// Example program
#include <iostream>
#include <vector>
#include <string>
using namespace std;
class Node {
public:
int data;
@estebanz01
estebanz01 / splitdf.r
Created May 11, 2015 16:05
Split function to divide data frames in trainset & testset.
splitdf <- function(dataframe, seed=NULL) {
if (!is.null(seed)) set.seed(seed)
index <- 1:nrow(dataframe)
trainindex <- sample(index, trunc(length(index)/2))
trainset <- dataframe[trainindex, ]
testset <- dataframe[-trainindex, ]
list(trainset=trainset,testset=testset)
}
#Source of this function: http://www.gettinggeneticsdone.com/2011/02/split-data-frame-into-testing-and.html
@estebanz01
estebanz01 / Benchmark.rb
Last active August 29, 2015 14:19
Benchmark between concat function (that belongs to the Array class) and flat_map (that belongs to the Enumerable class)
require 'benchmark'
arr = 1_000.times.map { (1..100).to_a }
Benchmark.bm 10 do |x|
x.report('#concat') { arr.each_with_object([]) { |x, memo| memo.concat([1001]) } }
x.report('#flat_map') { arr.flat_map { |x| x << [1001] } }
end