代写 R math graph

TOC o 11 h z t 2,2,3,3 HYPERLINK l Toc28873150 PAGEREF Toc28873150 h 4
HYPERLINK l Toc28873151 1. PAGEREF Toc28873151 h 4
HYPERLINK l Toc28873152 1 PAGEREF Toc28873152 h 4
HYPERLINK l Toc28873153 2 PAGEREF Toc28873153 h 4
HYPERLINK l Toc28873154 2. PAGEREF Toc28873154 h 4
HYPERLINK l Toc28873155 1 PAGEREF Toc28873155 h 4
HYPERLINK l Toc28873156 2 PAGEREF Toc28873156 h 5
HYPERLINK l Toc28873157 3 PAGEREF Toc28873157 h 5
HYPERLINK l Toc28873158 4 PAGEREF Toc28873158 h 6
HYPERLINK l Toc28873159 5 PAGEREF Toc28873159 h 17
HYPERLINK l Toc28873160 6 PAGEREF Toc28873160 h 26
HYPERLINK l Toc28873161 PAGEREF Toc28873161 h 27
HYPERLINK l Toc28873162 1. PAGEREF Toc28873162 h 27
HYPERLINK l Toc28873163 1 PAGEREF Toc28873163 h 27
HYPERLINK l Toc28873164 2 PAGEREF Toc28873164 h 27
HYPERLINK l Toc28873165 2. PAGEREF Toc28873165 h 27
HYPERLINK l Toc28873166 1 PAGEREF Toc28873166 h 27
HYPERLINK l Toc28873167 2 PAGEREF Toc28873167 h 28
HYPERLINK l Toc28873168 3 PAGEREF Toc28873168 h 28
HYPERLINK l Toc28873169 4 PAGEREF Toc28873169 h 29
HYPERLINK l Toc28873170 5 PAGEREF Toc28873170 h 30
HYPERLINK l Toc28873171 6 PAGEREF Toc28873171 h 31
HYPERLINK l Toc28873172 PAGEREF Toc28873172 h 32
HYPERLINK l Toc28873173 1. PAGEREF Toc28873173 h 32
HYPERLINK l Toc28873174 1 PAGEREF Toc28873174 h 32
HYPERLINK l Toc28873175 2 PAGEREF Toc28873175 h 32
HYPERLINK l Toc28873176 2. PAGEREF Toc28873176 h 32
HYPERLINK l Toc28873177 1 PAGEREF Toc28873177 h 32
HYPERLINK l Toc28873178 2 PAGEREF Toc28873178 h 32
HYPERLINK l Toc28873179 3 PAGEREF Toc28873179 h 34
HYPERLINK l Toc28873180 4 PAGEREF Toc28873180 h 34
HYPERLINK l Toc28873181 5 PAGEREF Toc28873181 h 38
HYPERLINK l Toc28873182 6 PAGEREF Toc28873182 h 42
HYPERLINK l Toc28873183 PAGEREF Toc28873183 h 43
HYPERLINK l Toc28873184 1. PAGEREF Toc28873184 h 43
HYPERLINK l Toc28873185 1 PAGEREF Toc28873185 h 43
HYPERLINK l Toc28873186 2 PAGEREF Toc28873186 h 43
HYPERLINK l Toc28873187 2. PAGEREF Toc28873187 h 44
HYPERLINK l Toc28873188 1 PAGEREF Toc28873188 h 44
HYPERLINK l Toc28873189 2 PAGEREF Toc28873189 h 44
HYPERLINK l Toc28873190 3 PAGEREF Toc28873190 h 44
HYPERLINK l Toc28873191 4 PAGEREF Toc28873191 h 46
HYPERLINK l Toc28873192 5 PAGEREF Toc28873192 h 46
HYPERLINK l Toc28873193 6 PAGEREF Toc28873193 h 47
HYPERLINK l Toc28873194 PAGEREF Toc28873194 h 48
HYPERLINK l Toc28873195 1. PAGEREF Toc28873195 h 48
HYPERLINK l Toc28873196 1 PAGEREF Toc28873196 h 48
HYPERLINK l Toc28873197 2 Prim PAGEREF Toc28873197 h 48
HYPERLINK l Toc28873198 2. PAGEREF Toc28873198 h 48
HYPERLINK l Toc28873199 1 PAGEREF Toc28873199 h 48
HYPERLINK l Toc28873200 2 PAGEREF Toc28873200 h 49
HYPERLINK l Toc28873201 3 PAGEREF Toc28873201 h 49
HYPERLINK l Toc28873202 4 PAGEREF Toc28873202 h 51
HYPERLINK l Toc28873203 5 PAGEREF Toc28873203 h 54
HYPERLINK l Toc28873204 6 PAGEREF Toc28873204 h 55
HYPERLINK l Toc28873205 PAGEREF Toc28873205 h 57
HYPERLINK l Toc28873206 1. PAGEREF Toc28873206 h 57
HYPERLINK l Toc28873207 2. PAGEREF Toc28873207 h 82
HYPERLINK l Toc28873208 3. PAGEREF Toc28873208 h 88
HYPERLINK l Toc28873209 4. PAGEREF Toc28873209 h 102
HYPERLINK l Toc28873210 5. PAGEREF Toc28873210 h 106

linearlistn

O1

product
struct product
long num;
char name16;
char manurer32;
char date16;
long number;
double unitprice;
double totalprice;
struct product next;
;

struct product oneheadNULL; NULL
int n;

void menu;
void entvoid;
void broint;
void sor;
void que;
void del;
void add;
void savestruct product ;

struct product entry;
struct product recoverstruct product ,int;
void browsestruct product ;
struct product sortingstruct product ,int;
void query1char ,int;
void query2long ,long,int;
void query3char ,char ;
void query4double,double,int;
struct product deleter1struct product ,char ,int;
struct product deleter2struct product ,long,int;
struct product deleter3struct product ,double,int;
struct product addtostruct product,struct product ;

void menu

void ent

void broint

void sor

void que

void del

void add

struct product entry

struct product recoverstruct product ,int

void browsestruct product

