Vous êtes sur la page 1sur 6

ALGORITHMS AND DATA

TYPES ASSIGNMENT 2
21334331

APRIL 25, 2017


UNIVERSITY OF WEST LONDON
21334331 ADT Nasser Matoorianpour

Contents
Introduction ............................................................................................................................................ 2
Question 1 ............................................................................................................................................... 3
Question 2 ............................................................................................................................................... 4
Question 3 ............................................................................................................................................... 4

1|Page
21334331 ADT Nasser Matoorianpour

Introduction
This assignment could be taken as a continuation on the previous assignment, as the case study is
that for a library. The assignment is divided into three question. Firstly, I have been asked to write an
algorithm for a singly-linked list (SLL) data type to store reminders and the java application to test
the algorithms function. Secondly, I have been asked to write an array based que which will be used
to store reminders, and a java application to test the same. Lastly, I have been asked to explain the
use of a binary search tree in the context of a library information system, and also show how such a
tree is used and filled.

2|Page
21334331 ADT Nasser Matoorianpour

Question 1
Create a suitable singly-linked list (SLL) data type to store reminders. Write an algorithm to insert a
reminder element:-
i) At the beginning of the list
ii) After a given reminder node.

One of the types of data structure is a Singly Linked Lists (SLL). There are nodes in this list. And
each node contains the contents of the node and necessary references or pointers about the
next node in the list. It does not store any references or pointers for the previous node in the list.

This created SLL begins with a node


constructor. This list enables me to
insert, remove or print any existing
elements of this task.

This screenshot shows the creation


and insertion of a new node to the
list.

3|Page
21334331 ADT Nasser Matoorianpour

This shows the


implementation of
the algorithm in java.

Question 2
The queue array will function written on the starting for every element that will add only to the end
of it.

Question 3
A binary search tree, abbreviated as BST. This is basically a link that is made up of a header and some
other elements. All these are connected with a root node that leads to other following nodes.

This shows that the BST is not


populated.

The test for the java application for


the BST.

4|Page
21334331 ADT Nasser Matoorianpour

5|Page

Vous aimerez peut-être aussi