You are on page 1of 17

ASSIGNMENT 1 BRIEF

Qualification BTEC Level 5 HND Diploma in Business

Unit number Unit 19: Data Structures and Algorithms

Assignment title Examine and specify ADT and DSA

Academic Year

Unit Tutor

Issue 0date Submission date

IV name and date Tran Ngoc Chau – GCS18804

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 Tutors. The form of submission will be a soft copy in PDF posted on corresponding
course of http://cms.greenwich.edu.vn/
Note: The Assignment must be your own work, and not copied by or from another student or from
books etc. 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 know how to reference
properly, and that understand the guidelines on plagiarism. If you do not, you definitely get fail

Assignment Brief and Guidance:

Scenario: You work as in-house software developer for Softnet Development Ltd, a software body-shop providing
network provisioning solutions. Your company is part of a collaborative service provisioning development project
and your company has won the contract to design and develop a middleware solution that will interface at the
front-end to multiple computer provisioning interfaces including SOAP, HTTP, JML and CLI, and the back-end
telecom provisioning network via CLI .

Your account manager has assigned you a special role that is to inform your team about designing and
implementing abstract data types. You have been asked to create a presentation for all collaborating partners on
how ADTs can be utilised to improve software design, development and testing. Further, you have been asked to
write an introductory report for distribution to all partners on how to specify abstract data types and algorithms in
a formal notation.

Tasks
Part 1

You will need to prepare a presentation on how to create a design specification for data structures, explaining the
valid operations that can be carried out on the structures using the example of:

1. A stack ADT, a concrete data structure for a First In First out (FIFO) queue.
2. Two sorting algorithms.
3. Two network shortest path algorithms.

Part 2

You will need to provide a formal written report that includes the following:

1. Explanation on how to specify an abstract data type using the example of software stack.
2. Explanation of the advantages of encapsulation and information hiding when using an ADT.
3. Discussion of imperative ADTs with regard to object orientation.

Learning Outcomes and Assessment Criteria

Pass Merit Distinction

LO1 Examine abstract data types, concrete data structures and


algorithms
D1 Analyse the operation, using
P1 Create a design M1 Illustrate, with an example, a illustrations, of two network
specification for data structures concrete data structure for a First shortest path algorithms,
explaining the valid operations In First out (FIFO) queue. providing an example of each.
that can be carried out on the M2 Compare the performance of
structures. two sorting algorithms.

P2 Determine the operations


of a memory stack and how it
is used to implement function
calls in a computer.

LO2 Specify abstract data types and algorithms in a formal notation

P3 Using an imperative M3 Examine the advantages of D2 Discuss the view that


definition, specify the abstract encapsulation and information imperative ADTs are a basis for
data type for a software stack. hiding when using an ADT. object orientation and, with
justification, state whether you
agree.
ASSIGNMENT 1 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 Tran Ngoc Chau Student ID GCS18804

Class GCS0805B Assessor name Nguyen Ngoc Tu

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 D2
 Summative Feedback:  Resubmission Feedback:

Grade: Assessor Signature: Date:


Internal Verifier’s Comments:

IV Signature:

Page 6
Table of Contents
LO1 Examine abstract data types, concrete data structures and algorithms ................................... 8

P1 Create a design specification for data structures explaining the valid operations that can be
carried out on the structures. What is an ADT .............................................................................. 8

How to implement the ADT ..................................................................................................... 8

P2 Determine the operations of a memory stack and how it is used to implement function calls in a
computer. .................................................................................................................................... 13

LO2 Specify abstract data types and algorithms in a formal notation ............................................ 16

P3 Using an imperative definition, specify the abstract data type for a software stack. .............. 16

References..................................................................................................................................... 17

Page 7
LO1 Examine abstract data types, concrete data structures and algorithms

P1 Create a design specification for data structures explaining the valid operations that can be
carried out on the structures.
What is an ADT
- ADT stands for Abstract Data Type, which is a type (or class) for objects whose behavior is
determined by a collection of values and operations. The definition of ADT only specifies what
operations are to be carried out, not how they will be carried out. It makes no mention of how
data will be stored in memory or the algorithms will be used to carry out the operations. It's
called "abstract" because it provides a perspective that is independent of execution.
Abstraction is the practice of presenting only the basics while concealing the information.

How to implement the ADT


• The consumer is kept in the dark.
• In different languages, the same ADT can be applied in various ways.
• Any languages come with built-in ADTs and/or functionality for implementing ADTs
(user-define types).

Modular architecture, which is critical in software development, is supported by ADTs.

List ADT

- The data is usually stored in a list with a head structure that includes a count, pointers, and the
address of the comparison function that is used to compare the data in the list.
- The data node includes a data structure pointer as well as a self-referential pointer to the next
node in the sequence.

What common operations can be carried out on the ADT

getFirst() remove(p)
getLast() removeFirst()
getNext(p) removeLast()

