From 755b539b6b4f59853e14f2ac5f3fc7fdd763db5b Mon Sep 17 00:00:00 2001 From: GhifariADR <59873588+GhifariADR@users.noreply.github.com> Date: Sat, 8 Feb 2020 12:57:37 +0700 Subject: [PATCH 1/3] Update list.cpp --- list.cpp | 51 +++++++++++++++++++++++++++++++++++++++++++++------ 1 file changed, 45 insertions(+), 6 deletions(-) diff --git a/list.cpp b/list.cpp index f61d73d..7784de3 100644 --- a/list.cpp +++ b/list.cpp @@ -6,7 +6,7 @@ void createList(List &L) { */ //-------------your code here------------- cout<<"your code here"< Date: Sat, 8 Feb 2020 12:57:41 +0700 Subject: [PATCH 2/3] Update list.h --- list.h | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/list.h b/list.h index d021225..6ab74e9 100644 --- a/list.h +++ b/list.h @@ -30,6 +30,9 @@ typedef struct elmlist *address; struct elmlist{ //------------- your code here ----------- + infotype info; + address next; + //---------------------------------------- @@ -37,6 +40,7 @@ struct elmlist{ struct List{ //------------- your code here ----------- + address first; //---------------------------------------- }; From 1ff2304c1ad1242ecd26e15e9f14931508e54066 Mon Sep 17 00:00:00 2001 From: GhifariADR <59873588+GhifariADR@users.noreply.github.com> Date: Sat, 8 Feb 2020 12:57:46 +0700 Subject: [PATCH 3/3] Update operation.cpp --- operation.cpp | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/operation.cpp b/operation.cpp index 0a0e067..a18282e 100644 --- a/operation.cpp +++ b/operation.cpp @@ -14,6 +14,23 @@ void insert_sorted(List &L, infotype x) { //-------------your code here------------- cout<<"your code here"< info(next(Q)))){ + Q = next(Q); + if (next(Q) == NULL){ + P = allocate(x); + insertLast(L,P); + }else if (info(P)!=info(Q)){ + P = allocate(x); + insertAfter(L,Q,P); + } + } + } //----------------------------------------