数据结构算法设计

/*一、统计出单链表HL中节点的值等于给定值X的节点数*/ int CountX(LNode* HL,ElemType x) int CountX(LNode* HL,ElemType x) { int i=0; LNode* p=HL; //i为计数器 while(p!=NULL) { if(P->data==x) i++; p=p->next; }//while,出循环时i中的值即为x节点
相关文章
相关标签/搜索