filmov
tv
C# | Queues (Linked List Implementation) and Stacks (Array Implementation)

Показать описание
C# | Microsoft Visual Studio | Linked List | Array | Queue | Stack (HugoExer1)
For CMSC 204 - Data Structures and Algorithms
My video shows applications written on C# to demonstrate:
(1) Linked List Implementation of Queue (HugoExer1b); and
(2) Array Implementation of Stack (HugoExer1a).
The video focuses on the actual linked lists and arrays as used in queues and stack, respectively. For some information about the actual buttons, continue reading below.
Tools:
- IDE: Microsoft Visual Studio.
- Screen Recording: Free Cam 8.
- Audio Recording: Audio Evolution Mobile.
- Video Edit: PowerDirector
Doctor's Queue (Linked List Implementation) | Buttons
Button 1 - Sign-up. The button calls Form 2 (the entry form) and checks if Form 2 was provided with complete information. If not, then it will not do anything. If info is provided, then the button will call the "Enqueue" or AddToTail method.
Form 2 was called using:
Form2 patientInfo = new Form2 ();
patientInfo.ShowDialog();
Button 2 - Enter Room. This button checks if the Queue is currently null. If it is not null, then it displays Value1 (Name) and Value 2 (Concern) in a separate TextBox called "displayRoomInfo". If it is null, then it just shows a MessageBox. Note: This just displays the info, and does not call the "Dequeue" or DeleteHead method.
Button 3 - Begin Consultation. The button emulates beginning and ending a consultation. Upon pressing the button, it checks if the Queue is currently empty. If it is not empty, then it displays two consecutive MessageBoxes to shows that the patient has begun and ended the consultation, and then the DeleteHead method is called, removing the first entry from the Queue. If the list is empty at the time of pressing the button, then it just triggers a MessageBox to show there are no patients.
Button 4 - Closing Time. Pressing this button clears the entire Queue by setting the external list pointer to null.
Node mainQueue = globalVariables.MainQueue; // calls the global queue variable
mainQueue.Next = null; // equates to null
globalVariables.MainQueue.Next = null; // sets the global variable to null
After clearing the variables, it also calls a MessageBox that displays the Total Consultations.
Special Button - Senior Citizen / PWD. This button also calls Form 2, but instead of adding to the tail, it adds to the head.
Button 5 - Exit. This closes the application by calling:
Application.Exit();
Stack of Notebooks (Array Implementation) | Buttons
Button 1 - Add Notebook. The intent of this button is to add a notebook on the top. It first checks if the current Stack is already at the limit (in this presentation, StackSize is limited to 10). Technically, what the program is checking is if the StackPointer is pointing at 11 which is greater than 10. If it's already more than 10, a MessageBox will be called to inform the user (the notebook will not be added.)
If the StackSize limit has not yet been reached, then the program calls my "push" method implemented using Arrays i.e. it adds on top.
Button 2 - Check Notebook. The intent of this button is to remove one notebook from the top. It first checks if the Stack is empty and if it is not empty, it calls my "pop" method implemented using Arrays i.e. it removes from the top. If it is empty, then it just displays a MessageBox informing the user (without calling "pop").
Button 3 - Peek At Notebook. This button just displays the name of the topmost notebook. It also checks if the Stack is empty or not, but it does not call the "pop" method.
Button 4 - Check All. The intent is to "pop" all the notebooks. Again, this checks if there are notebooks in the Stack. If there are none, then it just displays a MessageBox. If there are notebooks, then it loops the pop method.
Button 5 - Exit. This closes the application by calling:
Application.Exit();
For CMSC 204 - Data Structures and Algorithms
My video shows applications written on C# to demonstrate:
(1) Linked List Implementation of Queue (HugoExer1b); and
(2) Array Implementation of Stack (HugoExer1a).
The video focuses on the actual linked lists and arrays as used in queues and stack, respectively. For some information about the actual buttons, continue reading below.
Tools:
- IDE: Microsoft Visual Studio.
- Screen Recording: Free Cam 8.
- Audio Recording: Audio Evolution Mobile.
- Video Edit: PowerDirector
Doctor's Queue (Linked List Implementation) | Buttons
Button 1 - Sign-up. The button calls Form 2 (the entry form) and checks if Form 2 was provided with complete information. If not, then it will not do anything. If info is provided, then the button will call the "Enqueue" or AddToTail method.
Form 2 was called using:
Form2 patientInfo = new Form2 ();
patientInfo.ShowDialog();
Button 2 - Enter Room. This button checks if the Queue is currently null. If it is not null, then it displays Value1 (Name) and Value 2 (Concern) in a separate TextBox called "displayRoomInfo". If it is null, then it just shows a MessageBox. Note: This just displays the info, and does not call the "Dequeue" or DeleteHead method.
Button 3 - Begin Consultation. The button emulates beginning and ending a consultation. Upon pressing the button, it checks if the Queue is currently empty. If it is not empty, then it displays two consecutive MessageBoxes to shows that the patient has begun and ended the consultation, and then the DeleteHead method is called, removing the first entry from the Queue. If the list is empty at the time of pressing the button, then it just triggers a MessageBox to show there are no patients.
Button 4 - Closing Time. Pressing this button clears the entire Queue by setting the external list pointer to null.
Node mainQueue = globalVariables.MainQueue; // calls the global queue variable
mainQueue.Next = null; // equates to null
globalVariables.MainQueue.Next = null; // sets the global variable to null
After clearing the variables, it also calls a MessageBox that displays the Total Consultations.
Special Button - Senior Citizen / PWD. This button also calls Form 2, but instead of adding to the tail, it adds to the head.
Button 5 - Exit. This closes the application by calling:
Application.Exit();
Stack of Notebooks (Array Implementation) | Buttons
Button 1 - Add Notebook. The intent of this button is to add a notebook on the top. It first checks if the current Stack is already at the limit (in this presentation, StackSize is limited to 10). Technically, what the program is checking is if the StackPointer is pointing at 11 which is greater than 10. If it's already more than 10, a MessageBox will be called to inform the user (the notebook will not be added.)
If the StackSize limit has not yet been reached, then the program calls my "push" method implemented using Arrays i.e. it adds on top.
Button 2 - Check Notebook. The intent of this button is to remove one notebook from the top. It first checks if the Stack is empty and if it is not empty, it calls my "pop" method implemented using Arrays i.e. it removes from the top. If it is empty, then it just displays a MessageBox informing the user (without calling "pop").
Button 3 - Peek At Notebook. This button just displays the name of the topmost notebook. It also checks if the Stack is empty or not, but it does not call the "pop" method.
Button 4 - Check All. The intent is to "pop" all the notebooks. Again, this checks if there are notebooks in the Stack. If there are none, then it just displays a MessageBox. If there are notebooks, then it loops the pop method.
Button 5 - Exit. This closes the application by calling:
Application.Exit();
Комментарии