There's a trick that is often used to build Huffman trees in practice:
Create a list of your symbols with probabilities, and sort it in ascending order
Create an initially empty list for combined symbols. This will remain sorted as we work.
While there is more than one symbol in the lists:
- Remove the two smallest symbols from the beginnings of two lists
- Combine them and add them to the end of the combined list. Because the new symbol has a higher combined probability than any combined symbol created before, this list remains sorted.
After the initial sorting, the smallest probability symbol will always be the first one of one of the two lists, so no priority queues or searching is required to find it.
This technique is quite clever, and your lecturer would not expect you to think of it yourself, so it was probably taught or referenced in class.