Skip to content

Instantly share code, notes, and snippets.

View dennisbot's full-sized avatar
🎯
Focusing

Dennis Huillca Portilla dennisbot

🎯
Focusing
View GitHub Profile
@dennisbot
dennisbot / cloudSettings
Last active February 27, 2020 17:10
Visual Studio Code Settings Sync Gist
{"lastUpload":"2020-02-27T17:10:38.302Z","extensionVersion":"v3.4.3"}
@dennisbot
dennisbot / database.yml
Created February 2, 2018 15:12
postgre database for ruby on rails
# PostgreSQL. Versions 8.2 and up are supported.
#
# Install the pg driver:
# gem install pg
# On Mac OS X with macports:
# gem install pg -- --with-pg-config=/opt/local/lib/postgresql84/bin/pg_config
# On Windows:
# gem install pg
# Choose the win32 build.
# Install PostgreSQL and put its /bin directory on your path.
@dennisbot
dennisbot / strtok.c
Created July 31, 2017 17:47
parsing a string with C programming language strtok.c
char *st,*buf, sep[]=" .,";
buf=strdup(s.c_str());
st=strtok(buf,sep);
while (st) {
st=strtok(0,sep);
}
@dennisbot
dennisbot / MyHeap.cpp
Created June 23, 2017 17:10
una implementación de minHeap y maxHeap con C++
#include <vector>
using namespace std;
#define db(a) cout << #a << " = " << a << endl
#define db2(a, b) cout << #a << " = " << a << " " << #b << " = " << b << endl;
template<typename T> class MyHeap {
protected:
int capacity;
@dennisbot
dennisbot / Graph_class.cpp
Created June 23, 2017 17:08
Implementación de un Grafo con Matrices e incluye método para buscar alcance mínimo a otros vértices
class Graph {
private:
int **G;
int size;
public:
Graph(int n) {
n++;
G = new int*[n];
for (int i = 0; i < n; i++) {
G[i] = (int*)calloc(n, sizeof(int));
@dennisbot
dennisbot / MergeSort.cpp
Created June 23, 2017 17:05
MergeSort.cpp
void merge(vector<int> &a, vector<int> &temp, int mid, int leftStart, int rightEnd) {
int leftEnd = mid;
int rightStart = leftEnd + 1;
int curIndex = leftStart, left = leftStart;
for (;leftStart <= leftEnd && rightStart <= rightEnd;) {
if (a[leftStart] <= a[rightStart])
temp[curIndex++] = a[leftStart++];
else
temp[curIndex++] = a[rightStart++], res += leftEnd - leftStart + 1;
}
@dennisbot
dennisbot / Trie.cpp
Created June 23, 2017 17:03
Trie.cpp
template <typename T>
class Trie {
private:
T count;
Trie<T> *next[26];
public:
Trie() {
count = T();
for (int i = 0; i < 26; i++) next[i] = NULL;
}
[
{"command": "move_to", "args": {"to": "hardeol"}},
{"command": "insert", "args": {"characters": ";"}}
]