














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!















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 Phan Minh Tri Student ID GCD Class GCD0904 Assessor name Pham Thanh Son 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 P 4 P 5 P 6 P 7 M 4 M 5 D3 D
Grade: Assessor Signature: Date: Internal Verifier’s Comments: IV Signature:
❖ Flowchart of enterMessages() Function
❖ Flowchart of process() Function
❖ An exception is traditionally defined as an occurrence that happens during program execution and breaks the usual flow of instructions. Java exceptions are specific events that signify that something terrible has occurred in the application and that it must either recover or quit. ❖ Java exception handling is vital because it helps to preserve the program's usual, desired flow even when unexpected occurrences occur. Programs may crash or requests may fail if Java exceptions are not handled. It is critical to manage Java exceptions to avoid the program from abruptly failing and losing data. A sudden system crash can be caused by a variety of factors, including inaccurate or unexpected data entry. ❖ The try – catch technique is the easiest way to handle exceptions. Put your code in the try block, and any Java exceptions thrown by the code are captured by one or more catch blocks. This function will capture any form of thrown Java exception. This is the most basic exception handling method. Figure 19 : Example of try – catch technique ❖ When implementing my program, there are some errors, exception like IndexOutOfBoundException (it is an unchecked exception which is thrown to indicate that an index of some sort is out of range), IOException, … Figure 20 : Handling error in my program
I. Big O (P6)
❖ Big O, often known as "algorithm complexity," is a phrase used to describe the amount of time it takes to perform an algorithm. Big O is frequently used by programmers to assess the effectiveness of alternative methods to the same problem. ❖ Big O may be summed up in one sentence: The running duration, is determined by the input (input value), which increases as the program runs.
❖ O(n) : Linear complexity. Consider the following function, which computes the sum of numbers from 1 to n: Figure 25 : Example of O(n)
❖ O(logn) : Figure 28 : O(logn)
II. Analyze performances (P7)
❖ Offer() function is used to perform transfer() function Type of message Data input Result Time Short message Hello Long message Fifteen years ago Steve Jobs introduced the first iPhone. He described it as three devices in one: a widescreen iPod with touch controls a revolutionary mobile phone and a breakthrough internet communications device. iPhone is still making headlines Table 2 : Analyze offer() function ❖ Poll() operation Type of message Data input Result Time Short message Hello Long message Fifteen years ago Steve Jobs introduced the first iPhone. He described it as three devices in one: a widescreen iPod with touch controls a revolutionary mobile phone and a breakthrough internet communications device. iPhone is still making headlines Table 3 : Analyze poll function