单链表


filter: 0; fileterIntensity: 0.0; filterMask: 0; captureOrientation: 90; niceRunStatus: 0; shaking: 0.0; highlight: false; algolist: 0; multi-frame: 1; brp_mask:0; brp_del_th:0.0000,0.0000; brp_del_sen:0.0000,0.0000; motionLevel: 0; delta:null; module: photo;hw-remosaic: false;touch: (0.7038094, 0.15773809);sceneMode: 12582912;cct_value: 0;AI_Scene: (-1, -1);aec_lux: 0.0;aec_lux_index: 0;HdrStatus: auto;albedo: ;confidence: ;weatherinfo: weather???, icon:1, weatherInfo:102;temperature: 34;

单链表的遍历操作:

void printLink(struct Node* head)
{
struct Node 8p;
p = head;
while (p != NULL)
{
PRINTF(“%D”, P->DATA);
P = P->NEXT;
}
}

单链表的查找操作:

struct Node* seekLink(struct Node* head, int x)
{
struct Node* p = head;
while (p != NULL && p->data != x)
p = p->next;
return p;
}

单链表的结点删除:

p->next=q->next;

free(q);

单链表的删除操作:

void freeLink(struct Node*head)

{

struct Node*p;

while (head!=NULL)

{

p=head;

head=head->next;

free(p);

}

}


發佈留言

發佈留言必須填寫的電子郵件地址不會公開。 必填欄位標示為 *