In finding the closest pair of points in O(nlgn) time, the pseudocode for splitting a sorted list into two sorted lists (CLRS 3rd ed pg 1043) is said to run in O(n) time.

However, this assumes that line 4 runs in constant time, which I find hard to believe (I'd assume it runs in O(lgn) time if it were stored as a binary tree, giving a total running time of O(nlgn).
Y is a sorted array, YL and YR are the two new sub-arrays. PL is a subset of Y in random order, and YL is the same subset, but in sorted order.
Where am I going wrong with my reasoning?
I don't know how it is supposed to work in the book, but thinking about the way the algorithm looks like, you can come up with the following idea:
Y[i],X[i],YL[i],XL[i],YR[i]andXR[i]are integers, corresponding to the index of theith-point (so you just have to store some global array which, given the index, returns thexorycoordinate).PL[i]is a boolean,trueif thei-th point is in the left part,falseotherwise.At each recursion step, you can compute
PL[i]usingycoordinates (O(n)time). Then you separate the set of points in two sets "left" and "right" using the algorithm from the book, replacing the lineif Y[i] in PLbyif PL[Y[i]](such access isO(1), so in overall we getO(n)).This has
O(n)time complexity and usesO(n)memory.Thus the closest pair problem is solved that way in
T(n) = O(n log n).