Create a new file called 'poggers.c' and copy the starter code here into it.
An list is poggers if every node matches the following criteria:
Implement the listIsPoggers
function in listIsPoggers.c
to return true if the input list is poggers, and false otherwise.
But we have a problem, our computer is a tsundere and doesn't want you to use any loops at all!
So, we must implement listIsPoggers
without any loops. Though you are free to make any extra functions you want (provided they also do not contain loops). For this exercise though, extra functions should not be necessary!
The output from your program should look exactly like this:
$ gcc listIsPoggers.c -o listIsPoggers
$ ./listIsPoggers
Enter list size: 5
Enter list values: 3 2 3 2 3
List: [3, 2, 3, 2, 3]
POGGERS POGU POG
$ ./listIsPoggers
Enter list size: 0
List: []
POGGERS POGU POG
$ ./listIsPoggers
Enter list size: 5
Enter list values: 3 2 3 2 1
List: [3, 2, 3, 2, 1]
NOT POG
$ ./listIsPoggers
Enter list size: 9
Enter list values: 2 4 8 9 3 -5 -6 -4 0
List: [2, 4, 8, 9, 3, -5, -6, -4, 0]
POGGERS POGU POG
We may trivially say that an empty list or a list with a singular node is poggers.
Assuming the sublist from list->next onwards is poggers, what can we say about the requirement(s) for our list onwards to be poggers?
If the sublist from list->next onwards is poggers, then we know that we only need to check conditions between list->value and list->next->value.
You can view the solution code to this problem here.