Thu tuc hang doi
Procedure CreateQ(var Q:array[1..n] of item;
front,rear:o..n;
begin front:=0; rear:=0; end;
Function IsEmpty(Q);
begin ISempty:=(front=rear); end;
Procedure Front(Q);
begin if IsEmpty then halt
else front:=front+1;
end;
procedure AddQ(item: kieu_phantu);
begin if rear=n then writeln('hang day');
else begin rear:=rear+1;
Q[rear]:=item;
end
end;
procedure DeleteQ(var item:kieu_phantu);
begin if front=rear then halt
else begin front:=front+1;
Item:=Q[front];
end;
end;
Bạn đang đọc truyện trên: Truyen247.Pro