usaa24/a4/program.c

35 lines
558 B
C
Raw Normal View History

2024-11-19 14:23:54 +00:00
#include <stdlib.h>
#include <stdio.h>
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;
}