struct product sortingstruct product ,int

void query1char ,int

void query2long,long,int

void query3char ,char

void query4double,double,int

struct product deleter1struct product ,char ,int

struct product deleter2struct product,long,int

struct productdeleter3struct product,double,int

struct productaddtostruct product,struct product

void savestruct product

,

PUSHPOPLIFO

nn

int main

int n;
int s;
struct stackstruct p;
printf: ;
scanfd, n;
stack1count stack2count queuecount 0;

while 1

printfn123n;
printf A,2,60;
p struct stackstruct mallocsizeofstackstruct;
printfn;
scanfd,d,d, s, pid, ptime;
if s 1break;
else
if s 2

if stack1count n

push0, p;
printfdn, stackend1id;
printf: dn, stackend1time;
printf: dn, stack1count;

else

Enqueuep;
printfdn, pid;
printf: dn, ptime;
printf: dn, queuecount;

else
if s 3

struct stackstruct temp;
while temp poppid, ptime ! NULL

push1, temp;

while stack2count ! 0

push0, pop1;

if queuecount ! 0

push0, Dequeueptime;
printfdn, stackend1id;
printf: dn, stackend1time;
printf: dn, stack1count;

return 0;

n22120223023403120100
123

poppush

lists

n

1112221,

112,

0

12

point

Glist creatGlistGlist Gl

Glist GreatGlistGlistGL,p,q,m,aGL,p,q,m,aNULLGLpqamq
str,m
len,f,f1,f2f,f1,f20lenff1,f2
GLp,qmf1f1f20
qf11f20qf11
af21
GL

Glist insertdateGlist GL

strteachername,graduatename
GlistStr,p,q,StrStrpq

GL

insertdateGlist GL
:

void delstudentGlist GLGlistStr,p,q,m,aGLpqamq
str,Str
f,ch

findstudentGlist GL

studentcountGlist GL
m,n
m

GlistprintGlist GL

0122022

modificationGlist GL

112 211caojia2class2,12

;

NNHuffmanTree

huffmanhuffman

huffmanhuffamnhuffman

Select

huffman
uct HuNodeType

double weight;
HuNode parent;
HuNode Lchild;
HuNode Rchild;
char value;
;

typedef struct HuCodeType HuCode;
struct HuCodeType

int bitsMAXBIT;
int start;
;

typedef struct HuffList HuList;

struct HuffList

HuNode Node;
HuList Next;
HuList Parent;
;
n2n1n1

nnTt1,t2,t3,t4tn;

01

58

X:X

.

nn11kruskalprim
GV,Eu,vuvwu,vTEwTTG

Prim

NV,ETEN
UuouoV,TE
uU,vVUu,vEEU0,voTE,VoU
UV
TEn1TV,TEN
G,n.U

typedef struct

char VM10;
int RMM;
int vexnum;
Graph;

typedef struct

int adjvex;
int lowcost;
closedgeMAX;

CreateCityGraph G:
LocateDistriGraph g,int u:
MinGraph g,closedge closedge:
PrimGraph G,G.distrinam1:

include stdio.h
include stdlib.h
include string.h
define INFINITY 10000
define M 20

typedef struct

char VM10;
int RMM;
int vexnum;
Graph;
struct tree

int weizhi;
int lowcost;
;

int creatgraphGraph g n

int i0,j,m,k,p;
char a10,b10;
printfttn;
printftn;
printft0n;
scanfs,gVi;
whilestrcmp0,gVi!0

i;
scanfs,gVi;

gvexnumi;
fori0;igvexnum;i
forj0;jgvexnum;j
gRijINFINITY;
printft0 0 0n;
scanfssd,a,b,m;
whilestrcmp0,a!0 strcmp0,b!0 m!0

klocatevexg,a;
plocatevexg,b; a,b
ifk1

printftsn,a;
return 0;

ifp1

printftsn,b;
return 0;

gRkpgRpkm; kppk
scanfssd,a,b,m;

return 1;

struct tree

int weizhi;
int lowcost;
;

int minimunstruct tree a,Graph g kik

int i,k,m0;
fori0;ig.vexnum;i

ifm0 ai.lowcost!0

m1;
ki;

ifm1 ai.lowcost!0

ifai.lowcostak.lowcost ki;

return k;

int locatevexGraph g,char a10 u

int i;
fori0;igvexnum;i uVi
ifstrcmpa,gVi0 return i;
ifigvexnum return 1;

int minimunstruct tree a,Graph g kik

int i,k,m0;
fori0;ig.vexnum;i

ifm0 ai.lowcost!0

m1;
ki;

ifm1 ai.lowcost!0

ifai.lowcostak.lowcost ki;

return k;

Prim
void MiniSpanTreePRIMGraph g,char a10

struct tree closedgeM;
int i,j,k,money0;
klocatevexg,a;
fori0;ig.vexnum;i

ifi!k

closedgei.lowcostg.Rki; k i
closedgei.weizhik; ik

closedgek.lowcost0; , Uu
printft : n;
fori0;ig.vexnum;i

forj0;jg.vexnum;j
printfd ,g.Rij;
printfnn;

printft : n;
fori1;ig.vexnum;i

kminimunclosedge,g; Tkmoneyclosedgek.lowcosto
moneyclosedgek.lowcost;
printfd:s s dn,i,g.Vclosedgek.weizhi,g.Vk,closedgek.lowcost;
closedgek.lowcost0;k U
forj0;jg.vexnum;j

ifg.Rkjclosedgej.lowcost

closedgej.weizhik;
closedgej.lowcostg.Rkj;

printft: d n,money;

int main

int i;
Graph g;
char a10;
icreatgraphg;
ifi

printfnta, : ;
scanfs,a;

MiniSpanTreePRIMg,a;
printfnthanks to use this programe!n;
return 0;

On3,02m

includestdio.h
includestdlib.h
includestring.h
includemalloc.h
define LEN sizeofstruct product

struct product
long num;
char name16;
char manurer32;
char date16;
long number;
double unitprice;
double totalprice;
struct product next;
;

