diff --git a/a4/program.c b/a4/program.c new file mode 100644 index 0000000..899e543 --- /dev/null +++ b/a4/program.c @@ -0,0 +1,34 @@ +#include +#include + +int is_heap(int* arr, int size ){ + for(int i = 0; i < size; i++){ + int l = i * 2 + 1; + int r = i * 2 + 2; + } + + if (left < size && arr[i] < arr[left]){ + return 0; + } + + if (right < size && arr[i] < arr[right]){ + return 0; + } + return 1; +} + +int main() { + int arr[] = 100; + int size = 0; + + while (scanf("%d", &num) != EOF){ + arr[size++] = num; + } + + if (!is_heap(arr, size)){ + printf("Nie je kopa."); + } + + return 0; +} +