//单链表 void ExchangeNear( List L, Position PosBefoP ) { Position PosL,PosR; PosL = PosBefoP->Next; PosR = PosL->Next; PosL->Next = PosR->Next; PosR->Next = PosL; PosBefoP->Next = PosR; } //双链表 void ExchangeNear( Position PosBefoP, List L ) { Position P,PosAfteP; P = PosBefoP->Next; PosAfteP = P->Next; P->Next = PosAfteP->Next; P->front = PosAfteP; PosAfteP->Next = P; PosAfteP->front = PosBefoP; PosBefoP->Next = PosAfteP; }
时间: 2024-09-29 07:58:05