struct product oneheadNULL; NULL
int n;

void menu;
void entvoid;
void broint;
void sor;
void que;
void del;
void add;
struct product entry;
struct product recoverstruct product ,int;
void browsestruct product ;
struct product sortingstruct product ,int;
void query1char ,int;
void query2long ,long,int;
void query3char ,char ;
void query4double,double,int;
struct product deleter1struct product ,char ,int;
struct product deleter2struct product ,long,int;
struct product deleter3struct product ,double,int;
struct product addtostruct product,struct product ;
void savestruct product ;

int main

menu;
return 0;

void menuvoid

int i,m0;
while1

printfttttn;
printfntn;
printfnt1tttt2n;
printfnt3tttt4n;
printfnt5tttt6n;
printfnt7n;
printfntn;
printfnt345n;
printfnt2n;
printfnt!n;
printfnt!n;
printfnt;
scanfd,i;
ifi7 break; i7
else
switchi

case 1:ent;m1;break;
case 2:brom;m1;break;
case 3:sor;break;
case 4:que;break;
case 5:del;break;
case 6:add;m1;break;
default :printfn!;

void entvoid

int i;
ifonehead!NULL

printfnn;
printfn? !n;
printfnt1t2n;
printf;
scanfd,i;
whilei!1i!2

printfn:;
scanfd,i;

ifi1 oneheadNULL;n0; i00
else return ;

printfnn;
printf!n;
printfn;
printf .. n;
printf11001 2018.11.10 100 16.9n;
printf21002 2018.01.03 9 12n;
printfn!n;
printfn;
printfn0!n;
oneheadentry;
saveonehead;

struct product entryvoid

struct product headNULL,p1,p2; head,p1,p2,head
int m0; 0
p1p2struct product mallocLEN; p1,p2
printfnn;
printfn;
scanfld,p1num;
ifp1num0 return head; 0
printfn;
scanfs,p1name;
printfn;
scanfs,p1manurer;
printfn;
scanfs,p1date;
printfn;
scanfld,p1number;
printfn;
scanflf,p1unitprice;
whilep1num!0

p1totalpricep1numberp1unitprice;
m; 1
ifm1 headp1; 1headp1
else p2nextp1;
p2p1;
p1struct product mallocLEN;
printfn0!n;
printfnn;
scanfld,p1num;
ifp1num0 break; 0
printfn;
scanfs,p1name;
printfn;
scanfs,p1manurer;
printfn;
scanfs,p1date;
printfn;
scanfld,p1number;
printfn;
scanflf,p1unitprice;

nm;
p2nextNULL; p2
return head;

void broint m

int j;
printfnt1t2n;
printfn;
scanfd,j;
whilej!1j!2

printfn!;
scanfd,j;

ifj1 oneheadrecoveronehead,m; j1
else browseonehead;

struct product recoverstruct product head,int m

ifm printfnnn;return head;
FILE fp;
char s128;
int c0;
n0; 0
struct product p1head,p2;
iffpfopenproduct information,rNULL

printfnn;
return head;

p1p2struct product mallocLEN; p1,p2
while!feoffp fp

ifc0 fgetss,76,fp;c1; 1
else

fscanffp,ldttsttsttsttldttlftlfn,p1num,p1name,p1manurer,p1date,p1number,p1unitprice,p1totalprice;
n; 1

ifc!0n1 headp1; 01p1
else p2nextp1; p2p1
p2p1; p2p1
p1struct product mallocLEN; p1

p2nextNULL; p2
fclosefp;
printfnn;
return head;

void browsestruct product head

FILE fp;
char s128;
int c0;
struct product p1head; p1,p1
iffpfopenproduct information,rNULL

printfnn;
return ;

p1struct product mallocLEN; p1
printfnn;
printfnn;
while!feoffp fp

ifc0 fgetss,76,fp;printftttttttn;c1; 01
else

fscanffp,ldttsttsttsttldttlftlfn,p1num,p1name,p1manurer,p1date,p1number,p1unitprice,p1totalprice;
printf4ldt.8st.10stst4ldt6.2lft6.2lfn,p1num,p1name,p1manurer,p1date,p1number,p1unitprice,p1totalprice;

fclosefp;

void sorvoid

ifoneheadNULL

printfn!n;
return ;

int i;
printfnn;
printfnt1tttt2n;
printfnt3tttt4n;
printfnt5tttt6n;
printfnt;
scanfd,i;
ifi6 return; i6,
whilei!1i!2i!3i!4i!5

printfn:;
scanfd,i;

oneheadsortingonehead,i;
saveonehead;

struct product sortingstruct product head,int i

struct product first,tail,pm,m,p; firsttailpm,m,p;
int j;
printfnn;
printfnt1t2n;
printfnt;
scanfd,j;
whilej!1j!2

printfn:;
scanfd,j;

firstNULL;
ifheadnextNULL printfnn;return head;
ifj1
switchi

case 1:whilehead!NULL

forpmhead;pnext!NULL;ppnext p,mp
ifmnumpnextnum mp

pmp; pmm
mpnext; m

iffirstNULL

firstm; m
tailm; tailm

else
tailnextm; tail
tailm; tailm
ifmhead headheadnext; head,head
else pmnextmnext;

iffirst!NULL tailnextNULL;
headfirst;
printfnn;
break;
case 2:whilehead!NULL

forpmhead;pnext!NULL;ppnext
ifstrcmpmdate,pnextdate0

pmp;
mpnext;

iffirstNULL

firstm;
tailm;

else tailnextm;
tailm;
ifmhead headheadnext;
else pmnextmnext;

iffirst!NULL tailnextNULL;
headfirst;
printfnn;
break;
case 3:whilehead!NULL

forpmhead;pnext!NULL;ppnext
ifmnumberpnextnumber

pmp;
mpnext;

iffirstNULL

firstm;
tailm;

else tailnextm;
tailm;
ifmhead headheadnext;
else pmnextmnext;

iffirst!NULL tailnextNULL;
headfirst;
printfnn;
break;
case 4:whilehead!NULL

forpmhead;pnext!NULL;ppnext
ifmunitpricepnextunitprice

