Post Reply 
Programming puzzles: processing lists!
08-20-2017, 08:44 AM
Post: #200
RE: Programming puzzles: processing lists!
(08-20-2017 06:18 AM)pier4r Wrote:  Did you confirm/sort of prove that your approach is the correct one?

We need to show two things: all possibilities are generated and no possibility is generated twice. My reasoning for believing that this is indeed the case is summarized as follows:-

At each stage of the recursion we gather together all possibilities for a partner to the first element of the list, so I think we can be sure that all possibilities are generated.

Also, at each stage of recursion, we remove the partnered pair from the list supplied to the next stage. So as long as each partnered pair is associated with only one recursive invocation then we can be sure that no duplicate match-pairings will be generated.

Hope this makes sense!

Visit this user's website Find all posts by this user
Quote this message in a reply
Post Reply 

Messages In This Thread
RE: Programming puzzles: processing lists! - pdo - 08-20-2017 08:44 AM

User(s) browsing this thread: 1 Guest(s)