Practice ยท 2 of 2
List Algorithms
Extend the list with the classic interview algorithms:
``c
/* reverses the list in place; head updated through the pointer */
void s_reverse(SNode **head);
/* returns the middle node's value; for even lengths returns the
FIRST of the two middles; -1 if empty. Does not modify the list. */
int s_middle(const SNode *head);
/* returns 1 if the list's values are in nondecreasing order */
int s_is_sorted(const SNode *head);
/* removes every node whose value equals v (possibly many) */
void s_remove_all(SNode **head, int v);
``
Difficulty: intermediate
Press Submit to check your solution.
Back to lesson: Practice: Singly List Gym