CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com

# Search:

Type: Posts; User: wolle

1. ## Thread: How exactly does recursion work with iterators?

by wolle
Replies
20
Views
2,947

### Re: How exactly does recursion work with iterators?

My point was that even if it doesn't make any difference for the logic of my code whether I pass by value or by const reference, C++ still forces me to make a performance consideration when deciding...
2. ## Thread: How exactly does recursion work with iterators?

by wolle
Replies
20
Views
2,947

### Re: How exactly does recursion work with iterators?

I used the term "urn" because this problem reminded me of the so called Urn problems I struggled with when studying basic probability theory a long time ago,
...
3. ## Thread: How exactly does recursion work with iterators?

by wolle
Replies
20
Views
2,947

### Re: How exactly does recursion work with iterators?

To pass pair<int> by value throughout the code was an active choice (but maybe I should've motivated it).

I use this rule of thumb: Pass primitives by value (including anything that doesn't cost...
4. ## Thread: How exactly does recursion work with iterators?

by wolle
Replies
20
Views
2,947

### Re: How exactly does recursion work with iterators?

I've cleaned up my solution in #10. It turns out that the second part of the solution strategy isn't necessary. Once it's known how many astronauts there are in an urn it's possible to calculate how...
5. ## Thread: How exactly does recursion work with iterators?

by wolle
Replies
20
Views
2,947

### Re: How exactly does recursion work with iterators?

Several of my lambdas aren't strictly necessary. For example also pop_stack() and remove_pair() are both called from one place only. I do this for the reason of abstraction. If I were to tidy up the...
6. ## Thread: How exactly does recursion work with iterators?

by wolle
Replies
20
Views
2,947

### Re: How exactly does recursion work with iterators?

I've come up with a solution now according to the strategy in my post #4. The test cases from the problem description work but I would need more to be sure.

The first part of the algorithm (the...
7. ## Thread: How exactly does recursion work with iterators?

by wolle
Replies
20
Views
2,947

### Re: How exactly does recursion work with iterators?

So do I and that's why I'm tempted to give it a go. :)

I would appreciate if you would post the 70-pairs test case.
8. ## Thread: How exactly does recursion work with iterators?

by wolle
Replies
20
Views
2,947

### Re: How exactly does recursion work with iterators?

That link didn't work if you're not a member of hackerrank but this one seems to do,

https://www.hackerrank.com/challenges/journey-to-the-moon/problem

A pair of astronauts can be viewed as a...
9. ## Thread: How exactly does recursion work with iterators?

by wolle
Replies
20
Views
2,947

### Re: How exactly does recursion work with iterators?

Without looking at your code, you most likely are changing a data structure while iterating over it.

This is consistent with your bug description; The code works for smaller cases because then...
Results 1 to 9 of 9