Logical Programming Problem

Posted by user353060 on Stack Overflow See other posts from Stack Overflow or by user353060
Published on 2010-06-07T16:37:30Z Indexed on 2010/06/07 16:42 UTC
Read the original article Hit count: 195

Filed under:

Hello,

I've been trying to solve this problem for quite sometime but I am having trouble with it.

Let's say on a trigger, you receive values.

First trigger: You get 1 
Second trigger: You get 1, 2
Third trigger: You get 1, 2, 3

So, I store 1. For 2nd trigger, I store 2 since 1 already exist. For 3rd trigger, I store 3 since 1,2 already exist

so in total I have stored 1,2,3

As you can see, we can easily check for new values, if old != new.

Here's come the problem:

Fourth trigger: You get 1, 2, 4

For 4th trigger, I store 1, 2 because it exists but how do I check against 3 and remove 3 from store and check if 4 is new?

If you are having problems understanding this, feel free to clarify. Thanks!

© Stack Overflow or respective owner

Related posts about c++