I tried coding these lines:
copy the first {ceiling of} n/2 points of P to array Pleft
copy the same {ceiling of} n/2 points from Q to array Qleft
copy the remaining {floor of} n/2 points of P to array Pright
copy the same {floor of} n/2 points from Q to array Qright
m = P[ ({ceiling of} n/2) - 1].x
And I got:
mid = len(P) / 2
Pl = P[:mid]
Ql = Q[:mid]
Pr = P[mid:]
Qr = Q[mid:]
m = P[:mid - 1].x
But I do not know how to code this line:
copy all the points of array Q for which |x - m| < d into new array S[0..num - 1]
Please help.
math.abs()and list comprehensions (or a simple for-loop) for this.midwithout using it. It can only hold one value.