The transition function is now with constant time complexity O(1)