Answered step by step
Verified Expert Solution
Question
1 Approved Answer
BF 1 3 Di giv MySinglyList.h f wan klas as d n sho na di UML klas dayagram d ya . MiSinglyList we
BFDi giv MySinglyList.h f wan klas as dn sho na di UML klas dayagram d ya
MiSinglyList we a de du
sLL : Na wan wan List
MiSingliList
chkSt da : bool
addValuevalyu: dbul : void
insertNodeWithvalyu: dbul : void
muvLastNodeToBigin : Node
displayList : n gt nitin f du wit am
Ad wan ss fayl to yu prjek we dn kl MySinglyList.cpp n impruv l di mmba
fnshn depsi m akdin to di diskripshn we de dn:
a sLL na wan bjkt we gt tayp SinglyList.
ii MySinglyList na diflt knstrkta f initialize sLL bay we yu insay wan nmba f no dn insay am as
we de fala:
Insayt valyu to pozishn
Insayt valyu to pozishn
Insayt valyu to pozishn
Insayt valyu to pozishn
Afta dis, kl displayList fnshn f sho di list.
iii. checkSortedOrder na wan knstant mmba fnshn we de chk if di data na di sLL de insay
da we dn dn st da we de go p If na so i de kam bak tru, lay dasay
iv addValuedouble na mmba fnshn we de ad wan givn valyu to vri node data na sLL
v insertNodeWithdouble na mmba fnshn we de insay nyu node we gt di
valyu afta vri node na sLL we gt di valyu we dn gi
vi moveLastNodeToBegin na mmba fnshn we de ritn pynta to wan linked list we na di
rizulyt f muv di las node na sLL to di biginin f sLL Fgzampul if sLL gt
den we dn kl di fnshn wan pynta to di list we gt
n f kam bak. If sLL gt ziro wan node, di fnshn de kam bak
wan pynta to di list we n nid f mek ni chenj.
vii. displayList na mmba fnshn we de sho l di node dn na sLL
Kmplit di program insay C mek wan MySinglyList.cpp fayl n ndit di da fayl dn
Notis se yu ONLI ALAW f yuz isEmpty setHead getHead fnshn dn we dn gi na SinglyList klas.
main.cpp
#inklud we yu kin yuz
#include Mi SingliList.h
#inklud Nodeh
yuz nemsps std;
int men
cout ndl;
cout Knstrkshn f miSLL"" endl;
cout ndl;
MiSinglyList miSLL;
cout ndl;
cout ndl;
cout adValyu ndl;
cout
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started