



















Study with the several resources on Docsity
Earn points by helping other students or get them with a premium plan
This page cannot be seen from the preview
Don't miss anything!




















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 Student ID Class Assessor name 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 D
Summative Feedback: Resubmission Feedback: Grade: Assessor Signature: Date: Internal V erifier’s Comments: IV Signature:
● 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 Examine abstract data types, concrete data structures and algorithms LO2 Specify abstract data types and algorithms in a formal notation Assignment Brief and Guidance: Assignment 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:
Step 2: Determine which data items and operations should be included in the models by identifying and determining which data objects and operations should be included in the models. Step 3: This attribute should be expressed in a formal manner so that it is easily understood and communicated. Step 4: This formal specification should be translated into good English. This is called a.h file in C++. The term "user interface" in Java refers to this. Step 5: Write the implementation after the specification is finalized. This contains the storage strategy as well as operating information. Separate functions are used to represent operational detail (methods). 1.1.2 Examples Describe about Doubly Linked List: Do the following two steps to add a node to the beginning of the list: Make a node with the previous pointer set to null and the next pointer set to the current head node. Assign the current head node's previous pointer to the newly generated node, then change the head node to the newly created node and size will be increase 1. Figure 1 Source code add first
Figure 2 Add first doubly linked list Follow these three steps to add a node to the end of the list: Retrieve the list's last node. Make a new node with the preceding pointer pointing to the tail node and the following pointer pointing to null. Assign the current tail node's next ponter, point to the newly generated node, then update the tail node to point to the newly constructed node.
Let's look at a specific example to help illustrate the definition of ATD. I'll create a DoublyLinkedList ATD that represents a LinkedList ATD. This LinkedList ADT is based on the LinkedList interface, which is as follows: As shown below, I created an interface: The operations of the Doubly LinkedList are described in detail here: addFirst (E e): increases the size of the collection by adding an element in front of it. addLast (E e): increases the size of the collection by adding an element after the previous element.
removeFirst: If there is a first element in the collection, it is removed and returned; if there isn't, an IllegalStateException is thrown with the appropriate message. removeLast(): If there is a last element in the collection, it is removed and returned; if there isn't, an IllegalStateException is thrown with the appropriate message. getFirst(): If there is a first element in the collection, it is returned but not removed; if there isn't, an IllegalStateException is thrown with the appropriate message. getLast(): If there is a last element in the collection, it is returned but not removed; if there isn't, an IllegalStateException is thrown with the appropriate message. size(): The number of elements in the collection is returned. isEmpty(): Whether or not the collection includes any elements is returned. Attributes of the Doubly LinkedList: Node
addLast (E e): increases the employee at the last of the list. I also create a node similar to an add first. If the value is not empty, the tail next will become a new node, and the new node prior will become a tail in the following step. The tail, on the other hand, will become a new node. Alternatively, the head and tail will merge to form a new node. Finally, the size will grow. Figure 8 Source code add last Figure 9 Result of add last
Figure 10 Add last employee diagram removeFirst: the employee at the top of the list have been removed. To begin, I'll check the condition to ensure it's not empty and then build a node. After that, I check a condition size = 1, which means the head will equal the tail and the result will be null. Alternatively, the head equals the next head, the previous head equals null, and the next node equals null. Finally, the size will shrink and the erased value will be returned.
Figure 13 Remove first employee diagram removeLast(): the employee at the last of the list have been removed. I also make sure it's not empty by removing it first. Also, verify the condition size = 1 similar to remove first, but in this case, the tail will equal the tail prior, the tail next will be null, and the node previous will be null. Finally, the size will be reduced and the return value will be removed.
Figure 14 Source code remove last Figure 15 Result remove last