A singly linked list is:
$\texttt{5 -> 8 -> 20 -> 9 -> 20 -> 7 -> NULL}$
The function $\texttt{deleteByValue(L, val)}$ removes only the first node whose data is equal to $\texttt{val}$. It adjusts links and frees the removed node.
After calling:
$\texttt{deleteByValue(L, 20);}$
what will be the final linked list?
- $\texttt{5 -> 8 -> 9 -> 20 -> 7 -> NULL}$
- $\texttt{5 -> 8 -> 9 -> 7 -> NULL}$
- $\texttt{8 -> 20 -> 9 -> 20 -> 7 -> NULL}$
- $\texttt{5 -> 8 -> 20 -> 9 -> 7 -> NULL}$