# Challenge A

In you google web site create New Section Year 2017/2018 / Semester 1 / Topic 4

Challenge : Create an array : $NumberSort = [0,5,9,6,4,3,2,] Then develop 3 separate programs in PHP to process as follows upload the code and output to your web blog under Topic 4 with label Array processing.

1 Loop thru the array and print out the numbers and message this array is not sorted

2 Loop thru the array and find largest and print out the largest number with the message Found largest

3 Loop thru the array record the max and min at end of loop print out max / min and the range ( diff between max and min)

# Challenge B

Write an algorithm that finds the two neighboring numbers in an array with the smallest distance to each other. The program should output the distance, index of the first number and the index of the second number. For example, in the array A = [5 , 1 , 4 , 7 , 9 , —12] the minimum distance is 2 (between array element 3 and 4). This algorithm should return: distance 2 between element 3 and element 4.

Useful Information: In this problem the use of a function that returns the absolute ‘. value of a number is essential. According to the IBO document Pseudo code in : Examinations, Standard Data Structures and Examples of Pseudo code: “If such a E specialized method is to be used in an examination, it will be fully specified as part of : the question in which it is needed."

First lines of code to get started ( try writing in pseudo code first )

$A = [5,1,2,7,9,-12];

$SIZE = 6;

$MINIMUM = (abs($A[0] - $A[1]));

$MININDEX = 0;