Docsity
Docsity

Prepare for your exams
Prepare for your exams

Study with the several resources on Docsity


Earn points to download
Earn points to download

Earn points by helping other students or get them with a premium plan


Guidelines and tips
Guidelines and tips

1649 Datastructure Assignment 1 Pass, Assignments of Computer Science

dhakbavanevnajananenvjaejfeinia

Typology: Assignments

2020/2021

Uploaded on 06/29/2023

nicolasdaocter
nicolasdaocter 🇻🇳

23 documents

Partial preview of the text

Download 1649 Datastructure Assignment 1 Pass and more Assignments Computer Science in PDF only on Docsity! 1 University of Greenwich Data Structures & Algorithms Assignment No: 1/2 Name:Nguyễn Minh Đạo ID: GCS210351 Class: GCS1003B ProjectID: 1649 Instructor:Lê Ngọc Thành Due Date:26/02/2023 2 Assignment Brief 1 (RQF) Higher National Certificate/Diploma in Business Student Name/ID Number: Nguyễn Minh Đạo/GCS210351 Unit Number and Title: Unit 19: Data Structures and Algorithms Academic Year: 2021 Unit Assessor: Lê Ngọc Thành Assignment Title: Examine and specify ADT and DSA Issue Date: Submission Date: 28/02/2023 Internal Verifier Name: Date: 26/02/2023 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 Tutor. ● The form of submission will be a soft copy posted on http://cms.greenwich.edu.vn/ . ● Remember to convert the word file into PDF file before the submission on CMS. Note: 5 Learning Outcomes and Assessment Criteria (Assignment 1) 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. 6 ASSIGNMENT 1 FRONT SHEET Qualification BTEC Level 5 HND Diploma in Computing Unit number and title Unit 19: Data Structures and Algorithms Submission date 28/02/2023 Date Received 1st submission Re-submission Date Date Received 2nd submission Student Name Nguyễn Minh Đạo Student ID GCS210351 Class GCS1003B Assessor name Lê Ngọc Thành 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 Dao Grading grid P1 P2 P3 M1 M2 M3 D1 D2  Summative Feedback:  Resubmission Feedback: Grade: Assessor Signature: Date: Internal Verifier’s Comments: IV Signature: Features of ADT: +Abstraction: The user does not need to know how the data structure is implemented. +Improved Conceptualization: ADT improves our understanding of the real world. +Robust: The program is robust and capable of detecting faults. Implementation of an Abstract Data Type (ADT): +This is completely unknown to the user. +The same ADT may be implemented differently in different languages. +Several programming languages have ADTs and/or the ability to create ADTs (userdefine types). +ADTs provide modular design, which is essential in software development. b. Examples. As a result, a user only has to understand what a data type can accomplish, not how it will be implemented. Consider ADT to be a black box that conceals the underlying structure and design of the data type. Below is the definition and example of two ADTs namely ArrayList ADT and LinkedList ADT. b.1. ArrayList ADT ArrayList is a Collection of list type that uses array structure to store elements. The order of the elements is based on the order in which they were added, and the values of these elements may overlap. Figure2: Array List Data Structure We can't make an array list of primitive types like int, float, char, and so on. In such circumstances, the requisite wrapper class must be used. The size of a Java ArrayList is used to initialize it. The size of the array list is dynamic, changing as entries are added or withdrawn from the list. The ArrayList functions is given below: +add() -- inserts the element to the arraylist. +addAll() -- adds all the elements of a collection to arraylist. +clear() -- removes all the elements form arraylist. +get() -- returns the element present in the specified index. +contains() -- checks if the element is present in the arraylist. +set() -- replace the single element form an arraylist. +sort() -- sorts the arraylist according to specified order. +toArray() -- converts an arraylist to an array. +toString() -- converts the arraylist to a String. Code example of arraylist: b.2. LinkedList ADT Java LinkedList class can contain duplicate elements. Java LinkedList class can be used as a list, stack or queue. Important point about LinkedList: +maybe includes redundant parts. +keeps the additional items' order. +Asynchronous (non-synchronized) (non-synchronized). II. Determine the operations of a memory stack and how it is used to implement function calls in a computer (P2). 1. Definition of Stack memory. In a particular part of the computer's memory called a stack, functions' temporary variables are kept. Variables on a stack are created, saved, and initialized while the program is running. It serves as a short-term memory. The memory of the variable is automatically cleared when the computation is finished. Most of the time, methods, local variables, and reference variables are found in the stack section. The memory of the stack is accessed using the LIFO (Last In First Out) method. I'm talking about stack storage. A stack memory block comprising local primitives and object references is formed when a method is called. The block is disabled and moved on to the following method after the method is finished. Stack memory is a tiny fraction of heap memory. Basic operations of Stack: + Push: Increases the stack by one item. An overflow problem develops when the stack is completely full. + Pop: Takes something out of the stack. Things are shown in the order they were pushed, reversed. A flow condition is when the stack is empty. + Peek or Top: Returns the stack's top element without eliminate it. + isEmpty: Returns true if the stack is empty; otherwise, returns false. + size: specifies the stack's size. Figure5: Memory Stack 2. Operations of memory stack. In the memory of a computer, data is kept in linear data structures called memory stacks. They may also be known as lines. A stack must always contain the same type of data. Pop operation: Removing an element is referred to as a pop operation. There is only one element that can be removed since we can only access the element at the top of the stack. Just the top of the stack is removed. Peek operation: The user can view the element at the top of the stack using the peek operation. No changes are made to the stack during this process. Push operation: The act of pushing data onto a stack is referred to as a push operation. isEmpty: Determine if the stack is empty or not. The programmer must internally maintain the size of the stack, which will be updated throughout push and pop operations, in order to prevent conducting actions on an empty stack. Normally, the boolean result returned by the function isEmpty() True if size equals 0, else False. Figure6: Push and pop operations 3. How Stack used to implement function calls. Example for the working of function calls: The call stack is set up as a stack, so when a call is made, the caller pushes the return address into the stack. When the called subroutine is finished, it pops or pulls the return address off of the stack and hands control to that address. A call stack's main function is to store the return addresses. The location of the instruction at which the caller function can subsequently resume is required to be kept someplace when a subroutine is called. The last element pushed (inserted) into the stack is the first element popped (removed) from the stack, which is why stacks are referred to as last-in first-out (LIFO) data structures. Below is the example: by others. Nevertheless, a software stack's elements cooperate to effectively offer application services to the end user. Figure8: Software Stack An application is made up of a collection of functions that operate together in a defined architecture to provide certain services to the user. The most basic application architecture is made up of three layers: +When a consumer accesses the program through a website or web-based application portal, they view the presentation layer. +Application logic and business rules are included in the logic layer to help satisfy application requests. This layer controls data transit between the data layer and the display layer, performs computations, and makes decisions regarding how to handle requests. +When a computation is required or if it has to be moved to a user-visible presentation layer, the data layer is a server-side system that sends logic layer information. Advantages of software stack: +They provide the very bare minimum of software needed to achieve the intended outcomes. +Software stacks may be manually placed in computer templates or installed automatically in systems. +For customisable systems, software stack installation and use are same. As a consequence, the solutions provided are also reliable. +The vast majority of software stacks can run the entire package. Some also provide community forums. +Software stacks can be installed using an image or software specs. 2. Example of software stack LAMP includes the Linus operating system, the Apache Web server, the PHP application software, and the MySQL database. This is the most traditional Stack model and very solid. Note that PHP can be replaced by Python and Perl. Because all of the parts of a LAMP stack are open source and the stack can function on common hardware, it is quite common. A LAMP stack is loosely connected in contrast to monolithic software stacks, which are frequently tightly tied and frequently created for a specific operating system. Simply said, this indicates that although if the parts weren't intended to be used together, they have shown to be complimentary and are frequently utilized as a set. Nowadays, practically all Linux distributions have LAMP components. To build an LAPP stack, developers can switch MySQL with PostgreSQL. Another variation of this open source software stack for cloud-based development and service delivery is the LEAP stack (Linux, Eucalyptus, AppScale, Python). Conclusion After completing this report, I have learned a lot of useful information and gained a lot of new and important experiences with coding in future. With my new understanding of data structures and algorithms, I will be better able to prepare my projects in the future. References www.javatpoint.com. (2021). Abstract data type in data structure - javatpoint. [online] Available at: https://www.javatpoint.com/abstract-data-type-in-data-structure [Accessed 27 Feb. 2023]. www.javatpoint.com. (2021). ArrayList in Java - javatpoint. [online] Available at: https://www.javatpoint.com/java-arraylist [Accessed 27 Feb. 2023]. www.sciencedirect.com. (n.d.). Stack Memory - an overview | ScienceDirect Topics. [online] Available at: https://www.sciencedirect.com/topics/engineering/stack-memory. Yiu, J. (2021). Getting started with Cortex-M programming. Definitive Guide to Arm® Cortex®-M23 and Cortex-M33 Processors, [online] pp.19–51. doi:https://doi.org/10.1016/b978-0-12-820735-2.00002-0. Computer, in (2022). Stacks in Computer Memory: Definition & Uses - Video & Lesson Transcript | Study.com. [online] study.com. Available at: https://study.com/academy/lesson/stacks-in-computer-memory-definition-uses.html [Accessed 27 Feb. 2023]. Coder, G. (2017). ArrayList trong java. [online] GP Coder. Available at: https://gpcoder.com/2541-arraylist-trong-java/ [Accessed 28 Feb. 2023]. Deft (2019). ArrayList trong java với ví dụ cụ thể - Deft Blog. [online] Deft Blog. Available at: https://shareprogramming.net/arraylist-trong-java-voi-vi-du-cu-the/ [Accessed 28 Feb. 2023]. Coder, G. (2017). LinkedList trong java. [online] GP Coder. Available at: https://gpcoder.com/2555-linkedlist-trong-java/ [Accessed 28 Feb. 2023].
Docsity logo



Copyright © 2024 Ladybird Srl - Via Leonardo da Vinci 16, 10126, Torino, Italy - VAT 10816460017 - All rights reserved