Describe a nonrecursive algorithm that takes a list of disti
     Describe a non-recursive algorithm that takes a list of distinct integers a_1, a_2, ..., a_n and determines whether they are all even numbers. That is, your algorithm should return True if a_1, a_2, ..., a_n are all even, and FALSE if at least one is not even. Write your answer in pseudo-code or any well-known procedural language like Python, Java, C++, .... You may assume that a function \"x is even\" has been defined, where \"x is even\" applied to an even integer returns TRUE and \"x is even\" applied to an odd integer returns FALSE. procedure All Even?(a_1, a_2, ..., a_e: integers) Describe a recursive algorithm that takes a list L of distinct integers and determines whether they are all even numbers. That is. your algorithm should return TRUE if L contains only even numbers, and FALSE if it contains some number that is not even. Note that the empty list does not contain any odd numbers, so your algorithm should return TRUE for the empty list. Write your answer in pseudo-code or any well known procedural language like Python. Java. C++, .... In addition to the \"even?\" function above, you may assume that you have three functions that work on lists: \"x is empty\" which returns TRUE if a given list is empty, FALSE otherwise \"first of L\" which returns the first element of a given nonempty list. \"rest of L\" which returns a list containing all but the first element of a given nonempty list. Note that if the list has only one element, \"rest\" will return the empty list. procedure All_Even?(L: list of integers) 
  
  Solution
2. a.
procedure x_is_even(x: integer)
if x % 2 == 0:
return true;
return false;
procedure All_Even?(L: a1, a2, ... , an: integers)
for i := 1 to n //For each value in the array.
if !x_is_even(ai) //If the value is not even.
return false; //Return false.
return true; //If every value in the loop is even, then, return true.
And the C++ code for you is:
#include <iostream>
 using namespace std;
 bool xIsEven(int x)
 {
 return x % 2;
 }
 bool All_Even(int a[], int length)
 {
 for(int i = 0; i < length; i++)
 if(!xIsEven(a[i]))
 return false;
 return true;
 }