pmp;
mpnext;

iffirstNULL

firstm;
tailm;

else tailnextm;
tailm;
ifmhead headheadnext;
else pmnextmnext;

iffirst!NULL tailnextNULL;
headfirst;
printfnn;
break;
case 5:whilehead!NULL

forpmhead;pnext!NULL;ppnext
ifmtotalpricepnexttotalprice

pmp;
mpnext;

iffirstNULL

firstm;
tailm;

else tailnextm;
tailm;
ifmhead headheadnext;
else pmnextmnext;

iffirst!NULL tailnextNULL;
headfirst;
printfnn;

else
switchi

case 1:whilehead!NULL

forpmhead;pnext!NULL;ppnext
ifmnumpnextnum

pmp;
mpnext;

iffirstNULL

firstm;
tailm;

else tailnextm;
tailm;
ifmhead headheadnext;
else pmnextmnext;

iffirst!NULL tailnextNULL;
headfirst;
printfnn;
break;
case 2:whilehead!NULL

forpmhead;pnext!NULL;ppnext
ifstrcmpmdate,pnextdate0

pmp;
mpnext;

iffirstNULL

firstm;
tailm;

else tailnextm;
tailm;
ifmhead headheadnext;
else pmnextmnext;

iffirst!NULL tailnextNULL;
headfirst;
printfnn;
break;
case 3:whilehead!NULL

forpmhead;pnext!NULL;ppnext
ifmnumberpnextnumber

pmp;
mpnext;

iffirstNULL

firstm;
tailm;

else tailnextm;
tailm;
ifmhead headheadnext;
else pmnextmnext;

iffirst!NULL tailnextNULL;
headfirst;
printfnn;
break;
case 4:whilehead!NULL

forpmhead;pnext!NULL;ppnext
ifmunitpricepnextunitprice

pmp;
mpnext;

iffirstNULL

firstm;
tailm;

else tailnextm;
tailm;
ifmhead headheadnext;
else pmnextmnext;

iffirst!NULL tailnextNULL;
headfirst;
printfnn;
break;
case 5:whilehead!NULL

forpmhead;pnext!NULL;ppnext
ifmtotalpricepnexttotalprice

pmp;
mpnext;

iffirstNULL

firstm;
tailm;

else tailnextm;
tailm;
ifmhead headheadnext;
else pmnextmnext;

iffirst!NULL tailnextNULL;
headfirst;
printfnn;

return head;

void quevoid

ifoneheadNULL

printfn!n;
return ;

int i;
long m,k;
double x,y;
char s132,s232;
while1

printfnn;
printfnt1tttt2n;
printfnt3tttt4n;
printfnt5tttt6n;
printfnt7tttt8n;
printfn;
printfnt;
scanfd,i;
printfn0!;
ifi8 break; i8
else
switchi
case 0:break;
case 1:printfnt;
scanfldld,m,k;
query2m,k,i;
break;
case 2:printfnt;
scanfs,s1;
query1s1,i;
break;
case 3:printfnt;
scanfs,s1;
query1s1,i;
break;
case 4:printfn12018.11.10n;
printfn22018.01.02n;
printfn!n;
printfnt;
scanfss,s1,s2;
query3s1,s2;
break;
case 5:printfnt;
scanfldld,m,k;
query2m,k,i;
break;
case 6:printfnt;
scanflflf,x,y;
query4x,y,i;
break;
case 7:printfnt;
scanflflf,x,y;
query4x,y,i;
break;
default :printfnt!;

void query1char s1,int i

struct product headonehead,p; head,p,headonehead
pstruct product mallocLEN; p
int c0,j0;
phead; phead
switchi

case 2:printfnn;
whilep!NULL p

ifstrcmps1,pname0 p

if!j printftttttttn;j1; j0j1
printf4ldt.8st.10stst4ldt6.2lft6.2lfn,pnum,pname,pmanurer,pdate,pnumber,punitprice,ptotalprice;
c1;

ppnext; p

ifc0 printfnn; 0
break;
case 3:printfnn;
whilep!NULL

ifstrcmps1,pmanurer0

if!j printftttttttn;j1;
printf4ldt.8st.10stst4ldt6.2lft6.2lfn,pnum,pname,pmanurer,pdate,pnumber,punitprice,ptotalprice;
c1;

ppnext;

ifc0 printfnn;

void query2long m,long k,int i

struct product headonehead,p;
int c0,j0;
pstruct product mallocLEN;
phead;
switchi

case 1:printfnn;
whilep!NULL

ifpnummpnumk

if!j printftttttttn;j1;
printf4ldt.8st.10stst4ldt6.2lft6.2lfn,pnum,pname,pmanurer,pdate,pnumber,punitprice,ptotalprice;
c1;

ppnext;

ifc0 printfnn;
break;
case 5:printfnn;
whilep!NULL

ifpnumbermpnumberk

if!j printftttttttn;j1;
printf4ldt.8st.10stst4ldt6.2lft6.2lfn,pnum,pname,pmanurer,pdate,pnumber,punitprice,ptotalprice;
c1;

ppnext;

ifc0 printfnn;

void query3char s1,char s2

struct product headonehead,p;
int c0,j0;
pstruct product mallocLEN;
phead;
printfnn;
whilep!NULL

ifstrcmppdate,s10strcmppdate,s20

if!j printftttttttn;j1;
printf4ldt.8st.10stst4ldt6.2lft6.2lfn,pnum,pname,pmanurer,pdate,pnumber,punitprice,ptotalprice;
c1;

ppnext;

ifc0 printfnn;

void query4double x,double y,int i

struct product headonehead,p;
int c0,j0;
pstruct product mallocLEN;
phead;
switchi

case 6:printfnn;
whilep!NULL

ifpunitpricexpunitpricey

if!j printftttttttn;j1;
printf4ldt.8st.10stst4ldt6.2lft6.2lfn,pnum,pname,pmanurer,pdate,pnumber,punitprice,ptotalprice;
c1;

ppnext;

ifc0 printfnn;
break;
case 7:printfnn;
whilep!NULL

