Docsity

1649 Assignment 2 data structure and algorithms, Assignments of Data Structures and Algorithms

Toggle sidebar
bg1
Higher Nationals in Computing
Unit 19: Data Structures and Algorithms
ASSIGNMENT 2
Assessor name: PHAN MINH TAM
Learner’s name: Huynh Cong Duy
ID: GCS200327
Class: GCS0905B
Subject code: 1649
Assignment due: Assignment submitted:
pf3
pf4
pf5
pf8
pf9
pfa
pfd
pfe
pff
pf12
pf13
pf14
pf15
pf16
pf17
pf18
pf19
pf1a
pf1b
pf1c
pf1d
pf1e
pf1f
pf20

Partial preview of the text

Download 1649 Assignment 2 data structure and algorithms and more Assignments Data Structures and Algorithms in PDF only on Docsity!

Higher Nationals in Computing

Unit 19: Data Structures and Algorithms

ASSIGNMENT 2

Assessor name: PHAN MINH TAM

Learner’s name: Huynh Cong Duy

ID: GCS

Class: GCS0905B

Subject code: 1649

Assignment due: Assignment submitted:

ASSIGNMENT 2 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 Huynh Cong Duy Student ID GCS Class GCS0905B Assessor name Phan Minh Tam 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 P4 P5 P6 P7 M4 M5 D3 D

ASSIGNMENT 2 BRIEF

Qualification BTEC Level 5 HND Diploma in Business Unit number Unit 1 9 : Data Structures and Algorithms Assignment title Implement and assess specific DSA Academic Year 2022 Unit Tutor TamPM Issue date 12 - Sep- 2022 Submission date IV name and 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.

Table of Contents

P4: Implement a complex ADT and algorithm in an executable programming language to solve a well-defined problem

  1. Queue solution .......................................................................................................................... 1
  2. Stack solution ............................................................................................................................ 6 P5: Implement error handling and report test results
  3. Test result ............................................................................................................................... 11 P6: Discuss how asymptotic analysis can be used to assess the effectiveness of an algorithm
  4. Asymptotic analysis ................................................................................................................. 12
  5. Example .................................................................................................................................. 14 P7: Determine two ways in which the efficiency of an algorithm can be measured, illustrating your answer with an example
  6. Two main Measures for the Efficiency of an Algorithm ............................................................. 15
  7. Demonstration ........................................................................................................................ 16 M4: Demonstrate how the implementation of an ADT/algorithm solves a well-defined problem
  8. How the implementation of an ADT/algorithm solves a well-defined problem ......................... 17
  9. How do you use the data structure in your whole application .................................................. 17 M5: Interpret what a trade-off is when specifying an ADT using an example to support your answer
  10. What is trade-off when specifying an ADT ................................................................................ 20
  11. Example .................................................................................................................................. 21 D3: Critically evaluate the complexity of an implemented ADT/algorithm
  12. Algorithm complexity .............................................................................................................. 21
  13. Evaluate the complexity of an implemented algorithm............................................................. 21 D4: Evaluate three benefits of using implementation independent data structures
  14. Three benefits of using implementation independent data structures ...................................... 22

P a g e | 3 Explaination: the Rear keeps on moving ahead and always points to the position where the next element will be inserted. Front remains at the first index. Nodescount is the number of node in queue 1.3. Application class

P a g e | 5

  • Option 2:
  • Option 3:

P a g e | 6

  • Option 4:
  1. Stack solution 2.1. Node class Explaination: Data Field, which contains the data stored in the current Node. Pointer Field of type Node, which contains the address information of the next Node in the stack. 2.2. Stack class

P a g e | 8 Explaination: Top is a new element is added at one end of the stack. NodesCount is the number of nodes in stack 2.3. Stack Application class

P a g e | 9 2.4. Screenshots Application interface:

  • Option 1:

P a g e | 11 P5: Implement error handling and report test results

  1. Test results No. Actions Input test data Output test result 1 Select option 1 on the menu(queue) Hello world The message “Hello world” is stored into the queue 2 Select option 1 on the menu(queue) How are you The message “How are you” is stored into the queue 3 Select option 1 on the menu(queue) I’m fine The message “I’m fine” is stored into the queue 4 Select option 1 on the menu(queue) Thank you The message “Thank you” is stored into the queue 5 Select option 2 on the menu(queue) The message “Hello world” is deleted from queue 6 Select option 3 on the menu(queue) Message in the queue: 1. How are you, 2. I’m fine, 3. Thank you 7 Select option 4 on the menu(queue) Build successful 8 Select option 1 on the menu(stack) Collection The message “collection” is stored into the stack 9 Select option 1 on the menu(stack) Handle The message “handle” is stored into the stack 10 Select option 1 on the menu(stack) Save The message “save” is stored into the stack

P a g e | 12 11 Select option 1 on the menu(stack) Transmit The message “transmit” is stored into the stack 12 Select option 2 on the menu(stack) The message “transmit” is deleted from stack 13 Select option 3 on the menu(stack) Message in the stack: 1. Save, 2. Handle, 3. Collection 14 Select option 4 on the menu(stack) Build successful P6: Discuss how asymptotic analysis can be used to assess the effectiveness of an algorithm

  1. Asymptotic analysis 1.1. Definition Asymptotic analysis of an algorithm refers to defining the mathematical boundation/framing of its run- time performance. Using asymptotic analysis, we can very well conclude the best case, average case, and worst case scenario of an algorithm.  Best Case − Minimum time required for program execution.  Average Case − Average time required for program execution.  Worst Case − Maximum time required for program execution.