Count Occurrence

This algorithm is often used for counting data items in an array which match a certain condition, for example counting a number of exam passes/different grades or counting the number of ‘yes’ responses when processing questionnaire data.

Example in Pseudocode

Example in Python