













Study with the several resources on Docsity
Earn points by helping other students or get them with a premium plan
This page cannot be seen from the preview
Don't miss anything!














Learner’s name : Nguyen Tri Tai Assessor name : Le Ngoc Thanh Class : GCS0903A Learner’s ID : GCS Subject’s ID : 1649 Assignment submitted : 26/06/
Grading grid P 4 P 5 P 6 P 7 M 4 M 5 D3 D 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 Nguyen Tri Tai Student ID GCS Class GCS0903A Assessor name Le Ngoc Thanh 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
Assignment Brief 2 (RQF) Higher National Certificate/Diploma in Business Student Name/ID Number: Unit Number and Title: Unit 19: Data Structures and Algorithms Academic Year: 2021 Unit Assessor: Assignment Title: Implement and assess specific DSA Issue Date: Submission Date: Internal Verifier Name: Date: Submission Format: Format: ● The submission is in the form of an individual written report and a presentation. This should be written in a concise, formal business style using single spacing and font size 12. You are required to make use of headings, paragraphs and subsections as appropriate, and all work must be supported with research and referenced using the Harvard referencing system. Please also provide a bibliography using the Harvard referencing system. Submission ● Students are compulsory to submit the assignment in due date and in a way requested by the Tutor. ● The form of submission will be a soft copy posted on http://cms.greenwich.edu.vn/. ● Remember to convert the word file into PDF file before the submission on CMS. Note: ● The individual Assignment must be your own work, and not copied by or from another student.
● If you use ideas, quotes or data (such as diagrams) from books, journals or other sources, you must reference your sources, using the Harvard style. ● Make sure that you understand and follow the guidelines to avoid plagiarism. Failure to comply this requirement will result in a failed assignment. Unit Learning Outcomes: LO3 Implement complex data structures and algorithms LO4 Assess the effectiveness of data structures and algorithms Assignment Brief and Guidance: Assignment scenario Continued from Assignment 1. Tasks For the middleware that is currently developing, one part of the provision interface is how message can be transferred and processed through layers. For transport, normally a buffer of queue messages is implemented and for processing, the systems requires a stack of messages. The team now has to develop these kind of collections for the system. They should design ADT / algorithms for these 2 structures and implement a demo version with message is a string of maximum 250 characters. The demo should demonstrate some important operations of these structures. Even it’s a demo, errors should be handled carefully by exceptions and some tests should be executed to prove the correctness of algorithms / operations. The team needs to write a report of the implementation of the 2 data structures and how to measure the efficiency of related algorithms. The report should also evaluate the use of ADT in design and development, including the complexity, the trade-off and the benefits.
Implement a complex ADT and algorithm in an executable programming language to solve a well defined problem
1. Requirement of program Message transfer program: The system should be created with ADTs and algorithms for these two structures, and a demo version with a message of no more than 250 characters should be implemented. The demonstration should show some of these structures' most significant operations. Even though it is a demo, failures should be handled properly using exceptions, and certain tests should be run to demonstrate the validity of algorithms / actions. This programming include: Using a buffer (ADT STACK / Queue) during data transmission and reception Handling errors: Use the Exception catcher - the "try... catch" block - to capture and manage errors that occur during program execution. Program testing and reporting test results (Test case, test log) 2. Implement program in java To solve this problem, I have designed Stack and Queue ADT for handing the requirements as below: First, I have designed a “Message” object to store the messages in the system.
Class MyStack: Then, I will design the stack ADT for the system
Class main Finally, I will create a "Main" class for the system with the following functions
3. Error handling and report test results Error handling No program or segment may be regarded finished until the necessary error handling has been implemented. Unwanted program failures are a disaster - at most, they create disappointment since program users must redo their work for minutes or hours, but in life-critical programs, even the most minor program fault, if not managed appropriately, has the ability to kill someone. If a mistake is fatal in the sense that the program cannot reasonably continue, it must be able to "die gracefully." This implies that it must be
We will face several faults and exceptions when building the system, such as NullPointerException (thrown when the program tries to refer to an object but it has no location in memory, i.e. has a null value), IndexOutOfBoundsException, and so on: For example: As a result, when I implemented the system, I utilized try-catch to catch errors. Example:
Check the feature of receiving messages Check the feature of displaying all messages
Test case: A test case describes an input, action, or event, as well as the intended response. The purpose of the test case is to determine whether or not each feature of the software program is functioning properly
4. How the implementation of an ADT/algorithm solves a well-defined problem To get data to Destination Message, the system uses Queue as a buffer and Stack. A Transfer Function will do this. I'll demonstrate how the system works with the algorithm to help you visualize it. Test case ID Description Expected result Actual results Result 1 Enter a message here. The message is a maximum of 250 characters long. If it has more than 250 characters, an error warning is displayed. Enter your message here. If it is more than 250 characters, an error notice will show prompting you to input the message again String has a length restriction of 250 characters. Please try again. Fail 2 Check to see if a new function has been sent a message Enter a message here. This message has been added to the system. The message has been added to the system. Pass 3 Examine the message receiving feature The message will be received by the system. The message was received by the system. Pass 4 Examine the option to see all messages. Show all messages in the system. The system has shown all messages. Pass
Using Queue ADT In this system, I utilized three Queue functions to create a Buffer, including: Enum(), Enqueue() and Dequeue():
5. Evaluation the complexity of an implemented ADT/Algorithm To build an efficient Queue implementation in which Queue and Stack operations have the same time complexity O (1). However, the difficulty of the method in the Transfer function is O(n^2), thus when we execute this program, the complexity is likewise O(n^2). As a result, we can see that algorithm time increases in lockstep with algorithm complexity.: