I have a list that I want to reduce to a smaller list by grouping identical neighbors. This list has many many redundant entries.
Is there an algorithm for doing this that is faster than O(n)? In other words, faster than just looking at the next neighbor?
while (1) n = 0, m = 1 if (list[n] == list[m]) remove list[m] else n = m m = m + 1 if (m > list.size) break
If not, what about this problem makes it O(n)?