Devise an algorithm in Python that takes an array and returns a histogram of the occurrences of each element in the array.
[1, 2, 1, 2, 3, 1, 3, 3]
def histogram(arr):
    hist = {}
    for num in arr:
        if num in hist:
            hist[num] += 1
        else:
            hist[num] = 1
    return hist