Skip to main content

Practice · 2 of 2

List Algorithms

CHALLENGE
Difficulty: intermediate+25 XP

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); ``

Back to lesson: Practice: Singly List Gym