Data Structures and Algorithms, High school final essays of English

Various topics related to data structures and algorithms, including the design specification for data structures, the operations of a memory stack and its use in implementing function calls, the abstract data type for a software stack, an example of a concrete data structure for a first in first out (fifo) queue, a comparison of the performance of two sorting algorithms (selection sort and quick sort), and the advantages of encapsulation and information hiding when using an abstract data type (adt). A comprehensive overview of these fundamental concepts in computer science, making it a valuable resource for students and professionals interested in understanding the principles of data structures and algorithms.

Typology: High school final essays

2021/2022

Uploaded on 06/18/2022

phi1952001
phi1952001 🇻🇳

1 document

1 / 31

Toggle sidebar

This page cannot be seen from the preview

Don't miss anything!

bg1
Data Structures
and Algorithms
Student Name: Trương Đường Phi
Class: GCS0903B
Teacher: Lê Ngọc Thành
pf3
pf4
pf5
pf8
pf9
pfa
pfd
pfe
pff
pf12
pf13
pf14
pf15
pf16
pf17
pf18
pf19
pf1a
pf1b
pf1c
pf1d
pf1e
pf1f

Partial preview of the text

Download Data Structures and Algorithms and more High school final essays English in PDF only on Docsity!

Data Structures

and Algorithms

Student Name: Trương Đường Phi

Class: GCS0903B

Teacher: Lê Ngọc Thành

content

1. Create a design specification for data structures explaining the valid

operations that can be carried out on the structures.(P1)

2. Determine the operations of a memory stack and how it is used to implement

function calls in a computer.(P2)

3. Using an imperative definition, specify the abstract data type for a software

stack.(P3)

4. Illustrate, with an example, a concrete data structure for a First In First out

(FIFO) queue.(M1)

5. Compare the performance of two sorting algorithms.(M2)

6. Examine the advantages of encapsulation and information hiding when using

an ADT.(M3)

There are three ADT data types: List ADT, Stack ADT, and Queue ADT:

Common ways to represent ADT:

A. VDM.

The Vienna Development Method (VDM) is a long-standing model-oriented formal method for developing computer-based systems and software. It consists of a set of mathematically sound languages and tools for expressing and analyzing system models early in the design process, before making costly implementation commitments.

B. Table. A table is a collection of items, each of which contains multiple pieces of information. One of these pieces of information is a search key. For instance, the search key in the following table below is "City”.

Stack memory

2. Determine the operations of a memory stack and how it is used to

implement function calls in a computer.(P2)

Stack memory acts as a queue, allowing data to be written to the top of the stack while also changing any information stored in subsequent locations based on the queue's depth. this. Reading from the top of the stack is the only option. Reading causes the information at the top of the stack to be removed and a new piece of information from the depth of the stack to be placed in its place, moving all information stored one position to the top. The person at the back of the line is the one who types first.

How does stack in memory actually work: a. An activation record (AR, also called Stack Frame) is allocated for it each time a method is called. b. This record typically contains the following information:

  1. Parameters and local variables used in the system known as
  2. A guide to the record of activation by the caller.
  3. Return address, Caller's instruction address immediately after the call.
  4. Value of return for a process not declared invalid.
  5. Since the activation record size varies for various system calls, the return value is located just above the caller's activation record.

Four instructions are used to manipulate the stack:

Push operation.

Pop activity.

Peek activity.

Search activity.

3. Using an imperative definition, specify the abstract data

type for a software stack.(P3)

Stack introduction:

An abstract data type (ADT) is a stack that is commonly used in most languages. It is called a stack as it behaves like a real-world stack, e.g. a deck of cards or a pile of plates, etc.

The following diagram depicts a stack and its operations:

Stack Operations:

push() − Pushing (storing) an element on the stack.

Peek()-Get the top data part of the stack without removing it.

IsFull()-Check if the stack is complete.

IsEmpty()-Check whether the stack is empty.

pop() − Removing (accessing) an element from the stack.

4. Illustrate, with an example, a concrete data structure for a First In First out (FIFO) queue.(M1)

The queue is an abstract data type or a linear data structure, similar to a stack data structure, in which the first element is added from one end known as the REAR (also known as the tail) and existing elements are removed from the other end known as the FRONT (also called the head).

Furthermore, the operation of the ticket counter can be viewed as an example of a queue, with the first person who stands in front of the ticket window being able to obtain a ticket and exit first and new people always standing in line from the beginning.

5. Compare the performance of two sorting algorithms.(M2)

The selection sort algorithm sorts an array by repeatedly finding the minimum element (considering ascending order) from unsorted part and putting it at the beginning. The algorithm maintains two subarrays in a given array. The subarray which is already sorted. Remaining subarray which is unsorted. In every iteration of selection sort, the minimum element (considering ascending order) from the unsorted subarray is picked and moved to the sorted subarray.

Indexing begins with the first unsorted element in each iteration. Stages from 1 to 3 are repeated until all of the elements are in their proper places.