有人可以告訴檢查鏈表大小的代碼是什麼(節點數)。這就是我的代碼(插入和刪除所有節點的頭+信息)C++函數鏈表大小
struct node
{
int info;
node *nextptr;
};
class list
{
private:
node *L,*tail;
int count;
public:
list()
{
L=tail=NULL;
count=0;
}
void InsertHead(int info);
int RemoveHead();
void Print();
};
爲'count'創建一個getter? – NullUserException 2010-10-13 23:46:32
你必須給我們更多的信息 - 函數的實現是什麼?此外,你有什麼嘗試,你有什麼具體的麻煩? – Eclipse 2010-10-13 23:47:23