Docsity
Docsity

Prepare for your exams
Prepare for your exams

Study with the several resources on Docsity


Earn points to download
Earn points to download

Earn points by helping other students or get them with a premium plan


Guidelines and tips
Guidelines and tips

Data Structures and Algorithms: Stack and Queue ADT Implementation, Thesis of Internet and Information Access

This assignment explores the fundamental concepts of abstract data types (adts) with a focus on stack and queue implementations. It provides a comprehensive overview of their operations, including push, pop, enqueue, and dequeue, along with real-world applications. The document also includes a practical component involving the development of a student management system, demonstrating the application of these data structures in a real-world scenario.

Typology: Thesis

2023/2024

Uploaded on 11/03/2024

anh-minh-32
anh-minh-32 🇻🇳

5

(2)

16 documents

1 / 14

Toggle sidebar

This page cannot be seen from the preview

Don't miss anything!

bg1
ASSIGNMENT 1 FRONT SHEET
Qualification BTEC Level 5 HND Diploma in Computing
Unit number and title Unit 19: Data Structures and Algorithms
Submission date
Date Received 1st
submission
Re-submission Date Date Received 2nd
submission
Student Name Nguyễn Minh Ánh Student ID BH00644
Class SE06203 Assessor name Tạ Quang Hiếu
Student declaration
I certify that the assignment submission is entirely my own work and I fully understand the consequences of plagiarism. I understand that
making a false declaration is a form of malpractice.
Student’s signature Anh
Grading grid
P1 P2 P3 M1 M2 M3 D1 D2
pf3
pf4
pf5
pf8
pf9
pfa
pfd
pfe

Partial preview of the text

Download Data Structures and Algorithms: Stack and Queue ADT Implementation and more Thesis Internet and Information Access in PDF only on Docsity!

ASSIGNMENT 1 FRONT SHEET

Qualification BTEC Level 5 HND Diploma in Computing Unit number and title Unit 19: Data Structures and Algorithms Submission date Date Received 1st submission Re-submission Date Date Received 2nd submission Student Name Nguyễn Minh Ánh Student ID BH Class SE06203 Assessor name Tạ Quang Hiếu Student declaration I certify that the assignment submission is entirely my own work and I fully understand the consequences of plagiarism. I understand that making a false declaration is a form of malpractice. Student’s signature Anh Grading grid P1 P2 P3 M1 M2 M3 D1 D

 Summative Feedback:  Resubmission Feedback:

Grade: Assessor Signature: Date: Internal Verifier’s Comments: IV Signature:

I. INTRODUCTION

As an in-house software developer for Soft Development ABK, I have been entrusted with a dual responsibility in my role as lead software project manager. This assignment aims to address two critical

applied to carry out the operations and how the data will be arranged in memory. Because it provides an implementationindependent view, it is referred to be "abstract." Users of data types don't always need to understand how those kinds are implemented. For instance, we've been utilizing primitive values like int, float, and char data types merely knowing that they may be used and operated upon without needing to know how they're implemented. 1.2. Stack ADT a. What is stack? An Abstract Data Type (ADT), or stack, is a widely used data type in most computer languages. Because it functions similarly to actual stacks, such a deck of cards or a pile of plates, etc., it was given the name "stack. The last element added would be the first element removed in a stack that adheres to the LIFO (Last in - First out) structure. b. Operations on stacks?  push(int data) to insert an element to the top of the stack  pop() to remove an element from the stack.  top() Returns the top element of the stack.  isEmpty() returns true if stack is empty else false.  size() returns the size of stack.

 Push(int data) function Push(int data): Boolean Purpose Add a new element to the top of the stack Parameters A new element with value is data Return The function will return true if the add is successful and fail if the add is not successful The push method checks whether the stack is empty or not. If it is empty then it places the new element as the top. If not empty, it creates a new node and assigns the element to be added to that node, then assigns the new node to the top of the stack and updates the top of the stack to point to the new node. Explanation: First, check if the list is empty or not. Given that there are two entries, we must append the parameter value of 91 to the beginning of the list. Consequently, the list's beginning now has the new value of 91.  Pop() Pop(): Integer Purpose Delete the element at the top of the stack Parameters No parameter Return If the list is null return null, if the list is not null method will return the deleted value Check if the stack is empty or not. If empty, return null. If not empty, then access the element at the top of the stack and store it in a temporary variable. Then, remove that element from the stack, and update the top of the stack to point to the next element. Returns a temporary variable containing the deleted element.

