|
|
|
|
|
by webshit2
1126 days ago
|
|
Idk typing +1 seems easy enough... 1:N == union(1:(N÷2), (N÷2+1):N). But really, these discussions are funny to me - each side pretending their convention is how God intended indexing to be done. You see it's naturally composable because N/2 shows up twice, which is really the perfect amount of times to show up, and as you recall I just defined composable in that way (not to mention it matches the fact that N/2 occurs twice in [0, N)!) |
|
In Python (C, C++ with whole STL) you could split in the middle, or at any M
[0...N)=[0...M)+[M...N)
You could split it k times at any boundaries, still
[0...N)=[0...M1)+...+[Mk...N)
Another important thing is that number of elements to process is exactly the difference between last and first index of the range
https://www.cs.utexas.edu/users/EWD/ewd08xx/EWD831.PDF