1. A method for processing an input sequence of elements for comparison with a predetermined set of sequences of a predetermined set of elements, comprising the steps of: (a) applying the input sequence of elements to an input of an associative memory comprising a neural network; (b) obtaining an associated output sequence of elements from the associative memory; (c) evaluating each element of the associated output sequence of elements to determine whether each element is a member of the predetermined set of elements; (d) improving the energy function of the neural network in response to a determination that an element is not in the predetermined set of elements; (e) repeating the steps of applying and evaluating in response to a determination that an element is not in the predetermined set, applying the element as the input to the associative memory; (f) evaluating the associated output sequence of elements to determine whether the associated output sequence is a member of the predetermined set of sequences; (g) improving the energy function of the neural network in response to a determination that the associated sequence is not in the predetermined set of sequences; and (h) repeating the step of applying and the steps of and evaluating in response to a determination that the associated sequence is not in the predetermined set of sequences, applying the input sequence of elements to the associated memory.