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
set comment { | |
PROBLEM B: GNOME SEQUENCING | |
In the book All Creatures of Mythology, gnomes are kind, bearded creatures, while goblins tend to be | |
bossy and simple-minded. The goblins like to harass the gnomes by making them line up in groups of three, | |
ordered by the length of their beards. The gnomes, being of different physical heights, | |
vary their arrangements to confuse the goblins. Therefore, the goblins must actually measure the beards | |
in centimeters to see if everyone is lined up in order. | |
Your task is to write a program to assist the goblins in determining whether or not | |
the gnomes are lined up properly, either from shortest to longest beard or from longest to shortest. |
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
/* Necessary includes for device drivers */ | |
#include <linux/module.h> /* modulo de kernel */ | |
#include <linux/kernel.h> /* printk() */ | |
#include <linux/slab.h> /* kmalloc() */ | |
#include <linux/types.h> /* size_t */ | |
#include <linux/proc_fs.h> /* /proc */ | |
#include <linux/miscdevice.h> | |
#include <linux/seq_file.h> // for sequence files | |
#include <asm/uaccess.h> /* copy_from_user e copy_to_user */ |
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
#!/usr/bin/env python | |
# -*- coding: utf-8 -*- | |
''' | |
tips: | |
- If you're BR respond "BR" | |
- Else, repond HUE. | |
''' |
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
/* | |
* File: main.c | |
* Author: pedro | |
* | |
* Created on 18 de Março de 2013, 10:10 | |
*/ | |
#include <stdio.h> | |
#include <stdlib.h> | |
#include <string.h> |
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> | |
#include<string.h> | |
#define N 20 | |
typedef struct Nodo { | |
int inteiro; | |
struct Nodo *pProximo; | |
} Nodo; | |
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 binaria(int elem, int v[], int tam, int* contador) { | |
(*contador)++; | |
int inicio = 0, meio = 0, fim = tam - 1, k = -1; | |
while ((inicio <= fim) && (k == -1)) { | |
meio = ((inicio + fim) / 2); | |
if (elem == v[meio]) { | |
k = meio; |
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
int TentaAVL(Arvore Raiz){ | |
if(Raiz==NULL){ | |
return; | |
} else { | |
int Balanceamento = altura(Raiz->direita) - altura(Raiz->esquerda); | |
if ((Balanceamento>=2)||(Balanceamento<=-2)){ | |
return 0; | |
} | |
TentaAVL(Raiz->direita); | |
TentaAVL(Raiz->esquerda); |
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
void Remove(int key, Tree *MyTree) { | |
if (*MyTree == NULL) { | |
printf("Not found.\n"); | |
} else if ((*MyTree)->REG.number > key) { | |
Remove(key, &(*MyTree)->left); | |
} else if ((*MyTree)->REG.number < key) { | |
Remove(key, &(*MyTree)->right); | |
} else { | |
if ((*MyTree)->right == NULL && (*MyTree)->left == NULL) { | |
printf("%d deleted.\n", (*MyTree)->REG.number); |
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> | |
#include <stdbool.h> | |
#define LINHA 5 | |
#define COLUNA 6 | |
int MatrizBubble[LINHA][COLUNA]; | |
inline void troca(int* a, int* b){ | |
int aux = *a; |
NewerOlder