From 4be28cc81c145cbd7a7c960e38b015408db7ec39 Mon Sep 17 00:00:00 2001 From: hassanrizky <59947467+hassanrizky@users.noreply.github.com> Date: Thu, 6 Feb 2020 10:07:55 -0800 Subject: [PATCH 1/4] Update operation.cpp 1301190328 / IF-4305 --- operation.cpp | 20 +++++++++++++++++--- 1 file changed, 17 insertions(+), 3 deletions(-) diff --git a/operation.cpp b/operation.cpp index 0a0e067..f0fad53 100644 --- a/operation.cpp +++ b/operation.cpp @@ -13,8 +13,22 @@ 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,P,Q); + } + } //---------------------------------------- + } } From ce188d32f5bb2d9edeb72ac10c460ae8e7d32e4c Mon Sep 17 00:00:00 2001 From: hassanrizky <59947467+hassanrizky@users.noreply.github.com> Date: Thu, 6 Feb 2020 10:09:57 -0800 Subject: [PATCH 2/4] Update list.h 1301190328 / IF-43-05 --- list.h | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/list.h b/list.h index d021225..be28827 100644 --- a/list.h +++ b/list.h @@ -30,14 +30,14 @@ typedef struct elmlist *address; struct elmlist{ //------------- your code here ----------- - - + infotype info; + address next; //---------------------------------------- }; struct List{ //------------- your code here ----------- - + address first; //---------------------------------------- }; From a7952b5e242f2ac20f716c1c0367ee342732f3b6 Mon Sep 17 00:00:00 2001 From: hassanrizky <59947467+hassanrizky@users.noreply.github.com> Date: Thu, 6 Feb 2020 10:11:01 -0800 Subject: [PATCH 3/4] Update list.cpp 1301190328 / IF-43-05 --- list.cpp | 82 ++++++++++++++++++++++++++++++-------------------------- 1 file changed, 44 insertions(+), 38 deletions(-) diff --git a/list.cpp b/list.cpp index f61d73d..ed94004 100644 --- a/list.cpp +++ b/list.cpp @@ -5,9 +5,7 @@ void createList(List &L) { * FS : set first(L) with Null */ //-------------your code here------------- - cout<<"your code here"< Date: Thu, 6 Feb 2020 10:12:39 -0800 Subject: [PATCH 4/4] Update Main.cpp 1301190328 / IF-43-05 --- Main.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Main.cpp b/Main.cpp index 297d6ca..79a5b98 100644 --- a/Main.cpp +++ b/Main.cpp @@ -34,7 +34,7 @@ int main() { //================================================== // TEST INSERT AFTER P = findElm(L, 6); - insertLast(L, allocate(5)); + insertAfter(L,P, allocate(5)); printInfo(L); cout<<"output should be: 8, 3, 6, 5, 4, 2,"<