Timeline for Union, Intersection and Diff of two sorted arrays in C#
Current License: CC BY-SA 4.0
5 events
when toggle format | what | by | license | comment | |
---|---|---|---|---|---|
Jul 25, 2019 at 12:13 | vote | accept | Gilad | ||
Jul 5, 2019 at 20:25 | comment | added | Pieter Witvoet |
@dfhwze: personally I find the longer variant a bit easier to read so that's how I would write it, but in both cases the relationship with arr1 is clear, so I'd be fine with either.
|
|
Jul 5, 2019 at 19:59 | comment | added | dfhwze | Would you allow names as i1, i2, n1, n2 or prefer the longer names as mentioned in your answer? | |
Jul 5, 2019 at 19:26 | comment | added | VisualMelon | Regarding the first and last points, the attempts at optimising could well go wrong if it messes with the CLR. It used to be the case, for example, and cycling forward through an array was faster than backward because the optimiser would remove redundant bound checks: any additional indirection (e.g. stuffing lengths in variables) might break this. As you say: only do it if you know it is a problem and it shows an improvement upon (realistic) measurement. | |
Jul 5, 2019 at 19:15 | history | answered | Pieter Witvoet | CC BY-SA 4.0 |