Skip to content

Instantly share code, notes, and snippets.

View brunolpw's full-sized avatar
👨‍💻
Coding...

Bruno brunolpw

👨‍💻
Coding...
View GitHub Profile
@brunolpw
brunolpw / genetico_onemax.cpp
Created September 11, 2017 00:05
Exemplo simples de algoritmo genetico usando o metodo de OneMax
#include <iostream>
#include <vector>
#include <stdlib.h>
#include <time.h>
/*
g++ -o onemax genetico_onemax.cpp -Wall
*/
#define TAM_GENES 10 // Quantidade de genes que terá cada individuo.
#define TAM_POP 50 // Quantos individuos terão.
#define TORNEIO 20 // Quantidade de cruzamentos.
#include <stdio.h>
/*
* Por Bruno La Porta
* Em 01/09/15
*
* Apenas um simples exemplo de como trocar os valores de uma variavel com outra sem a utilização de uma variavel auxiliar.
* */
int main()
@brunolpw
brunolpw / lista.c
Last active October 30, 2020 17:22
#include "lista.h"
// Verifica se há algum elemento para ser ligado.
void verifica(node *lista){
if(!lista){
printf("Sem memoria suficiente.\n");
exit(1);
}
}
@brunolpw
brunolpw / crud.py
Last active December 5, 2022 10:46
Simple CRUD in Python with MongoDB
#!/usr/bin/env python
# -*- coding:latin-1 -*-
'''
Created on 29/04/2015
Author: Bruno
This code is a only exemple who to do a basic CRUD in Python 2.7 with MongoDB 2.6.
'''