Initializacia
This commit is contained in:
parent
3f87d9c6ac
commit
05f7a22103
34
a4/program.c
Normal file
34
a4/program.c
Normal 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;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user