단일 체인 테이블의 역방향 인쇄, 머리 없는 비끝 노드 삭제, 머리 없는 체인 테이블 삽입 노드, 요셉 링
//1、 ( )
void PrintTailToHead(ListNode *pHead)
{
ListNode *cur = pHead;
if(cur != NULL)
{
PrintTailToHead(cur->_next);
printf( "%d ",cur->_data);
}
}
//2、
void DelNoTail(ListNode *pos)
{
assert(pos && pos->_next );
ListNode *next = pos->_next ;
swap(pos->_data ,next->_data );
pos->_next = next->_next ;
free(next);
}
//3、
void InsertNoHead(ListNode * pos, DataType x)
{
ListNode *tmp = BuyNode(pos->_data );
tmp->_next = pos->_next;
pos->_next = tmp;
pos->_data = x;
}
//4、 ( )
ListNode* Josephuscycle(ListNode *pHead, DataType x)
{
ListNode *cur = pHead;
while(1)
{
if(cur = cur->_next )
{
return cur;
}
DataType m = x;
while(--x)
{
cur = cur->_next ;
}
ListNode *next = cur->_next ;
swap(cur->_data ,next->_data);
cur->_next = next->_next ;
free(next);
}
}
이 내용에 흥미가 있습니까?
현재 기사가 여러분의 문제를 해결하지 못하는 경우 AI 엔진은 머신러닝 분석(스마트 모델이 방금 만들어져 부정확한 경우가 있을 수 있음)을 통해 가장 유사한 기사를 추천합니다:
[면접대비 예상꼬리질문] 프론트엔드 개발자 취업 면접 질문 총정리 (장문, 꼬리에꼬리를 무는 질문 포함)웹 통신/네트워크 관련 HTTP가 뭔가요? (😒)HTTP의 동작 방식에 대해서 알려주세요. HTTP 요청 메서드에 대해서 알려주고 어떤 역할을 하는 지 알려주세요. HTTP와 WebSocket은 어떤 차이점이 있죠?...
텍스트를 자유롭게 공유하거나 복사할 수 있습니다.하지만 이 문서의 URL은 참조 URL로 남겨 두십시오.
CC BY-SA 2.5, CC BY-SA 3.0 및 CC BY-SA 4.0에 따라 라이센스가 부여됩니다.