by thunk · 17y ago · 0 comments
2) You frequently want to know the length of a subseq, and you frequently want successive subseq ranges to dovetail.
3) What in the world does rand() have to do with this?
2) Yes, but that has nothing to do with anything I wrote. Also calculating the length of a subset out of a 0 or 1 based array is the same, making your point completely irrelevant.
3) Where in the world do you read anything about rand()?
You really need to give up one of the possibilities, or use an extra bit.
The total number of items = maxint + 1
2) If you test the upper bound inclusively, then the upper bound of the previous subseq is not the lower bound of the next subseq.
3) I misinterpreted GP. Scratch that :)
2) Sorry, I don't have a clue what you mean. What's the difference between tests on subseqs from 0 or 1 based arrays?
Edit: When I say "test it inclusively" I mean when last==MAXINT you test i<=last rather than i<last+1. It's a special case.
2) I was assuming the upper bound in your 1-indexed array was inclusive, since it's necessary for your previous point. If that's the case, then when iterating over subseqs you can't just assign the previous upper bound to the next lower bound. That situation occurs frequently, and Dijkstra mentions it in the memo.