class link
public void displaylink() ");}}
class linklist
//在表頭插入資料
public void insertfirst(int id,double dd)
//查詢包含指定關鍵字的鍊錶結點,時間複雜度為o(n)
public link find(int key) else }}
return current;
//查詢包含指定關鍵字的鍊錶結點,時間複雜度為o(n)
public link find(double key) else }}
return current;
}//刪除指定某個鏈結點,時間複雜度為o(n)
public link delete(int key) else
}if(current==first) else
return current;
}//輸出鍊錶
public void displaylist()
system.out.println();
}public static void main(string args) else
link d=thelist.delete(25);
if(d!=null) else
thelist.displaylist();}}
單鏈表基本操作
include include include include includeusing namespace std typedef struct node node,plinklist plinklist createfromhead node pstnode node malloc sizeof...
單鏈表基本操作
單鏈表的初始化,建立,插入,查詢,刪除。author wang yong date 2010.8.19 include include typedef int elemtype 定義結點型別 typedef struct node node,linkedlist 單鏈表的初始化 linkedlist...
單鏈表基本操作
include using namespace std define namelenth 20 define ok 0 define error 1 typedef struct flagnode node 生成結點 inline node newnode 銷毀化煉表 void destroylin...