Page 8
getPrev(p) removeNext()
get(p) removePrev(p)
set(p, x) find(x)
insert(p, x) size()

How to implement the operations

▪ Linked Lists
- A connected list is a linear data structure in which the elements are not stored in memory in the
same order. A linked list's elements are linked using pointers, as seen in the image below:

Figure 1: Linked List

Types of Linked List:


➢ Simple Linked List: The only way to get around the items is to go ahead.
➢ Doubly Linked List: It is possible to traverse forward and backward through the objects.
➢ Circular Linked List: The last thing has a next link to the first element, and the first element has
a prior link to the last element.

Page 9
A linked list, in basic terms, is made up of nodes, each of which has a data field and a path to the next
node in the list.
▪ Singly linked lists
- A single linked list is the most basic kind of linked list. A singly linked list is a set of nodes connected
in a sequential manner, with each node containing a data field and an address field containing the
connection to the next node. A singly linked list can have several data fields, but it must have at least
one address field leading to the next node in the chain.

Figure 2: Singly linked lists

- To execute any operation on a linked list, we must keep track of the first node, which can be referred
to using the head pointer attribute. In a singly connected list, the last node's address field must
contain a NULL value indicating the list's end.

Page 10
Figure 3: Node.java

Figure 4: Mylist.java

Page 11
Figure 5: Myist.java(cont')

Figure 6: Main.java

Page 12
P2 Determine the operations of a memory stack and how it is used to implement function calls
in a computer.
What is a stack

- Stack memory is a memory usage function that requires machine memory to be used as a first-in-
last-out buffer for temporary data storage. A register called the Stack Pointer is one of the most
important components of stack memory operation. The stack pointer represents the actual stack
memory position and is automatically changed each time a stack operation is performed.(
Sciencedirect.com. 2021. Stack Memory - an overview | ScienceDirect Topics. [online] Available at:
<https://www.sciencedirect.com/topics/engineering/stack-memory> [Accessed 31 March 2021])

What are operations on stack

- Initializing the stack, using it, and then removing it are all common stack operations. A stack has two
primitive actions related to the definition in addition to these simple operations:

• The push () method adds a new feature to the stack.


• Delete an element from the stack with the pop () operation.

We must also search the stack's condition in order to make good use of it. Here are some of the
stack's other helpful features for this purpose:

• The peek () operation retrieves the top-of-the-stack data feature without removing it.
• isEmpty (): determines whether or not the stack is empty.
• Check whether the stack is complete or not with the operation isFull ().

Page 13
How to implement stacks

Figure 7: Array implementation of Stack

Array implementation of Stack

- The stack is generated using the array in array implementation. Arrays are used to execute all of the
operations on the stack. Let's look at how each operation can be performed using an array data
structure on the stack.
Page 14
Functionalities

• Common characteristics: Object[] a , int top, max


• Constructors: ArrayStack(int max), ArrayStack() – default max=50
• Common behaviors: isEmpty(), isFull(), clear(), grow(),push(), top(), pop()

Page 15
LO2 Specify abstract data types and algorithms in a formal notation

P3 Using an imperative definition, specify the abstract data type for a software stack.
What is an imperative definition

- The abstract data form is a type of data that has a collection of values and operations that
characterize its behaviour. We use the keyword "abstract" so we will use these data types to execute
various operations. However, the customer has little visibility of how such processes run. Although the
ADT is made up of primitive data forms, the operation logic is secret.

Using an imperative definition, specify the abstract data type for a software stack

An imperative-style description of an abstract stack, for example, might say that the state of a stack S
can only be changed by operations.

• push(S, x), where x is an unspecified number;

• pop(S), which returns a value with the condition that x is an unspecified value.

• The sequence of operations push(S, x); V pop(S) is equal to V x for any value x and any abstract
vector V.

This condition means that V pop(S) returns S to the state it had before the push since the assignment
V x cannot alter the state of S by itself (S, x). It follows, for example, from this condition and the
properties of abstract variables that the series

Page 16
References
1) GeeksforGeeks. 2021. Abstract Data Types - GeeksforGeeks. [online] Available at:
<https://www.geeksforgeeks.org/abstract-data-types/> [Accessed 12 April 2021].
2) Techopedia.com. 2021. What is an Abstract Data Type? - Definition from Techopedia. [online]
Available at: <https://www.techopedia.com/definition/28715/abstract-data-type> [Accessed 17
April 2021].
3) Quantrimang.com. 2021. Cấu trúc dữ liệu ngăn xếp (Stack) - Quantrimang.com. [online]
Available at: <https://quantrimang.com/cau-truc-du-lieu-ngan-xep-stack-156375> [Accessed 17
April 2021].
4) Tutorialspoint.com. 2021. Abstract Data Type in Data Structures. [online] Available at:
<https://www.tutorialspoint.com/abstract-data-type-in-data-structures> [Accessed 17 April
2021].

Page 17

You might also like