You are on page 1of 22

Higher Nationals in Computing

Unit 1: Programming
ASSIGNMENT 1

Learner’s name: Nguyễn Xuân Nam


ID:GCS200708
Class: GCS0905A
Subject code: 1618
Assessor name: PHAN MINH TAM

Assignment due: Assignment submitted:


ASSIGNMENT 1 FRONT SHEET

Qualification BTEC Level 5 HND Diploma in Computing

Unit number and title Unit 1: Programming

Submission date 3/10/2021 Date Received 1st submission

Re-submission Date 7/10/2021 Date Received 2nd submission

Student Name Nguyễn Xuân Nam Student ID GCS200708

Class GCS0905A 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
P1 M1 D1
 Summative Feedback:  Resubmission Feedback:

Grade: Assessor Signature: Date:

Signature & Date:


Assignment Brief 1 (RQF)
Higher National Certificate/Diploma in Computing

Student Name/ID Number:


Unit Number and Title: Unit 1: Programming
Academic Year: 2021 – 2022
Unit Assessor: Phan Minh Tam
Assignment Title: Problem solving with algorithms
Issue Date: 27 September 2021
Submission Date:
Internal Verifier Name:
Date:

Submission Format:

Format:

● The submission is in the form of an individual written report. 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:

LO1 Define basic algorithms to carry out an operation and outline the process of programming an
application

Assignment Brief and Guidance:

Assignment scenario

You have applied for a post as a trainee with a software development company and have been invited
for an interview. You have been asked to demonstrate your problem solving and basic programming
skills. To do this you have to prepare a report on using algorithms to solve problems.
You need to explain, using examples, how algorithms are used to solve simple business problems and
the steps needed to be followed to produce a working program solution. You should make clear your
assumption about your program. The problems to be solved will involve basic procedural programming
instructions - sequence instructions (input, output and assignment statements), loops, conditional
statements. Problems should be analysed and designed by the use of flowchart and demonstrated by
the use of modules (procedures).
Tasks:

 State your simple business problems to be solved.


 Analyse the problem and design the solutions by the use of suitable methods.
 Demonstrate the compilation and running of a program
 Evaluate how the problem is solved from the designed algorithm to the execution program
written by a specific programming language.

Learning Outcomes and Assessment Criteria

Pass Merit Distinction

LO1 Define basic algorithms to carry out an operation and outline the process of programming an
application

P1 Provide a definition of what M1 Determine the steps taken from D1 Examine the implementation
an algorithm is and outline the writing code to execution. of an algorithm in a suitable
process in building an language. Evaluate the
application. relationship between the written
algorithm and the code variant.
Table of Contents
P1. Provide a definition of what an algorithm is and outline the process in
building an application ..............................................................................1
1. What Is an Algorithm? ........................................................................................ 1
2. Three essential algorithm examples we should know ......................................... 2
#1. Binary search .................................................................................................... 2
#2. Merge sort ........................................................................................................ 4
#3. Adding and Removing from a linked list ........................................................... 5
3. Algorithm Flowcharts ......................................................................................... 5
4. The process in building an application ................................................................ 6
4.1 STEPS IN Program Development: Analyzing or Defining the Problem ............... 6
4.2 STEPS IN Program Development: Design .......................................................... 8
4.3 STEPS IN Program Development: Coding ........................................................ 11
4.4 STEPS IN Program Development: Documenting the Program ......................... 11
4.5 STEPS IN Program Development: Testing ....................................................... 11
4.6 STEPS IN Program Development: Debugging .................................................. 12
4.7 STEPS IN Program Development: Maintenance .............................................. 13
ASSIGNMENT 1 ANSWERS

P1. Provide a definition of what an algorithm is and outline the process in


building an application.

1. What Is an Algorithm?

The algorithm is a set or arrangement of instructions implemented by a human or a computer to


do a process. These instructions help in solving a complex problem or help to perform the
computation of data. Computers should follow these instructions to do a calculation or to perform
problem-solving operations. They are needed for simple processes such as the multiplication of
two numbers or complex problems searching for a compressed file’s contents. Programmers tend
to develop good algorithms so that the problems are solved in a better manner. And every
computerized device uses algorithms to perform its functions.

 An algorithm is a set of instructions for solving a problem or accomplishing a task.

 Every computerized device uses algorithms, which cut the time required to do things
manually.

 Algorithmic trading, also known as automated trading or black-box trading, uses a


computer program to buy or sell securities at a pace not possible for humans.

Examples:

 Sorting Algorithm: Selecting Sort, Bubble Sort, Insertion Sort, etc.

 Searching Algorithm: Linear Search, Binary Search, etc.


Page |1
2. Three essential algorithm examples we should know.
#1: Binary search
Binary search is an essential search algorithm that takes in a sorted array and returns the index of
the value we are searching for.

#2: Merge sort


Merge sort,uses a similar “divide and conquer” methodology to efficiently sort arrays.

Page |2
#3: Adding and Removing from a linked list
The linked list is a fundamental computer science data structure, that is most useful for it’s
constant time insertion and deletion. By using nodes and pointers, we can perform some
processes much more efficiently than if we were to use an array.

3. Algorithm Flowcharts.

Page |3
Page |4
Page |5
4. The process in building an application.

4.1 STEPS IN Program Development: Analyzing or Defining the Problem


