c++ recursion help -


I have trouble with recurring, can anyone show me how to get it as a code?

given vector & lt; Int & gt; with value 1,2,3,4,5, ..

I want to write a function that compares all the values ​​with each other, I 1! = 2 is equal to 2! = 1 is not about for now!

I am very bad on recurring

and I promise that it is not homework

EDIT What am I trying to do, solving the events of a schedule I have many incidents on the same day and I want to understand all the permutations of the schedule

Loop is not working for 2 nested Because I compare many (& gt; 2) values ​​

  event 1 @ 0100-0230, or @ 0200-0330, event2 @ 1200-1500, y Do @ 0800-1100 Event3 @ 1200-1300, or @ 1300-1400, or @ 1400-1500 . For each comparison,   

, I have to figure out whether the set of events pierces each other. I am not trying to find a set of events which do not have to be pierced by all

let me output an output such as

  event 1 @ 0100-2300, event2 @ 0800 Receive -1100, event 3 @ 1200-1300 // Event 2 will be printed @ 0200-0330, event 2 @ 1200-1500, event 3 @ 1200-1300 // will not be ignored  < / P> 

I think you are checking the relationship between recycling and iterative. Generally, the simple moving transition is transformed into recycling - recursive type recursive calls, where recursive calls are the last thing, so there is no need for a deep pile.

It is a bit of a pseudo-angle, plus it has not been tested - but this should work.

  Compare to zero one (compare int, iterator b, itater e) {if (b == e) returns; If (compare == * b) {// do something} compare one (compare, B + 1, E); } Zero comparison all (ifer b, itater e) {if (b == e) returns; Comparison of one (* B, B + 1, E); Compare all (B + 1, E); }    

Comments