ifptotalpricexptotalpricey

if!j printftttttttn;j1;
printf4ldt.8st.10stst4ldt6.2lft6.2lfn,pnum,pname,pmanurer,pdate,pnumber,punitprice,ptotalprice;
c1;

ppnext;

ifc0 printfnn;

void delvoid

ifoneheadNULL

printfn!n;
return ;

int i;
long m;
double x;
char s32;
while1

printfnn;
printfnt1tttt2n;
printfnt3tttt4n;
printfnt5tttt6n;
printfnt7tttt8n;
printfn;
scanfd,i;
printfn!;
ifi8 break; i8
else
switchi

case 1:printfn;
scanfld,m;
oneheaddeleter2onehead,m,i;
break;
case 2:printfn;
scanfs,s;
oneheaddeleter1onehead,s,i;
break;
case 3:printfn;
scanfs,s;
oneheaddeleter1onehead,s,i;
break;
case 4:printfn12018.11.10n;
printfn22018.01.02n;
printfn!n;
printfn;
scanfs,s;
oneheaddeleter1onehead,s,i;
break;
case 5:printfn;
scanfld,m;
oneheaddeleter2onehead,m,i;
break;
case 6:printfn;
scanflf,x;
oneheaddeleter3onehead,x,i;
break;
case 7:printfn;
scanflf,x;
oneheaddeleter3onehead,x,i;
break;
default :printfn!;

saveonehead;

struct product deleter1struct product head,char s,int i

struct product p1head,p2; p1,p2p1
int c0; 0
switchi

case 2:while1

whilestrcmps,p1name!0p1next!NULL p1p1
p2p1;p1p1next; p2p1p1
ifstrcmps,p1name0
ifp1head headp1next; p1p1
else p2nextp1next; p2p1
n; 1
c1; c1

else break;
p1head; p1

ifc0 printfnn;
else printfn!;
break;
case 3:while1

whilestrcmps,p1manurer!0p1next!NULL
p2p1;p1p1next;
ifstrcmps,p1manurer0
ifp1head headp1next;
else p2nextp1next;
n;
c1;

else break;
p1head;

ifc0 printfnn;
else printfn!;
break;
case 4:while1

whilestrcmps,p1date!0p1next!NULL
p2p1;p1p1next;
ifstrcmps,p1date0
ifp1head headp1next;
else p2nextp1next;
n;
c1;

else break;
p1head;

ifc0 printfnn;
else printfn!;

return head;

struct product deleter2struct product head,long m,int i

struct product p1head,p2,p3head;
int c0;
switchi

case 1:while1

whilem!p1nump1next!NULL
p2p1;p1p1next;
ifmp1num
ifp1head headp1next;
else p2nextp1next;
n;
c1;

else break;
p1head;

ifc0 printfnn;
else printfn!;
break;
case 5:while1

whilem!p1numberp1next!NULL
p2p1;p1p1next;
ifmp1number
ifp1head headp1next;
else p2nextp1next;
n;
c1;

else break;
p1head;

ifc0 printfnn;
else printfn!;

return head;

struct product deleter3struct product head,double x,int i

struct product p1head,p2,p3head;
int c0;
switchi

case 6:while1

whilex!p1unitpricep1next!NULL
p2p1;p1p1next;
ifxp1totalprice
ifp1head headp1next;
else p2nextp1next;
n;
c1;

else break;
p1head;

ifc0 printfnn;
else printfn!;
break;
case 7:while1

whilex!p1totalpricep1next!NULL
p2p1;p1p1next;
ifxp1totalprice
ifp1head headp1next;
else p2nextp1next;
n;
c1;

else break;
p1head;

ifc0 printfnn;
else printfn!;

return head;

void addvoid

struct product pro; pro
prostruct product mallocLEN; pro
printfnn;
printfn!n;
printfnn;
printf .. n;
printf11001 2018.11.10 100 16.9n;
printf21002 2018.01.03 9 12n;
printfn!n;
printfn0!n;
printfn;
printfn0!n;
printfnn;
scanfld,pronum;
ifpronum0 return ; 0
printfn;
scanfs,proname;
printfn;
scanfs,promanurer;
printfn;
scanfs,prodate;
printfn;
scanfld,pronumber;
printfn;
scanflf,prounitprice;
whilepronum!0 0
n; 1
prototalpricepronumberprounitprice;
oneheadaddtoonehead,pro;
prostruct product mallocLEN;
printfn0!n;
printfnn;
scanfld,pronum;
ifpronum0 break;
printfn;
scanfs,proname;
printfn;
scanfs,promanurer;
printfn;
scanfs,prodate;
printfn;
scanfld,pronumber;
printfn;
scanflf,prounitprice;

saveonehead;

struct product addtostruct product head,struct product pro

struct product p; P
phead; P
ifheadNULL
headpro;pronextNULL; pro
else

whilepnext!NULL P
ppnext; P
pnextpro; Ppro
pronextNULL; pro

return head;

void savestruct product head

ifheadNULL

printfn!!n;
return ;

FILE fp;
struct product phead;
iffpfopenproduct information,wNULL
printf!;
return ;
fprintffp,ttt..tttn;
whilep!NULL
fprintffp,4ldttsttsttstt4ldtt8lft8lfn,pnum,pname,pmanurer,pdate,pnumber,punitprice,ptotalprice;
ppnext;
fclosefp;

includestdio.h
includestdlib.h
includestring.h
includemath.h
define P 2

struct stackstruct stackhead1, stackend1;
struct stackstruct stackhead2, stackend2;
struct queuestruct queuehead, queueend;
int stack1count, stack2count;
int queuecount;

struct stackstruct

int id;
int time;
struct stackstruct pre;
struct stackstruct next;
;

struct queuestruct

int id;
struct queuestruct next;
;

void pushint flag, struct stackstruct p

struct stackstruct stack;
if flag 0 1

if stack1count 0

stackhead1 struct stackstruct mallocsizeofstruct stackstruct;
stackhead1id pid;
stackhead1time ptime;
stackhead1next NULL;
stackhead1pre NULL;
stackend1 stackhead1;

