mirror of
https://hub.njuu.cf/TheAlgorithms/C-Plus-Plus.git
synced 2023-10-11 13:05:55 +08:00
Update Queue Using Linked List.cpp
This commit is contained in:
parent
0ab4f5f89d
commit
abc0d365de
@ -7,10 +7,8 @@ struct node
|
|||||||
node *next;
|
node *next;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
node *front, *rear;
|
node *front, *rear;
|
||||||
|
|
||||||
|
|
||||||
void Enque(int x)
|
void Enque(int x)
|
||||||
{
|
{
|
||||||
if (rear == NULL)
|
if (rear == NULL)
|
||||||
@ -42,7 +40,8 @@ void Deque()
|
|||||||
else
|
else
|
||||||
{
|
{
|
||||||
node *t = front;
|
node *t = front;
|
||||||
cout<<"\n"<<t->val<<" deleted";
|
cout << "\n"
|
||||||
|
<< t->val << " deleted";
|
||||||
front = front->next;
|
front = front->next;
|
||||||
delete t;
|
delete t;
|
||||||
if (front == NULL)
|
if (front == NULL)
|
||||||
@ -84,9 +83,7 @@ int main()
|
|||||||
{
|
{
|
||||||
show();
|
show();
|
||||||
}
|
}
|
||||||
}
|
} while (ch != 0);
|
||||||
while(ch!=0);
|
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user