









Study with the several resources on Docsity
Earn points by helping other students or get them with a premium plan
Prepare for your exams
Study with the several resources on Docsity
Earn points to download
Earn points by helping other students or get them with a premium plan
This assignment is graded PASS
Typology: Assignments
1 / 16
This page cannot be seen from the preview
Don't miss anything!










Qualification BTEC Level 5 HND Diploma in Computing Unit number and title Unit 19 : Data Structures and Algorithms Submission date 30/06/2023 Date Received 1st submission Re-submission Date Date Received 2nd submission Student Name Student ID Class GCH1103 Assessor name Do Hong Quan 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 Grading grid P1 P2 P3 M1 M2 M3 D1 D
Grade: Assessor Signature: Date: Internal Verifierās Comments: IV Signature:
An abstract data type (ADT) is a concept or model of a data type that describes what operations can be performed on it, but not how they are implemented. An ADT hides the details of the data representation and implementation from the user, and provides an interface that defines the behavior of the data type. (Chauhan, 2023) Figure 1 : Abstract data type (Chauhan, 2023)
Pop (E item): Removes an item from the stack. It returns the item that was removed and updates the stack by making the next item the new top. Figure 3 : Pop() operation Peek(E item): return the top element from the stack without removing it.
Figure 4 : Peek() operation IsEmpty(E item): This operation checks whether the stack is empty. It returns a Boolean value indicating whether the stack contains any elements or not.
Figure 6 : Enqueue() operation Dequeue(E item) : Remove and return the element at the front of the queue. The next element in line becomes the new front of the queue. Figure 7 : Dequeue() operation
II. Part 2
In computer science, a memory stack is a data structure that stores data in a last-in, first-out (LIFO) order. This means that the most recently added data is the first data that will be removed. Memory stacks are used to store the state of a function call, including the function's parameters, local variables, and return address. A stack is a special area of computerās memory which stores temporary variables created by a function. In stack, variables are declared, stored and initialized during runtime. It is a temporary storage memory. When the computing task is complete, the memory of the variable will be automatically erased. (Martin, 2023) The basic operations of a memory stack are:
A pre-condition is a condition that must be true before a method or function is called. It specifies what must be in place before the method is executed. (Matthew, 2012) A post-condition is a condition that must be true after a method or function has finished executing. It specifies what the method will have accomplished when it finishes. (Matthew, 2012) An error-condition is not as commonly used as pre and post-conditions, but it can refer to conditions that are checked for errors at the beginning of a method. (Matthew, 2012)
Note:
References Chauhan, A., 2023. GeeksforGeeks. [Online] Available at: https://www.geeksforgeeks.org/abstract-data-types/ [Accessed 16 June 2023]. Kamil, A., 2019. eecs280staff.github.io. [Online] Available at: https://eecs280staff.github.io/notes/02_ProceduralAbstraction_Testing.html [Accessed 27 June 2023]. Martin, M., 2023. Guru99. [Online] Available at: https://www.guru99.com/stack-vs-heap.html [Accessed 27 June 2023]. Matthew, 2012. Devfright. [Online] Available at: https://www.devfright.com/what-are-pre-conditions-and-post-conditions-in-programming/ [Accessed 28 June 2023]. Rai, A., n.d. GeeksforGeeks. [Online] Available at: https://www.geeksforgeeks.org/introduction-to-stack-data-structure-and-algorithm-tutorials/ [Accessed 26 June 2023]. Sommerville, I., 2009. Chapter 27 Formal Specification. [Online] Available at: https://ifs.host.cs.st-andrews.ac.uk/Books/SE9/WebChapters/PDF/Ch_27_Formal_spec.pdf [Accessed 27 June 2023].