Create a C program that tests whether two sequences of positive numbers are order equivalent.

Two sequences a and b are order equivalent if they have the same number of elements and they both contain less than two numbers or if for all i, j, 1 <= i, j <= n, where n is the length of a sequence a[i] <= a[j] if and only if b[i] <= b[j].

Examples of order equivalent sequences:

7 5 9 13 12 and 4 2 25 33 26
12 and 8

The program must accept the two sequences with no separator between the two. If the number of numbers accepted is n, the first n/2 numbers are assumed to be in the first sequence and the rest form the second sequence. The program must then check that for order equivalence and must print the result. You can assume that the maximum size of the two sequences is 100. You can also use 0 or any negative number to mark the end of the sequence.

Please remember to organize the code as below:

  • Have two functions besides main:
    • one that accepts the two sequences and
    • the other that checks for order equivalence and returns an integer depending on the test
  • The main function prints the message for the user.
  • You cannot use any global variables.
  • Look at the sample program int_array.c (posted at the D2L site) to see how to perform read/write operations on arrays.
Academic Honesty!
It is not our intention to break the school's academic policy. Projects posted are only used as a reference and should not be submitted as is. We are not held liable for any misuse of the solutions. Please see the frequently asked questions page for further questions and inquiries.
Kindly fill out the form. Please provide a valid email address and we'll get back to you in less than 24 hours. We will be sending an invoice through PayPal upon confirmation. We are a non profit organization however we need an amount to keep this organization running, and to be able to complete our research and development.