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
| // ##################### Bibliotecas Externas ############################## | |
| #include <stdio.h> | |
| #include <stdlib.h> | |
| // ########################## TAD X.h ###################################### | |
| struct noABB | |
| { | |
| int valor; |
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 verifica(int num, int *n) | |
| { | |
| for (int i = 0; i < num; i++) | |
| { | |
| if (n[i] > n[i + 1]) | |
| { | |
| return i; |
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 potrec(int n) | |
| { | |
| if (n == 0) | |
| return 1; | |
| else | |
| return potrec(n - 1) * 2; | |
| } |
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 pot(int n) | |
| { | |
| if (n == 0) return 1; | |
| else if (n == 1) return 2; | |
| else return pot(n-1) * 2; | |
| } |
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 fibonacci(int n) | |
| { | |
| if (n==0) | |
| { | |
| return 0; | |
| } |
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() | |
| { | |
| int num1, num2, num3; | |
| printf("Digite a quantidade de materias com peso 1: "); | |
| scanf("%d", &num1); | |
| printf("Digite a quantidade de materias com peso 2: "); |