else

stack struct stackstruct mallocsizeofstruct stackstruct;
stackid pid;
stacktime ptime;
stackend1next stack;
stackpre stackend1;
stacknext NULL;
stackend1 stack;

stack1count;

else
if flag 1 2

if stack2count 0

stackhead2 struct stackstruct mallocsizeofstruct stackstruct;
stackhead2id pid;
stackhead2time ptime;
stackhead2next NULL;
stackhead2pre NULL;
stackend2 stackhead2;

else

stack struct stackstruct mallocsizeofstruct stackstruct;
stackid pid;
stacktime ptime;
stackend2next stack;
stackpre stackend2;
stacknext NULL;
stackend2 stack;

stack2count;

struct stackstruct popint id, int time

struct stackstruct stack;
stack struct stackstruct mallocsizeofstruct stackstruct;
if stackend1id ! id

stackid stackend1id;
stacktime stackend1time;
stackpre stackend1pre;
freestackend1;
stackend1 stackpre;
stackend1next NULL;
stack1count;

else

stackid stackend1id;
stacktime stackend1time;
stackpre stackend1pre;
printfdn, id;
printf: dn, time stacktime;
printf: d: dn,P, P time stacktime;
freestackend1;
if stack1count 0
stackend1 stackhead1 NULL;
else

stackend1 stackpre;
stackend1next NULL;

stack NULL;

return stack;

struct stackstruct pop1

struct stackstruct stack;
stack struct stackstruct mallocsizeofstruct stackstruct;
stackid stackend2id;
stacktime stackend2time;
stackpre stackend2pre;
freestackend2;
stackend2 stackpre;
stack2count;
return stack;

void Enqueuestruct stackstruct p

struct queuestruct queue;
if queuecount 0

queuehead struct queuestruct mallocsizeofstruct queuestruct;
queueheadid pid;
queueheadnext NULL;
queueend queuehead;

else

queue struct queuestruct mallocsizeofstruct queuestruct;
queueid pid;
queuenext NULL;
queueendnext queue;
queueend queue;

queuecount;

struct stackstruct Dequeueint time

struct stackstruct stack;
stack struct stackstruct mallocsizeofstruct stackstruct;
stackid queueheadid;
stacktime time;
if queuecount 0

queuehead NULL;
queueend NULL;

else
queuehead queueheadnext;
return stack;

int main

int n;
int s;
struct stackstruct p;
printf: ;
scanfd, n;
stack1count stack2count queuecount 0;

while 1

printfn123n;
printf A,2,60;
p struct stackstruct mallocsizeofstackstruct;
printfn;
scanfd,d,d, s, pid, ptime;
if s 1break;
else
if s 2

if stack1count n

push0, p;
printfdn, stackend1id;
printf: dn, stackend1time;
printf: dn, stack1count;

else

Enqueuep;
printfdn, pid;
printf: dn, ptime;
printf: dn, queuecount;

else
if s 3

struct stackstruct temp;
while temp poppid, ptime ! NULL

push1, temp;

while stack2count ! 0

push0, pop1;

if queuecount ! 0

push0, Dequeueptime;
printfdn, stackend1id;
printf: dn, stackend1time;
printf: dn, stack1count;

return 0;

includestdio.h
includestdlib.h
includestring.h

typedef struct GLnode

char name20;
char position20;
int level;
struct

GLnode peer;
GLnode next;
point;
Glist;

Glist creatGlist

Glist GL,p,q,m,a; p,q,am
char str200;
int len,f,f1,f2,i,j; lenff1,f2
iff1f20;
GLpqmaNULL;
printfplease input str such as xiaomingteacher0 or xiaoming1class1 : n;
scanfs,str;
lenstrlenstr; str
whileilen

ifstri

i;
continue;

else

m Glist mallocsizeofGlist;
forj0;stri!;i
mnamejstri;
mnamej0;
fori,j0;stri!;i
mpositionjstri;
mpositionj0;
mlevelstri48;
mpoint.peermpoint.nextNULL;
i;
ifmlevel0

iff

ppoint.peerm;
pm;

else

GLpm;
f1;

f1f20; f0,
aqm; aq

else
ifmlevel 1

iff1

qpoint.peerm;

else

qpoint.nextm;
f11;

f20;
aqm;

else

iff2

apoint.peerm;

else

apoint.nextm;
f21;

am;

return GL;

void GlistprintGlist GL

Glist p,q,a;
int f,f1,f2;
pGL;
ff1f20;
printf;
while1

ifpNULL break;
iff

printf,ssd,pname,pposition,plevel;

else

printfssd,pname,pposition,plevel;
f1;

qppoint.next;
f1f20;
while1

ifqNULL break;
iff1
ifqlevel1

printf,ssd,qname,qposition,qlevel;

else

printf,ssd,qname,qposition,qlevel;

else

printf,ssd,qname,qposition,qlevel;
f11;

aqpoint.next;
f20;
while1

ifaNULL break;
iff2

printf,ssd,aname,aposition,alevel;

else

printf,ssd,aname,aposition,alevel;
f21;

aapoint.peer;

iff2 printf;
ifqlevel1qpoint.peerNULL printf;
qqpoint.peer;

printf;
pppoint.peer;

printfn;

void inStrGlist Str Str

char str100;
int i,j;
printfplease input student information such as xiaohong1class1 : ;
scanfs,str;
forij0;stri!;i
Strnamejstri;
Strnamej0;
forj0,i;stri!;i
Strpositionjstri;
Strpositionj0;
Strlevelstri48;
Strpoint.peerStrpoint.nextNULL;

Glist insertdateGlist GL

char str100,teachername30,graduatename30;
Glist Str,p,q;
int i,j;
pGL;
StrGlist mallocsizeofGlist;
inStrStr;
ifStrlevel 2

printfplease input the s teachername : ,Strname;
scanfs,teachername;
printfn;
whilestrcmppname,teachername

pppoint.peer;
ifpNULL break;

ifpNULL printfthe s teacher no foundn,teachername;
else

