Download Data Structures and Algorithms - 1 and more Study Guides, Projects, Research Data Structures and Algorithms in PDF only on Docsity!
BTEC LEVEL 5 HND DIPLOMA IN BUSINESS
UNIT 19
DATA STRUCTURES AND ALGORITHMS
ASSIGNMENT
No.
Learner’s name: Huỳnh Thanh Dương
Assessor name: Lê Ngọc Thành
Class: GCS0804_NX
Learner’s ID: GCS
Subject’s ID: 1649
Assignment due: January 2021
Assignment submitted: February 2021
ASSESSMENT 1 BRIEF
Qualification BTEC Level 5 HND Diploma in Computing
Unit number Unit 19: Data Structures and Algorithms
Assignment title Examine and specify ADT and DSA
Academic Year 2021 – 2022
Unit Tutor Le Ngoc Thanh
Issue date January 2021 Submission date February 2021
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 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.
Learning Outcomes and Assessment Criteria
Pass Merit Distinction
LO1 Examine abstract data types, concrete data structures and algorithms
D1 Analyse the operation, using
illustrations, of two network shortest path
algorithms, providing an example of
each.
P1 Create a design specification for
data structures explaining the valid
operations that can be carried out on
the structures.
P2 Determine the operations of a
memory stack and how it is used to
implement function calls in a
computer.
M1 Illustrate, with an example, a
concrete data structure for a First In First
out (FIFO) queue.
M2 Compare the performance of two
sorting algorithms.
LO2 Specify abstract data types and algorithms in a formal notation
D2 Discuss the view that imperative
ADTs are a basis for object orientation
and, with justification, state whether you
agree.
P3 Using an imperative definition,
specify the abstract data type for a
software stack.
M3 Examine the advantages of
encapsulation and information hiding
when using an ADT.
ASSIGNMENT FRONT SHEET
Qualification BTEC Level 5 HND Diploma in Computing
Unit number and
title
Unit 19 : Data Structures and Algorithms
Submission date January 2021
Date Received 1st
submission
February 2021
Re-submission Date
Student Name Huỳnh Thanh Dương Student ID GCS
Class GCS0804_NX 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 Duong
Grading grid
P1 P2 P3 M1 M2 M3 D1 D
Table of Contents BTEC LEVEL 5 HND DIPLOMA IN BUSINESS UNIT 19 .................................................. 1 ASSESSMENT 1 BRIEF .............................................................................................. 2 TABLE OF CONTENTS ............................................................................................... 2
- INTRODUCTION .......................................................................................................... 5
- EXAMINE ABSTRACT DATA TYPES, CONCRETE DATA STRUCTURES AND ALGORITHMS ................. 5 2.1. P1 Create a design specification for data structures explaining the valid operations that can be carried out on the structures. .............................................. 5 2.2. P2 Determine the operations of a memory stack and how it is used to implement function calls in a computer. ................................................................ 18 2.3. M1 Illustrate, with an example, a concrete data structure for a First In First out (FIFO) queue..................................................................................................... 25 2.4. M2 Compare the performance of two sorting algorithms. ............................. 28 2.5. D1 Analyse the operation, using illustrations, of two network shortest path algorithms, providing an example of each. ............................................................ 31
- SPECIFY ABSTRACT DATA TYPES AND ALGORITHMS IN A FORMAL NOTATION ......................... 43 3.1. P3 Using an imperative definition, specify the abstract data type for a software stack. ...................................................................................................................... 43 3.1. M3 Examine the advantages of encapsulation and information hiding when using an ADT. ......................................................................................................... 46 3.2. D2 Discuss the view that imperative ADTs are a basis for object orientation and, with justification, state whether you agree. ................................................... 47
- CRITICAL EVALUATION ............................................................................................... 48
- REFERENCES............................................................................................................ 49
1. Introduction
I work as an internal software developer for Softnet Development Ltd, a software
shop that specializes in providing networking solutions. Your company was part of a
service delivery co-development project, and your company won a contract to design
and develop an intermediary software solution that will interface in the front-end
with multiple interfaces. Computer provisioning interfaces include SOAP, HTTP,
JML and CLI, and the backside - Networking the telecommunications provider
through CLI.
Your account manager has assigned you a special role that is to inform your team
about the design and implementation of abstract data types. I have been asked to
make a presentation to all collaborating partners on how to use ADT to improve
software design, development, and testing. Furthermore, I will write an introductory
report to distribute to all partners on how to specify abstract data types and
algorithms in a formal notation.
2. Examine abstract data types, concrete data structures and algorithms
2.1. P1 Create a design specification for data structures explaining the valid operations
that can be carried out on the structures.
Linked list
Figure 1 IIIustrate about linked list
Define
A linked list is a sequence of data structures consisting of a group of nodes connected
together through links forming a chain. Each node contains data at that node and
refers to the next node in the sequence.
Linked lists are the second most commonly used data structure after arrays. Here are
the basic concepts related to Link Lists:
Link: Each link of a linked list can hold a data called an element.
Next: Each link of a linked list contains a link to the next link called Next.
First: A linked list of links that link to the first link is called First.
Types of linked lists
✓ Simple Linked List: Single linked lists are the best and simplest examples of
dynamic data structures that use pointers to install. Therefore, pointer
knowledge is important for understanding how linked lists work, so if you do
not already have cursor knowledge, you should learn about pointers first. You
also need to understand some dynamic memory allocation. For simplicity and
simplicity, the content of setting up the linked list in this article will only cover
the single linked list.
Figure 2 For Example operate linked list
Code in Java:
Class Node
public void addAfter(Object findValue, Object addValue) { Node q = new Node(addValue); Node tmp = head; while (!tmp.info.equals(findValue)) { tmp= tmp.next; } q.next = tmp.next; tmp.next=q; public void deleteHead() { head = head.next; } public voide deleteTail() { Node tmp = head; while (!tmp.next.equals(tail)) { tmp = tmp.next; } tmp.next = null ; tail = tmp; } public void deleteAfter(Object x) { Node tmp = head; while (!tmp.next.equals(x)) {} } public void deleteNode(Object deleteValue) { Node tmp = head; while (!tmp.next.equals(deleteValue)) { tmp = tmp.next; } Node q = tmp.next; tmp.next = q.next; } //tail public void addTail(Object x) { Node q = new Node(addValue); if (isEmpty()) { head =q; tail =q; } else { tail.next=q; tail=q; } } public void printList() { for (Node tmp = head ; tmp!= null ; tmp = tmp.next)
System.out.print(tmp.info + " "); } System.out.print("\n"); } } }
✓ Doubly Linked List: Doubly Linked List is a variant of Linked List, in which
the operation of browsing through buttons can be done in two directions:
forward and backward easily. when compared to the Single Link List. Here are
some important concepts to keep in mind about Double Link Lists.
Figure 3 Node Linked List Figure 4 Doubly Linked List
Code in Java:
Class Node:
q.pre =tail; tail = q; } } //addFirst public void addFirst (Object info) { Node q = new Node(info); if (isEmpty()) { head = q; tail = q; } else { q.next=head; head.pre=q; head=q; } } public void addAfter(Object findValue, Object addValue) { //except 1 if (tail.info.equals(findValue)) { addTail(addValue); return ; } //except 2 not exist tmp == null Node tmp = head; while (tmp!= null && !tmp.info.equals(findValue)) { tmp = tmp.next; } if (tmp!= null ) { Node q = new Node(addValue); q.next = tmp.next; q.pre =tmp; tmp.next.pre =q; tmp.next =q; } } //Head delete Tail delete public void deleteHead() { head = head.next; head.pre = null ; } public void deleteTail() { tail = tail.pre; tail.next = null ; }
//deleteNode public void deleteNode(Object x) { if (head.info.equals(x)) { deleteHead(); return ; } if (tail.info.equals(x)) { deleteTail(); return ; } Node tmp =head; //process while (tmp != null && !tmp.info.equals(x)) { tmp = tmp.next; } if (tmp!= null ) { tmp.pre.next = tmp.next; tmp.next.pre = tmp.pre; } } }
✓ Circular Linked List: The Circular Linked List is a variation of the Linked List,
in which the first element points to the last element and the last element points
to the first element. Both the Singly Linked List and the Doubly Linked List
can be made into a ring linked list. Below we will learn how to create one.
Figure 5 Circular Linked List
Code in Java
Class Node:
public class Node { Object info; Node next; public Node() {} public Node(Object info) {
head.next=q; head=q; } } //Add a value at after A value which have been at list public void addAfter(Object findValue, Object addValue) { //except 1 if (tail.info.equals(findValue)) { addTail(addValue); return ; } Node tmp = head; do { if (tmp.info.equals(findValue)) { Node q = new Node(addValue); q.next = tmp.next; tmp.next = q; return ; } tmp = tmp.next; } while (!tmp.equals(head)); } //Head Delete Tail Delete public void deleteHead() { head = head.next; tail.next = head; } public void deleteTail() { Node tmp = head; while (tmp!= null && !tmp.info.equals(tail)) { tmp = tmp.next; } //Finding Node tmp stand before tail tmp.next = head; tail = tmp; } // Delete any value at list public void deleteNode(Object value) { if (head.info.equals(value)) { deleteHead(); return ; } Node tmp = head; do {
if (tmp.next.info.equals(value)) { Node q =tmp.next; tmp.next = q.next; return ; } tmp = tmp.next; } while (!tmp.next.equals(head)); } // Have do founded a value at list public boolean find(Object value) { Node tmp = head; do { if (tmp.info.equals(value)) return true ; tmp= tmp.next; } while (tmp.equals(head)); return false ; } }
Tree:
Figure 6 IIIustrate about Tree
Define
In computer science, a tree is a widely used data structure consisting of a set of nodes that are
linked together in a parent-child relationship. The tree in the first data structure is a simulation
(or in other words, a copy) of the tree (rooted) in graph theory. Almost every concept in a
graph theory tree is expressed in the data structure. However, trees in data structures have
found rich and effective applications in many algorithms. When analyzing algorithms on tree