private static IEnumerable <int> Sets(Random rnd, ARRAY test) { for (var i = 0; i <= 32; i++) { var x = rnd.Next(); yield return(test.set(x)); Debug.Assert(test.get(x)); } }
public bool get(int Key) { int l, r, i; if (keyTemp != null) { l = 0; r = len; while (l != r - 1) { i = (l + r) / 2; if (keyTemp[i] < Key) { l = i; } else if (keyTemp[i] > Key) { r = i; } else { return(true); } } if (keyTemp[l] == Key) { return(true); } } if (keyLeft != null) { l = 0; r = len; while (l != r - 1) { i = (l + r) / 2; if (keyLeft[i] < Key) { l = i; } else if (keyLeft[i] > Key) { r = i; } else { return(true); } } if (keyLeft[l] == Key) { return(true); } } if (keyRight != null) { l = 0; r = len; while (l != r - 1) { i = (l + r) / 2; if (keyRight[i] < Key) { l = i; } else if (keyRight[i] > Key) { r = i; } else { return(true); } } if (keyRight[l] == Key) { return(true); } } return(nextLevel?.get(Key) ?? false); }