Professional Documents
Culture Documents
IV Signature:
ASSIGNMENT 1 BRIEF
Qualification BTEC Level 5 HND Diploma in Business
Academic Year
Unit Tutor
Submission
Issue date
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
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
A data structure is a specialized format for organizing, processing, retrieving and storing data.
There are several basic and advanced types of data structures, all designed to arrange data to
suit a specific purpose. Data structures make it easy for users to access and work with the data
they need in appropriate ways. Most importantly, data structures frame the organization of
information so that machines and humans can better understand it.
In computer science and computer programming, a data structure may be selected or designed
to store data for the purpose of using it with various algorithms. In some cases, the algorithm's
basic operations are tightly coupled to the data structure's design. Each data structure contains
information about the data values, relationships between the data and -- in some cases --
functions that can be applied to the data.
For instance, in an object-oriented programming language, the data structure and its associated
methods are bound together as part of a class definition. In non-object-oriented languages,
there may be functions defined to work with the data structure, but they are not technically
part of the data structure.
In general, data structures are used to implement the physical forms of abstract data types.
Data structures are a crucial part of designing efficient software. They also play a critical role in
algorithm design and how those algorithms are used within computer programs.
For example: JavaScript arrays and objects are common coding structures used for storing and
retrieving information.
Some examples of how data structures are used include the following:
• Storing data: Data structures are used for efficient data persistence, such as specifying
the collection of attributes and corresponding structures used to store records in a
database management system.
• Managing resources and services: Core operating system (OS) resources and services
are enabled through the use of data structures such as linked lists for memory allocation,
file directory management and file structure trees, as well as process scheduling queues.
• Data exchange: Data structures define the organization of information shared between
applications, such as TCP/IP packets.
• Ordering and sorting: Data structures such as binary search trees -- also known as an
ordered or sorted binary tree -- provide efficient methods of sorting objects, such as
character strings used as tags. With data structures such as priority queues,
programmers can manage items organized according to a specific priority.
• Indexing: Even more sophisticated data structures such as B-trees are used to index
objects, such as those stored in a database.
• Searching: Indexes created using binary search trees, B-trees or hash tables speed the
ability to find a specific sought-after item.
These are the structures which are supported at the machine level, they can be used to make
non-primitive data structures. These are integral and are pure in form. They have predefined
behavior and specifications.
The non-primitive data structures cannot be performed without the primitive data structures.
Although, they too are provided by the system itself yet they are derived data structures and
cannot be formed without using the primitive data structures.
The Non-primitive data structures are further divided into the following categories:
Arrays
Arrays are a homogeneous and contiguous collection of same data types. They have a static
memory allocation technique, which means, if memory space is allocated for once, it cannot be
changed during runtime. The arrays are used to implement vectors, matrices and also other
data structures. If we do not know the memory to be allocated in advance then array can lead
to wastage of memory. Also, insertions and deletions are complex in arrays since elements are
stored in consecutive memory allocations.
Files
A file is a collection of records. The file data structure is primarily used for managing large
amounts of data which is not in the primary storage of the system. The files help us to process,
manage, access and retrieve or basically work with such data, easily.
Lists
The lists support dynamic memory allocation. The memory space allocated, can be changed at
run time also. The lists are of two types:
a) Linear Lists
The linear lists are those which have the elements stored in a sequential order. The insertions
and deletions are easier in the lists. They are divided into two types:
1. Stacks: The stack follows a “LIFO” technique for storing and retrieving elements. The
element which is stored at the end will be the first one to be retrieved from the stack.
The stack has the following primary functions:
a. Push(): To insert an element in the stack.
b. Pop(): To remove an element from the stack.
2. Queues: The queues follow “FIFO” mechanism for storing and retrieving elements. The
elements which are stored first into the queue will only be the first elements to be
removed out from the queue. The “ENQUEUE” operation is used to insert an element
into the queue whereas the “DEQUEUE” operation is used to remove an element from
the queue.
b) Non Linear Lists
The non linear lists do not have elements stored in a certain manner. These are:
1. Graphs: The Graph data structure is used to represent a network. It comprises of vertices
and edges (to connect the vertices). The graphs are very useful when it comes to study a
network.
2. Trees: Tree data structure comprises of nodes connected in a particular arrangement and
they (particularly binary trees) make search operations on the data items easy. The tree
data structures consists of a root node which is further divided into various child nodes
and so on. The number of levels of the tree is also called height of the tree.
The abstract data type (ADT) is a type (or class) for objects whose behavior is determined by a
set of values and a set of activities. The definition of ADT only refers to what activities will be
performed, not how these activities will be implemented. It does not specify how data will be
organized in memory and which algorithm will be used to perform the operations. It is called
abstract online because it provides an independent view of implementation. The process of
providing only the essentials and hiding the details is called abstraction. Data type users don't
need to know that the data type is deployed, for example, we used int, float, char data types
only with knowledge of possible values and operations. can be done on them without any idea
how these types are done. Therefore, users only need to know what kind of data can do, not
how it will do. We can think of ADT as a black box hiding the internal structure and design of
the data type. ADTs are dived into three types List ADT, Stack ADT, Queue ADT.
The queue is a linear structure in a particular order in which the operations are performed in
sequence in First In First Out (FIFO).
Symbol: queue
Data type: integer array [5] Data values: Q=[, ,3,8,9,1]
Operators:
Operators:
Operation Process Results
Enqueue(7 First, add element “7” to the rear position of the queue Q=[7,3,4,9,1]
) Q[]
Dequeue() Then, Remove the front element (“1”) from the queue S=[7,3,4,9, ]
Q[]
Peek() Later, return the value of the front element (“9”) of the S=[7,3,4,9, ]
queue
Front = 9
Q[]
IsFull() Checks whether queue Q [] is full or not and returns False
Boolean
type value
IsEmpty() Checks whether queue Q [] is empty or not and returns False
Boolean
type value
Here are some basic operations when working with Queue as follows:
Queue() {
front = -1;
rear = -1;
}
boolean isFull() {
if (front == 0 && rear == SIZE - 1) {
return true;
}
return false;
}
boolean isEmpty() {
if (front == -1)
return true;
else
return false;
}
int deQueue() {
int element;
if (isEmpty()) {
System.out.println("Queue is empty");
return (-1);
} else {
element = items[front];
if (front >= rear) {
front = -1;
rear = -1;
} /* Q has only one element, so we reset the queue after deleting it. */
else {
front++;
}
System.out.println("Deleted -> " + element);
return (element);
}
}
void display() {
/* Function to display elements of Queue */
int i;
if (isEmpty()) {
System.out.println("Empty Queue");
} else {
System.out.println("\nFront index-> " + front);
System.out.println("Items -> ");
for (i = front; i <= rear; i++)
System.out.print(items[i] + " ");
q.display();
}
}
The result
Inserted 4
Inserted 5
Queue is full
Front index-> 0
Items ->
1 2 3 4 5
Rear index-> 4
Deleted -> 1
Front index-> 1
Items ->
2 3 4 5
Rear index-> 4
P2 Determine the operations of a memory stack and how it is used to implement function calls in
a computer.
The stack operation may involve initializing the stack, using it, and then re-initializing it.
In addition to these basics, a stack is used for the following two main operations -
• Push (): Push (storing) an element on the stack.
• Pop (): Removes (accessing) an element from
the stack. When data is pushed onto the stack.
The most effective way to use the stack is to check the status of the stack. For the same
purpose, the following function is added to the stack -
• Peek (): get the top data element of the stack without deleting it.
• Is full (): check if the stack is full.
• Is empty (): check if the stack is empty.
At all times, we maintain a pointer to the last pushed data on the stack because this
pointer always represents the top of the stack. Hence it is named top. The top pointer
provides the top value of the stack without actually removing it.
Push Operation is a process of putting a new data element on a stack called a Push.
Push operation includes the following steps:
Step 1 - Check if the stack is full.
Step 2 - If the stack is full, create an error and exit.
Step 3 - If the stack is not full, increase from top to bottom to indicate the next
empty space. Step 4 - Add the data element to the position of the stack where
the top is pointing.
Step 5 - Return success.
The image above helps us to realize that the organization of the stack in main memory but in
which the top of the stack is only accessed in memory. Another way is to assume that the top
of the stack and the position just below the top are stored in special processor registers: the
top of the first register and the stack register.
Figure 7:The top of the stack in registers
Before executing a function, a program pushes all the parameters for the function to the stack
in the reverse order in which they were recorded. The program then issues a call telling which
function it wants to start. Instruct the call to do two things:
• First, it pushes the address of the next instruction, the return address, onto the stack.
• Then, it modifies the command cursor to point to the beginning of the function.
A call stack consists of stack frames (also called activation records or activation frames). These
are machine-dependent data structures and the ABI contains subroutine status information.
Each stack frame corresponds to a call to the subroutine that has not ended with a return. For
example, if a subroutine called Draw Line is currently running has been called by a Draws ape
subroutine, the top of the call stack may be laid out as shown in the next picture.
A diagram like this can be drawn in either direction as long as the position of the vertex. So the
direction of stack development is understood. Moreover, independently of this, the different
architectures about whether call stacks grow to higher addresses or towards lower addresses.
The logic of the diagram is independent of the address choice.
Figure 8: : Implement function calls in a computer
The stack frame at the top of the stack is for the currently executing routine. The stack frame
usually includes at least the following items (in push order):
• The arguments (parameter values) passed to the routine (if any);
• The return address back to the routine's caller (e.g. in the DrawLine stack frame, an address
into DrawSquare's code); and space for the local variables of the routine (if any).
A stack is a linear data structure in a specific order in which operations are performed in the
order of LIFO (Last In First Out) or FILO (First In Last Out), respectively.
Figure 10: Introduce The Stack
There are many practical examples of a stack. Consider an example of stacked panels in a
canteen. The top plate is the first one to be removed, that is, the last placed plate remains in
the stack for the longest time. So it can be seen simply to follow the order LIFO (Last In First
Out) / FILO (First In Last Out). Here are some basic operations associated with queues:
• Push (): Pushing an element on the stack.
• Pop (): Removing an element from the stack.
• Peek (): get the top data element of the stack, without removing it.
• isFull (): check if stack is full.
• isEmpty (): check if stack is empty. Example for stack and its operations: Name: Sta []
Symbol: stack
Data type: integer array [5] Data values: S = [, ,3,8,9,2]
Operators:
Operation Process Results
Push (7) First, add element “7” to the rear position of the stack S[] S=[7,3,8,9,2]
Pop () Then, Remove the front element (“1”) from the stack S[] S=[, ,3,8,9,2]
Peek() Later, return the value of the front element (“9”) of the S=[, .3,8,9,2]
stack S[]
Top = 3
IsFull() Checks whether stack S[] is full or not and returns Boolean False
type
value
IsEmpty() Checks whether stack S[] is empty or not and returns False
Boolean type
Figure 9: Introduce the Stack
value
Here are some basic operations when working with Stack as follows:
The result:
Print Stack before pop:
[0, 2, 4, 6, 8, 10, 12, 14, 16]
pop => 16
pop => 14
pop => 12
Print Stack after pop:
[0, 2, 4, 6, 8, 10]
Number on top of the stack is => 10
Is stack empty? Ans:false
Position of 8 from the top is 2
Position of 20 from the top is -1
objects?, W., 2021. What is the difference between Abstract Data Types and objects?. [online]
Computer Science Stack Exchange. Available at:
<https://cs.stackexchange.com/questions/51847/what-is-the-difference-between-abstract-
data-types-and-objects> [Accessed 31 March 2021].
WhatIs.com. 2021. What is abstraction? - Definition from WhatIs.com. [online] Available at:
<https://whatis.techtarget.com/definition/abstraction> [Accessed 31 March 2021].
Guru99.com. 2021. Abstraction in Java | Abstract Class & Method with Example. [online]
Available at: <https://www.guru99.com/java-abstract-class-method.html> [Accessed 31
March 2021].
mean?, W., Alam, A. and Kaushik, N., 2021. What does "data abstraction" exactly mean?.
[online] Stack Overflow. Available at: <https://stackoverflow.com/questions/3634915/what-
does-data-abstraction-exactly-mean> [Accessed 31 March 2021].
mean?, W., Alam, A. and Kaushik, N., 2021. What does "data abstraction" exactly mean?.
[online] Stack Overflow. Available at: <https://stackoverflow.com/questions/3634915/what-
does-data-abstraction-exactly-mean> [Accessed 31 March 2021].
programming?, W. and Holterman, H., 2021. What is an abstract data type in object oriented
programming?. [online] Stack Overflow. Available at:
<https://stackoverflow.com/questions/1692933/what-is-an-abstract-data-type-in-object-
oriented-programming> [Accessed 31 March 2021].
The Crazy Programmer. 2021. Types of Data Structures - The Crazy Programmer. [online]
Available at: <https://www.thecrazyprogrammer.com/2018/10/types-of-data-
structures.html> [Accessed 31 March 2021].
Page 26
Page 27