This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <iostream> /// Biblioteca padrão do C++ | |
#include <cstdio> /// Para poder trabalhar com Arquivo | |
#include <iomanip> /// Para poder usar o setW | |
using namespace std; | |
FILE *pFile; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <stdio.h> | |
#include <string.h> | |
void swap(char* x, char* y ); | |
void permute(char* str, unsigned int l, unsigned int s); | |
int main() | |
{ | |
char str[] = "ABCDA"; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include "md5.h" | |
//=== MD5 ===// | |
char* md5Sum(char* initial_msg) | |
{ | |
/******************************************************************************************** | |
* A função calcula o MD5 da "string" passada como parâmetro e retorna-o como uma "string". * | |
********************************************************************************************/ | |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include "agenda.h" | |
//=== MENU ===// | |
int8_t menu(void) | |
{ | |
/************************* | |
* Munu geral do sistema * | |
*************************/ | |
clrscr(); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include<stdio.h> | |
#include<stdlib.h> | |
int main(void) | |
{ | |
int aux = 0, soma = 0; | |
int i; | |
int vet[] = {-2,-3,4,-1,-2,1,5,-3}; | |
int n = sizeof(vet)/sizeof(int); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def BFS(G,s): | |
Q = [] | |
state = [None for i in range(len(G))] | |
pi = [None for i in range(len(G))] | |
for u in range(len(G)): | |
state[u]='N' | |
pi[u] = None | |
state[s] = 'D' |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <stdio.h> | |
#define MAX(x,y) x>y?x:y | |
int pd[100][100]; | |
int mochila(int n, int cap, int peso[], int valor[]) | |
{ | |
int i; | |
int j; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def mochila(n, capacidade, peso, valor): | |
pd = [[0 for i in range(capacidade+1)] for x in range(n+1)] | |
for i in range(1,n+1): | |
for j in range(0,capacidade+1): | |
if peso[i-1] > j: | |
pd[i][j] = pd[i-1][j] | |
else: | |
pd[i][j] = max(pd[i-1][j], (pd[i-1][j-peso[i-1]] + valor[i-1])) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# -*- coding: utf-8 -*- | |
#len(A) -> Linhas | |
#len(A[N]) -> Colunas | |
def MatrixChainOrder(p): | |
#m => Custos | |
#s => Indice dos Custos | |
#p => Comprimentos |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def guloso(mat, start): | |
notInGraph = list(range(len(mat))) | |
notInGraph.remove(start) | |
pos = start | |
comprimento = len(mat) | |
distanciaTotal = 0 | |
while(notInGraph != []): | |
dist = float('inf') |