DEKLARASI NODE: struct Node { .... ____ ____; .... Node ____; }; int main(){ .... Node ____ = ____; .... return ____; } TAMBAH NODE DI AWAL: void addFirst(Node ____head, int ____){ .... Node ____nodeBaru = new Node; .... nodeBaru->____ = databaru; .... nodeBaru->____ = *head; .... *head = ____; } TAMBAH NODE DI AKHIR: void addLast(Node ____head, int databaru){ .... Node ____nodeBaru = ____ Node; .... nodeBaru -> data = ____; .... nodeBaru -> next = ____; .... // If linked list is empty: .... if (*head == NULL){ ........ *head = ____; ........ return; .... } .... // If not, then traverse to last node: .... Node ____ = ____; .... while (temp -> next ____ NULL){ ........ ____ = temp -> next .... }; .... temp -> next = nodeBaru; } TAMPILKAN LINKED LIST: void printList(struct Node ____){ ....____ (head ____ NULL){ ........ cout << "LinkedList masih kosong." << endl; ........ return; ....} .... ____ (head ____ NULL){ ........ cout << ____ -> ____ << " "; ........ head = head -> ____; .... } .... cout << endl; } HAPUS NODE AWAL: void ____(Node ____head){ .... if (head == NULL){ ........ cout << "LinkedList masih kosong." << endl; ........ return; .... } .... ____head = ____ -> ____; .... } HAPUS NODE AKHIR: void ____(Node ____head){ .... if (head == NULL){ ........ cout << "LinkedList masih kosong." << endl; ........ return; .... } .... if ((____) -> next ____ NULL){ ........ *head = NULL; ........ return; .... } .... Node ____ = ____head; .... while (____ ____ NULL){ ........ ____ = ____; .... } .... temp -> next = NULL; } UBAH NODE: void ubahData(Node **head){ .... if (*head == NULL){ ........ cout << "LinkedList masih kosong" << endl; ........ return; .... } .... int angkaYangMauDiganti; .... cout << "Masukan data yang akan diubah : "; cin >> angkaYangMauDiganti; .... Node ____ = ____; .... while (____ ____ ____){ ........ if (temp -> data ____ angkaYangMauDiganti){ ............ cout << "Masukan data yang baru : "; ............ cin >> ____; ............ cout << "Data berhasil diubah" << endl; ............ return; ........ } ........ temp = ____; .... } .... cout << "Angka yang Anda ingin ubah tidak ditemukan." << endl; }
0%
Node: Declaration, Show, Add, Edit, and Remove
共享
共享
共享
由
Superfai700
Perguruan Tinggi
编辑内容
打印
嵌入
更多
作业
排行榜
显示更多
显示更少
此排行榜当前是私人享有。单击
,共享
使其公开。
资源所有者已禁用此排行榜。
此排行榜被禁用,因为您的选择与资源所有者不同。
还原选项
完成句子
是一个开放式模板。它不会为排行榜生成分数。
需要登录
视觉风格
字体
需要订阅
选项
切换模板
显示所有
播放活动时将显示更多格式。
打开成绩
复制链接
QR 代码
删除
恢复自动保存:
?