Skip to content

Instantly share code, notes, and snippets.

View kassane's full-sized avatar
🏠
Working from home

Matheus C. França kassane

🏠
Working from home
View GitHub Profile
@kassane
kassane / generic_qsort.c
Created February 29, 2016 13:02 — forked from marcoscastro/generic_qsort.c
generic qsort
#include <stdio.h>
void qsort(void *v[], int esq, int dir,
int(*comp)(void *, void *))
{
int i, ultimo;
void troca(void * v[], int i, int j);
if(esq >= dir)
return;
@kassane
kassane / sudoku.cpp
Created February 29, 2016 13:06 — forked from anaechavarria/sudoku.cpp
Solution to live archive problem 3304
using namespace std;
#include <algorithm>
#include <iostream>
#include <iterator>
#include <numeric>
#include <sstream>
#include <fstream>
#include <cassert>
#include <climits>
#include <cstdlib>
@kassane
kassane / Disjoint_set.cpp
Created March 10, 2016 13:16
Disjoint Set Algorithm
/*
ALGORITMO DE DISJOINT SET - (C++11)
*/
#include <iostream>
#include <unordered_map>
using namespace std;
class Disjoint_set
@kassane
kassane / Busca_Binaria.cpp
Last active March 19, 2016 16:38
Algoritmo de Busca Binária
/*
BINARY SEARCH ALGORITHM - C++
ALGORITMO DE PESQUISA BINÁRIA - C++
*/
#include <iostream> //cin, cout
#include <vector> //vector<>
#include <algorithm> //sort()
using namespace std;
@kassane
kassane / Notepad++_cpp.txt
Created March 19, 2016 19:41
Build no Notepad++
#Requer plugin NppExec
MinGW(G++)
#--------script------------------------------------------------------------------------
npp_save
g++ -Wall -std=gnu++14 -O3 -o $(NAME_PART) $(CURRENT_DIRECTORY)\$(FILE_NAME)
cmd /c " $(CURRENT_DIRECTORY)\$(NAME_PART).exe"
#---------------------------------------------------------------------------------------
@kassane
kassane / criptografa.cpp
Last active September 19, 2016 17:37
Criptografia XOR para arquivos
/*
CRIPTOGRAFIA XOR SIMPLES EM C++ Moderno
*/
#include <iostream> //cout & cin
#include <fstream> //ifstream & ofstream
#include <memory> //unique_ptr
using namespace std;
@kassane
kassane / Troco_Min.py
Created February 24, 2017 11:39
Problema do Troco Mínimo - Algoritmo Guloso
'''
ALGORITMO GULOSO - TROCO MÍNIMO (CURSO PYTHON 300) DIRIGIDO POR MARCOS CASTRO
'''
global moedas
moedas = [100,50,25,10,5,1]
def troco_min(valor, total=0):
for i in range(len(moedas)):
@kassane
kassane / binary_file.cpp
Created February 24, 2017 14:05
Arquivo binário em C++ | Binary file in C++
/**
C++ Binary File(Array C style)
*/
#include <iostream>
#include <fstream>
using namespace std;
@kassane
kassane / pol_gen_opcoes.cpp
Created June 7, 2017 17:16
Exemplo baseado no Signals & Slots [Qt]
// Para quem não entendeu as dificuldades
// com signals e slots:
// revendo fundamentos...
#include <iostream>
#include <list>
#include <algorithm>
#include <functional>
@kassane
kassane / QHashFile.cpp
Created July 4, 2017 20:01
Hash File - Qt5
#include <QtCore>
int main(int argc, char *argv[])
{
QCoreApplication a(argc, argv);
QCryptographicHash md5gen(QCryptographicHash::Md5); /*MD4, SHA1, SHA256, SHA512 ...*/
QFile file(argv[1]); //filename
file.open(QIODevice::ReadOnly);
md5gen.addData(file.readAll());