• The problem is defined by doing a preliminary investigation
• Defining a problem helps us to understand problem clearly
• It is also known as Program Analysis
Tasks in defining a problem
• Followings are the tasks in order to define a problem
- Specifying the input requirements
- Specifying the output requirements
- Specifying the processing requirements
• The processing requirement is obtained by answering following questions
- What is the method (technique) required in producing the desired output?
- What are the validation checks that need to be applied to the input data?
- What calculations are needed?
• The output specification is obtained by answering the following questions

Page |6
- What values will be produced?
- What is the format of these values?
- What specific annotation, headings, or titles are required in the report?
- What is the amount of output that will be produced?
• The processing requirement is obtained by answering following questions
- What is the method (technique) required in producing the desired output?
- What are the validation checks that need to be applied to the input data?
- What calculations are needed?
Activity: Find Factorial Number
- Input: Positive integer number
- Output: Factorial of that number
- Process: Solution technique which transforms input to output.
- Factorial of a number can be calculated by the formula n!=1*2*3*…*n
Use-case diagram
• Use case diagrams are used to gather the requirements of a system
• So when a system is analyzed to gather its functionalities use cases are prepared
and actors are identified.
• The purposes of use case diagrams can be as follows:
- Used to gather requirements of a system
- Used to get an outside view of a system
- Identify external and internal factors influencing the system
- Show the interacting among the requirements are actors
Activity: Draw use-case diagram
• You are hired to develop FAI’s library system with following description
• Admin who could – Manage books, readers (staff, lecturers, and students), etc. –
Manage borrow/return books
• Users (staff, lecturers, students) who could – View/search books – Reserve books –
Page |7
Borrow/return books
• Please draw Use-case diagram for this scenario
4.2 STEPS IN Program Development: Design
Flowchart is a diagrammatic representation of an algorithm
It uses different symbols to represent the sequence of operations, required to solve a
problem It serves as a blueprint or a logical diagram of the solution to a problem
Modular Design
• Once the problem is defined clearly, several design methodologies can be applied
• An important approach is Top-Down program design
• It is structured design technique
- It breaks up the problem into a set of sub-problems called
- Modules
- It creates a hierarchical structure of the modules
Flowchart

Page |8
Page |9
• Flowchart is a diagrammatic representation of an algorithm
• It uses different symbols to represent the sequence of operations, required to solve

P a g e | 10
a problem
• It serves as a blueprint or a logical diagram of the solution to a problem
4.3 STEPS IN Program Development: Coding
• An algorithm expressed in programming languages is called Program
• Writing a program is called Coding
• The logic that has been developed in the algorithm is used to write program
4.4 STEPS IN Program Development: Documenting the Program
• Document explains
- How the program works and how to use the program (user manual)
- How to maintain the program (developer manual)
• Details of particular programs, or particular pieces of programs, are easily forgotten
or confused without suitable documentation
Forms of documentation
• Documentation comes in two forms
- External documentation, which includes things such as reference manuals,
algorithm descriptions, flowcharts, and project workbooks
- Internal documentation, which is part of the source code itself (essentially, the
declarations, statements, and comments)
Compiling and Executing the Program
• Compilation is a process of translating a source program into machine
understandable form
• The compiler is system software – It examines each instruction for its correctness –
It does the translation
• During the execution – Program is loaded into the computer’s memory – The
program instructions are executed
4.5 STEPS IN Program Development: Testing

P a g e | 11
• Testing is the process of executing a program with the deliberate intent of finding
errors
• Testing is needed to check whether the expected output matches the actual output
• Testing is done during every phase of program development
• Initially, requirements can be tested for its correctness
• Then, the design (algorithm, flow charts) can be tested for its exactness and
efficiency
Test criteria
• Programs are tested with several test criteria and the important ones are given
below
- Test whether each and every statement in the program is executed at least one
(Basic path testing)
- Test whether every branch in the program is traversed at least once (control flow)
- Test whether the input data flows through the program and is converted to an
output (data flow)
4.6 STEPS IN Program Development: Debugging

P a g e | 12
• Debugging is a process of correcting the errors
- Programs may have logical errors which cannot be caught during compilation
- Debugging is the process of identifying their root causes One of the ways is to print
out the intermediate results at strategic points of computation
- Another way is to use support from the IDE • Testing vs Debugging
- Testing means detecting errors
- Debugging means diagnosing and correcting the root causes
4.7 STEPS IN Program Development: Maintenance

P a g e | 13
• Program maintenance
- Continuing process of maintenance and modification
- To keep pace with changing requirements and technologies
• Maintainability of the program is achieved by
- Modularizing it
- Providing proper documentation for it
- Following standards and conventions (naming conventions, using symbolic
constants, etc.)

P a g e | 14
REFERENCES

 Riya Kumari(2 December 2020) https://www.analyticssteps.com/blogs/what-algorithm-


types-applications-characteristics [Accessed 2 October 2021]

 Hannah Squier https://www.codementor.io/learn-programming/3-essential-algorithm-


examples-you-should-know [Accessed 2 October 2021]

 Lucas Downey (6 June 2021) https://www.investopedia.com/terms/a/algorithm.asp


[Accessed 2 October 2021]

 Priya Pedamkar (2020) https://www.educba.com/what-is-an-algorithm/ [Accessed 2


October 2021]

 From Wikipedia (28 September 2021) https://en.wikipedia.org/wiki/Algorithm#Etymology


[Accessed 2 Oct 2021]

 Thomas H. Cormen, Charles E. Leiserson, Ronald L. Rivest, Clifford Stein (1990).


Introduction to Algorithms. United States, MIT Press.

P a g e | 15

You might also like