数据结构:单链表的逆转

伪代码实现单链表逆序输出(1-k逆序)

ElementType Pop(LinkStack *S)
{
    struct Node * FisrtCell;
    ElementType TopElem;
    if (IsEmpty(S)){
        printf("堆栈空"); return NULL;
    }else {
        FirstCell = S->Next;
        S->Next = FirstCell->Next;
        TopElem = FirstCell->Data;
        free(FirstCell);
        return TopElem;
}


猜你喜欢

转载自blog.csdn.net/qq_30207251/article/details/80595774
今日推荐