isEmpty(): boolean Purpose Check if the stack is empty or not Parameters No parameter Return Return true if the stack is null; return false otherwise. Compares the top of the stack with a special value, usually -1, to see if the stack is empty or not. If the top of the stack is equal to the special value, then the stack is empty and returns true. If not, then the stack is not empty and false is returned. Explanation: Image on the left, there are no elements in the list so it will return true. The remaining image, because it has 3 elements, will return true  size size(): int Purpose Get the total number of elements in the list. Parameters No^ parameter Return If the list has no elements, return 0. If there are, return the value of the counter variable count. First initialize a counter variable and assign it to 0. Initialize a pointer and assign it to the top of the stack. Repeat until the pointer is null: Increase the counter variable by 1. Update the pointer to the next element in the stack. Returns the counter variable.

Explanation: The image on the left, because the list has 2 elements, will return the value 3. The remaining image, because it has no elements, will return 0. c. Application of Stack Data Structure Function calls and recursion : When a function is called, the program's current state is pushed into the stack. The state is removed from the stack to allow the prior function to continue running after the function returns. Undo/Redo operations : Stacks are used by many programs' undo-redo features to maintain track of prior actions. Every action that is taken is added to the stack. The action can be undone by popping the top element of the stack and carrying out the opposite action. Expression evaluation : Expressions in infix, postfix, and prefix notations are evaluated using the stack data structure. Pushing operators and operands into the stack allows actions to be carried out based on the elements at the top of the stack. Browser history : To record the webpages you visit, web browsers employ stacks. The URL is added to the stack each time you visit a new page, and when you use the back button, the previous URL is removed from the stack.

Balanced Parentheses: To determine whether or not parentheses are balanced, utilize the stack data structure. A closing parenthesis is removed from the stack after an opening parenthesis has been pushed onto it. The parentheses are balanced if the stack is empty at the conclusion of the expression. d. Application of Stack in real life

  • CD/DVD stand.
  • Stack of books in a book shop.
  • Call center systems
  • Text editors have an undo and redo capability.
  • An array is used to store a web browser's history.
  • In any gallery, call logs, emails, and Google images are also kept in the form of a stack.
  • Notifications and YouTube downloads are likewise shown in LIFO order, with the most recent content appearing first.
  • RAM that is allocated by an operating system during the course of a process.
  1. First In First Out (FIFO) Queue a. What is Queue? A queue is a linear ADT that is limited to allowing insertions at one end and deletions at the other. It operates according to the first-in, first-out (FIFO) principle. As a result, the element added first is also the element that is initially taken out of the queue. b. Operations on Queue  Enqueue : Add an element to the back of the queue.  Dequeue : Remove the element at the front of the queue.  Peek : Return the element at the front of the queue without removing it.  isEmpty : Check if the queue is empty.  EnQueue(int number) function EnQueue(int number): Boolean Purpose Add an element to the end of the queue Parameters Value^ is^ number Return The function will return true if the add is successful and fail if the add is not successful EnQueue(int number): Boolean The enQueue function will push down the previous back position and move the item of type int to the rear

of the queue. If the queue is empty, the object being pushed is both front and back. Explanation : Currently on the list there are 2 people queuing to buy food and at this time more people will be sorted and displayed according to each member's code. With enQueue(11) as argument representing the value to add to the end of the row. Then return true if adding successfully and otherwise return false  Dequeue deQueue(): Integer Purpose Remove an element from the front of the queue Parameters No parameter Return The function will return the deleted value after deletion. The deQueue function removes the item at the head of the queue and, should the deletion be successful, returns the item. If delete fails for any reason—for example, an empty queue—Null is returned. The item that is in front will be the one that is deleted.

Explanation: The getFront() function returns the top id number of the food buyer. If the list is empty, it returns null. In the illustration you can see that when calling the function, it returns 98. c. Application of Queue Data Structure

  • Task Scheduling: Tasks can be scheduled using queues according to their priority or the order that they were received.
  • Resource Allocation: Resources, like printers or CPU processing time, can be managed and distributed using queues.
  • Batch Processing: Tasks like data analysis and picture rendering can be completed in batches using queues.
  • Message Buffering: In communication systems, such as message queues in messaging systems or buffers in computer networks, queues can be used to store messages.
  • Event Handling: In event-driven systems, such GUI apps or simulation systems, queues can be utilized to manage events. d. Applications of Queue in Networks
    • Queues in routers/ switches
    • Mail Queues
  1. Sorting Algorithms 3.1. What is Sorting Algorithms 3.2. Selection

3.3. Quick Sort

  1. Network Shortest Path Algorithms

III. CONCLUSION

IV. REFERENCES