1. Specifications In addition to the universal quantifier (Vx:x E A^p(x)) and the existential quantifier (3x:x € A^p(x))
Posted: Tue Jul 05, 2022 10:34 am
1. Specifications In addition to the universal quantifier (Vx:x E A^p(x)) and the existential quantifier (3x:x € A^p(x)), there exists a numeric quantifier (#x: x E A^p(x)), which counts the number of distinct elements of A that satisfy the predicate p(x). Examples: ● ● (#x: x E {1,2,3,4,5,6} x mod 2 = 0) = 3. x mod 3 = 0) = 2. (#x: x E {1,2,3,4,5,6} (#x: x € {1,2,3,4,5,6} x mod 4 = 0) = 1. Given an array A[1..N] of integers and an integer variable x and an index variable k, place in x a median of array A and in k a median index where x appears in A. The median of a set of number is a number such that the difference between number of elements that are greater than it and those that are less than it does not exceed 1.