ifppoint.nextNULLppoint.nextlevel2

Strpoint.peerppoint.next;
ppoint.nextStr;
printfinsert success!n;

else

printfplease input beyond graduatename : ;
scanfs,graduatename;
printfn;
qppoint.next;
whilestrcmpqname,graduatename

qqpoint.peer;
ifqNULL break;

ifqNULL printfthe s is no found!n,graduatename;
else

Strpoint.peerqpoint.next;
qpoint.nextStr;
printfinsert success!n;

else

printfplease input the s teachername : ,Strname;
scanfs,teachername;
printfn;
whilestrcmppname,teachername

pppoint.peer;
ifpNULL break;

ifpNULL printfthe s teacher no foundn,teachername;
else

ifppoint.nextNULLppoint.nextlevel1

Strpoint.peerppoint.next;
ppoint.nextStr;
printfinsert success!n;

else

Strpoint.nextppoint.next;
ppoint.nextStr;
printfinsert success!n;

return GL;

void delstudentGlist GL

char str100;
Glist Str,p,q,a,m;
int i,j,f,c;
pGL;
f0;
StrGlist mallocsizeofGlist;
inStrStr;
ifStrlevel 2

whilep!NULL!f

qppoint.next;
ifqlevel2

mq;
whileq!NULL!f

if!strcmpqname,Strname!strcmpqposition,Strposition

printfdelete this student ssd ?n,Strname,Strposition,Strlevel;
printfplease input 1yes or 0no : ;
scanfd,c;
ifc1

ifppoint.nextq
ppoint.nextqpoint.peer;
else
mpoint.peerqpoint.peer;
freeq;
printfdelete successn;

f1;

else

mq;
qqpoint.peer;

else

ifqlevel1
whileq!NULL!f

aqpoint.next;
ma;
whilea!NULL!f

if!strcmpaname,Strname!strcmpaposition,Strposition

printfdelete this student ssd ?n,Strname,Strposition,Strlevel;
printfplease input 1yes or 0no : ;
scanfd,c;
ifc1

ifqpoint.nexta
qpoint.nextapoint.peer;
else
mpoint.peerapoint.peer;
freea;
printfdelete success !;

f1;

else

ma;
aapoint.peer;

qqpoint.peer;

pppoint.peer;

else

whilep!NULL!f

qppoint.next;
mq;
whileq!NULL!f

if!strcmpqname,Strname!strcmpqposition,Strposition

ifqpoint.next!NULL

printfthe graduate have student,cant delete!n;
f1;

else

printfdelete this graduate ssd ?n,Strname,Strposition,Strlevel;
printfplease input 1yes or 0no : ;
scanfd,c;
ifc1

ifppoint.nextq
ppoint.nextqpoint.peer;
else
mpoint.peerqpoint.peer;
freeq;
printfdedete success!;

f1;

else

mq;
qqpoint.peer;

pppoint.peer;

if!f
printfyou delete person maybe is teacher,the teacher cant delete ! or the person no found!!!n;
printfn;

void findstudentGlist GL

char str30;
Glist p,q,a;
int f0; 0
pGL;
printfplease input check name,such as xiaoming :;
scanfs,str;
printfn;
whilep

qppoint.next;
if!strcmppname,str

printfpersonal information namepositionlevel :n;
printfssdn,pname,pposition,plevel;
f1;

else ifqlevel2

aq;
whilea

if!strcmpaname,str

printfpersonal information namepositionlevel :n;
printfssdn,aname,aposition,alevel;
printfthe students teachers personal information namepositionlevel :n;
printfssdn,pname,pposition,plevel;
f1;

aapoint.peer;

else

whileq

aqpoint.next;
if!strcmpqname,str

printfpersonal information namepositionlevel :n;
printfssdn,qname,qposition,qlevel;
printfthe graduates teachers personal information namepositionlevel :n;
printfssdn,pname,pposition,plevel;
f1;

else whilea

if!strcmpaname,str

printfpersonal information namepositionlevel :n;
printfssdn,aname,aposition,alevel;
printfthe graduate personal information namepositionlevel :n;
printfssdn,qname,qposition,qlevel;
printfthe students teachers personal information namepositionlevel :n;
printfssdn,pname,pposition,plevel;
f1;

aapoint.peer;

qqpoint.peer;

pppoint.peer;

if!f printfno found!!!n;
printfn;

void studentcountGlist GL

char teachername30;
Glist p,q,a;
int m0,n0; graugra
pGL;
printfplease input teachers name :;
scanfs,teachername;
printfn;
whilestrcmppname,teachername

pppoint.peer;
ifpNULL break;

if!p printfno found teacher!n;
else

qppoint.next;
whileq

m;
aqpoint.next;
whilea

n;
aapoint.peer;

qqpoint.peer;

ifppoint.nextlevel1

printfgraduate numbers :dn,m;
printfstudent numbers :dn,n;

else
printfstudent numbers:dn,m; gra

printfn;

void modificationGlist GL

Glist p,q,a,Str;
char personname30;
int f0;
pGL;
Str Glist mallocsizeofGlist;
printf :n;
inStrStr;
GlistprintGL;
printf;
scanfs,personname;

whilep

qppoint.next;
if!strcmppname,personname!f

ifplevelStrlevel

strcpypname,Strname;
strcpypposition,Strposition;
f1;

else
whileq

aqpoint.next;
if!strcmpqname,personname!f

ifqlevelStrlevel

strcpyqname,Strname;
strcpyqposition,Strposition;
f1;

else
whilea

if!strcmpaname,personname!f
ifalevelStrlevel

strcpyaname,Strname;
strcpyaposition,Strposition;
f1;

aapoint.peer;

qqpoint.peer;

pppoint.peer;

if!f printfn;
else printfn;

void menu

printfttn;
printft 1. tt 2.n;
printft 3. tt 4.n;
printft 5. tt 6.n;
printft 7. tt 8.n;
printfn;

void functionselectionGlist GL

int x;
while1

menu;
printfnplease enter the function to be implemented18,8 is exit system : ;
scanfd,x;
switchx

