Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <stdio.h>
- #include <stdlib.h>
- #include <string.h>
- int potegaLiczby2(int N) {
- int pot;
- pot = 1;
- while (N-- > 0) {
- pot += pot;
- }
- return pot;
- }
- void gray(int N, int *WyrazyGraya) {
- int pot;
- if (N == 1)
- {
- WyrazyGraya[0] = 0;
- WyrazyGraya[1] = 1;
- }
- else
- {
- gray(N - 1, WyrazyGraya); // wyznaczamy poprzednie wyrazy
- pot = potegaLiczby2(N - 1);
- for (int i = pot; i < pot + pot; i++)
- WyrazyGraya[i] = pot + WyrazyGraya[pot + pot - i - 1];
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement