//编写查找一个单链表特定元素的函数 递归 Position FindEle( ElementType X, List L ) { Position p; p = L->Next; if( p != NULL && p->Ele != X ) return FindEle(X,p); return p; } //非递归实现 Position FindEle( ElementType X, List L ) { Position p; p = L->Next; while( p != NULL && p->Ele != X ) p = p->Next; return p; }
时间: 2024-10-06 22:54:43