determine if the predecessor's left or right pointer is to point to the new node and set it
if(left(q) == p)
setleft(q,ptr);
else