case 1:GLcreatGlist;break;
case 2:GLinsertdateGL;break;
case 3:delstudentGL;break;
case 4:findstudentGL;break;
case 5:studentcountGL;break;
case 6:GlistprintGL;break;
case 7:modificationGL;break;
case 8:break;
default:printfplease reenter!!;

ifx8 break;

int main

Glist GL;
functionselectionGL;
return 0;

include iostream
includestdlib.h
using namespace std;
define MAXBIT 30

typedef struct HuNodeType HuNode;
struct HuNodeType

double weight;
HuNode parent;
HuNode Lchild;
HuNode Rchild;
char value;
;

typedef struct HuCodeType HuCode;
struct HuCodeType

int bitsMAXBIT;
int start;
;

typedef struct HuffList HuList;

struct HuffList

HuNode Node;
HuList Next;
HuList Parent;
;
HuNode HuffmanTreeint n

HuList HuffList HuListmallocsizeofstruct HuffList;
HuffListNext NULL;
HuffListNode NULL;
HuList N,P HuffList;
HuNode tmp;

for int i 0; i n; i

tmp HuNodemallocsizeofstruct HuNodeType;
N HuListmallocsizeofstruct HuffList;
tmpLchild NULL;
tmpRchild NULL;
tmpparent NULL;
cout 2 5 : endl;
cin tmpvalue tmpweight;
NNode tmp;
NNext NULL;
PNext N;
NParent P;
P N;

HuList X1, X2;
while HuffListNextNext ! NULL

P HuListmallocsizeofstruct HuffList;
tmp HuNodemallocsizeofstruct HuNodeType;
N HuffListNext;
tmpweight 10000;
PNode tmp;
X1 P;
X2 P;
for N; N ! NULL; N NNext

if NNodeweight X1Nodeweight

X2 X1;
X1 N;

else if NNodeweight X2Nodeweight

X2 N;

tmpweight X1Nodeweight X2Nodeweight;
tmpLchild X1Node;
tmpRchild X2Node;
X1Nodeparent tmp;
X2Nodeparent tmp;
PNode tmp;
cout X1Nodevalue :X1Nodeweight
X2Nodevalue: X2Nodeweight endl;
PParent HuffList;
PNext HuffListNext;
HuffListNextParent P;
HuffListNext P;
X1X2;
if X1Next X2

X1ParentNext X2Next;
ifX2Next ! NULL
X2NextParent X1Parent;

else

X1ParentNext X1Next;
ifX1Next ! NULL
X1NextParent X1Parent;

if X2Next X1

X2ParentNext X1Next;
if X1Next ! NULL
X1NextParent X2Parent;

else

X2ParentNext X2Next;
ifX2Next ! NULL
X2NextParent X2Parent;

HuffListNextNodeparent NULL;
return HuffListNextNode;

void HuffmanCodeHuNode RootTree

if RootTree

if RootTreeLchild NULL RootTreeRchild NULL

printfc: , RootTreevalue; ;

HuNode R RootTree;
int BitMAXBIT;
int S 0;
while Rparent ! NULL

if RparentLchild R

BitS 0;

else

BitS 1;

S;
R Rparent;

S;
for S; S 0; S

cout BitS;

cout endl;

HuffmanCodeRootTreeLchild;
HuffmanCodeRootTreeRchild;

int main

int n;
cout endl;
cin n;
HuNode RootTree HuffmanTreen;
HuffmanCodeRootTree;
return 0;

include stdio.h
include stdlib.h
include string.h
define INFINITY 10000
define M 20

typedef struct

char VM10;
int RMM;
int vexnum;
Graph;

int locatevexGraph g,char a10 u

int i;
fori0;igvexnum;i uVi
ifstrcmpa,gVi0 return i;
ifigvexnum return 1;

int creatgraphGraph g n

int i0,j,m,k,p;
char a10,b10;
printfttn;
printf : a,0;
scanfs,gVi;
whilestrcmp0,gVi!0

i;
scanfs,gVi;

gvexnumi;
fori0;igvexnum;i
forj0;jgvexnum;j
gRijINFINITY;
printfa b 5,ab,5ab,0 0 0n;
scanfssd,a,b,m;
whilestrcmp0,a!0 strcmp0,b!0 m!0

klocatevexg,a;
plocatevexg,b; a,b
ifk1

printfsn,a;
return 0;

ifp1

printfsn,b;
return 0;

gRkpgRpkm; kppk
scanfssd,a,b,m;

return 1;

struct tree

int weizhi;
int lowcost;
;

int minimunstruct tree a,Graph g kik

int i,k,m0;
fori0;ig.vexnum;i

ifm0 ai.lowcost!0

m1;
ki;

ifm1 ai.lowcost!0

ifai.lowcostak.lowcost ki;

return k;

void MiniSpanTreePRIMGraph g,char a10

struct tree closedgeM;
int i,j,k,money0;
klocatevexg,a;
fori0;ig.vexnum;i

ifi!k

closedgei.lowcostg.Rki; k i
closedgei.weizhik; ik

closedgek.lowcost0; , Uu
printfn : n;
fori0;ig.vexnum;i

forj0;jg.vexnum;j
printfdt,g.Rij;
printfnn;

printf : n;
fori1;ig.vexnum;i

kminimunclosedge,g; Tkmoneyclosedgek.lowcosto
moneyclosedgek.lowcost;
printfd:s s dn,i,g.Vclosedgek.weizhi,g.Vk,closedgek.lowcost;
closedgek.lowcost0;k U
forj0;jg.vexnum;j

ifg.Rkjclosedgej.lowcost

closedgej.weizhik;
closedgej.lowcostg.Rkj;

printft: d n,money;

int main

int i;
Graph g;
char a10;
icreatgraphg;
ifi

printfnta, : ;
scanfs,a;

MiniSpanTreePRIMg,a;
printfnthanks to use this programe!n;
return 0;

PAGE MERGEFORMAT 49

i7

i

i

Y

N

N

Y

Y

N

N

Y

N

Y

N

Y

Y

N

N

Y

N

Y