Initializacia

This commit is contained in:
Anton 2024-11-19 15:23:54 +01:00
parent 3f87d9c6ac
commit 05f7a22103

34
a4/program.c Normal file
View File

@ -0,0 +1,34 @@
#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;
}