For example: A=[1,2,2,3,4,4,5]->true; A=[1,2,2,3,3,3,4,4,4,4]->false.
proc(A){
list = newList()
for (i=1 to length[A]) {
occ = 0
n = a[i]
for (j = 1 to length[A]) {
if(a[j] == n)
occ++
}
list.append(occ)
}
but dosen't work because in the list will be repeated elements.I thought about using an algorithm similar to countingSort but I don't know the length of the support vector.
Any help? In pseudocode will be fine. Thank you.