One major error was to have T& temp = array[0]; then temp = array[i] . If temp is a reference, then temp = array[i] does not change temp to reference the other element, but rather changes array[0] to that, as if you had written array[0] = array[i]
The other major error was to have T temp = array[0]; then temp = array[i] and return temp at the end. Now temp is a copy of array[i] and you are returning a reference to that local variable.
The correct way was to just track an index and then at the end return array[min_index];
| Time | Monday | Wednesday | Friday |
| 12:00-12:10 | GK | TC | |
| 12:10-12:20 | LS | XL | |
| 12:20-12:30 | DC | TS | |
| 12:30-12:40 | RF | AM | |
| 12:40-12:50 | IH | AV | |
| 12:50-1:00 | MW | SR |