0% found this document useful (0 votes)
14 views

Assignment CoverSheet - English - Edited 1

Uploaded by

r.elmasri2
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
14 views

Assignment CoverSheet - English - Edited 1

Uploaded by

r.elmasri2
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 56

Qualification

HND in Computing (RQF)

Center Name Center Registration No

ABCHorizon Academy 91667

Student name Assessor name


Dr. Mohamad Obaid
Alyaa AL Ali

Unit Number/Name
19: Data Structures & Algorithms

Assignment number and title Submitted on

24/03/2023
Softnet Development Ltd

Student Declaration

Student signature: Alyaaalali Date: 24/03/2023


The data structure is a data organization management and storage
format that enables efficient access and modification

If the data elements are arranged in a string where they are in

One level and each element is related to the element before it and the
element

Next, they are called linear data structures and they are easy to
learn and implement

Where if the developer wants to add an element, he must go through all


the elements

Examples of linear data structures

1 – Definition of Array: an Array is a data structure containing several


data values all of which are of the same type

Imagine an array as a large chunk of memory divided into smaller blocks


of memory and each is capable of storing a data value of some type

This array consists of 6 data values type of data = integer

10 20 30 40 50 60
The data type of array elements

The data inside the array must be of the same type

80same
This Array is valid because all data are of the 90 70
type

"Alya
This Array is valid because all data are of "Al "Sara
the same type
a" i" h"

5 " Sarah
This Array is false because it contains a0different
Ali type
" of
data "

An example of two arrays, the first array contains, and the


second array contains three elements. I wrote it in the NetBeans
application. First, I built the array using the instruction, and
then I wrote the elements inside the array and specified its type
as an integer

Code with explanation


The result

2-Linked list: It is a type of linear data structure and is


similar to arrays, but it differs slightly from it in that linked lists
do not store elements in contiguous places in memory. They
also store data of any kind (integer or decimal number, etc.), but
the existing pointers cannot be increased. in the linked list or
decrease it

Types of linked lists

First, singly linked lists are the most primitive data structures.
Each node in a single linked list consists of a value and a
reference to the next node

Here is
Atwan the
next item

Here the element is


placed of any kind
A doubly linked list has a reference to the next and previous
nodes in the list

Here is
Here is the
Atwan the
title of the
next item
previous

Here the element is


placed of any kind

There are many applications in which linked lists are used,


such as switching music in music players, the track turns in a
multiplayer game, and other examples

An example of linked lists I wrote using NetBeans Operations


used on linked lists

1-insertion: Add an item

A B C

Add D item from


the linked list
header
D

2-Delete: remove an item

A B C D Delete the C element


from the list
3- Search: Search for a specific item using

3-Queue: Stores a list of elements into which an element can be inserted


along the end called tail and removed from the other called head and
only

FIRST
FIFO OUT

IN FIRST

The first-in-first-out element is always in the


queue
Basic Queue Data Structure Operations

The fundamental data structure queue operations are listed


below:

The process of adding or storing an element at the end of the


queue is described by the operation enqueue().

dequeue() Process of taking out of the queue or gaining access


to an element at the front

Without deleting it, peek() is used to receive the element at the


front of the queue

initialize()

creates a full queue that is empty ()

verifies whether the queue is full or empty ()

Verify that the queue is empty.

Queue applications in data structures

In situations when the FIFO technique (First In First Out) needs


to be implemented, a queue data structure is typically
employed. Some of the most popular uses for the queue in data
structures include the ones listed below:

1-scheduling requests for a single shared resource, such as disk


and CPU,
2-switches and routers in networking

3-dealing with website traffic

4-keeping the playlist up to date in media players

70 40 50 60

Front\head Rear\Tail

Here is the front of the Here is the end of


queue, and it contains the queue and
the first element stored contains the last
in the queue, which will element to be
be the first element out stored and will be
An example of a queue data structure in real life

Think of a crowd of people queuing to buy tickets to a concert.


The person in front of the line will be the first to get the ticket
and move forward in line after a new person joins from the back
of the queue. Similarly to this, the data added first will exit the
queue first in the data structure of the queue.

Additionally, check out the Breadth-First Search algorithm.

Other examples of queueing in practical settings include:

1-Those who ride the elevator

2- A line of cashiers in the store


3- A row of car washes

(https://www.naukri.com/learning/articles/queue-data-structure-types-
implementation-applications/, 2023)

In the following example, I


added three elements to the
queue with the add() function
and retrieved them one by one
with the poll() function.

The result

Stacks

The Last-In-First-Out (LIFO) concept is used by stacks in data


structures, a linear type of data structure that permits insertion
and deletion operations from the top end of the stack data
structure. Contiguous memory, which is an array, and non-
contiguous memory, which is a linked list, can both be used to
implement the stack. Many apps rely heavily on the stack.

The stack data structure is a linear data structure that follows


the FILO (First In, Last Out) or LIFO principles (First In Last
Out). A deck of cards, a stack of books, a stack of cash, and
many other objects are actual examples of stacks.

In this example, you are only permitted to operate on one end


of the stack, such as when adding and deleting books from the
top. As a result, only operations from the top of the stack can be
performed for insertion and deletion in the stack data structure.
At any given time, you can only get to the top of the stack.

A push is an act of adding a new element to the stack.

A pop operation is the removal or deletion of elements from the


stack.

Stack operation in data structures

For example, we have a collection of books

The first blue book is stored at the beginning of the stack

Then a second book was added in pink

Then a third book was added in red


We notice that the blue book that was added first has become at
the end of the stack, and the books above it must be removed to
be able to remove it

As for the red book, which was the last item to enter the stack,
its place is at the top of the stack, and it can be taken out
quickly

Simple stack operations in data structures

The operations that are used with the stack are as follows.
The process is by payment

In the push process, additional components are added to the


stack. It adds the new element to the top of the stack because
you can only add a unique element from one end.

I will explain the push process

60 push Top))

Top)) The last


60
element
The last 50 stored
element 50 on the
stored The first 40
stack
on the 40 element
30
stack 30 is stored
on the 20
20 stack

Stack Stack

The figure above shows the Bush process, where a new element
60 was added to the stack that contains four elements. We note
that the new element 60 has become at the top of the stack.

process pop
Since you only have one end to work with when working at the
top of the stack, removing an element from the stack once more
is referred to as pop. Taking an element out of the top of the
stack is therefore known as a pop operation.

15
(Top)

The last
element 15
stored
The first Pop
14 element 14
on the
is stored
stack 13
on the 13
12 stack 12

Stack Stack

Operation Peek
When performing a peek action, the highest member in the
stack is retrieved without being taken out of the collection of
data elements

To determine if a stack is empty, use the fullis() function

To determine if a stack is empty, use the isEmpty()


function.

I have written a simple example showing how the stack works


and what operations I can use on it
Code with explanation

The result

LAST
LIFO OUT
IN FIRST

The last element to go into the stack is always


the first to pop out of the stack

But if the data structures are multi-level, where each element


has multiple paths to communicate with other elements, for
example, when adding a new element, the developer does not
need to go through all the elements to add it, so he can move
from one element to another. These data structures are called
non-linear data structures, but they do not work quickly It
is characterized by the best efficiency in the use of computer
memory

An example of a nonlinear data structure is

1 – Graphs: This type of data structure consists of a limited


set of ordered pairs called characters and arcs of certain entities
called nodes
Chart Example:-

Graphs are used in many applications, including the Facebook


interface
2-Trees are data structures of a non-linear type, as they
are not arranged in an orderly manner. They are a tree and
consist of a root, a follower, leaves, and a node. They are used
when a desire is to arrange data in a hierarchical form.

The tree diagram:


Root
1

Child
3 4
2

Leaf

Child
5 6 7 8 9

13 Sibling
10 11 12
s
Operations that can be performed on the tree

Like any type of data structure, many operations can be


performed on it

1-Insert: When you want to add an item

2-Delete: When you want to delete an item

3-Search: When you want to search for an item

(https://www.geeksforgeeks.org/data-structures/, n.d.)

Now I will explain the sorting algorithm

A series of instructions known as a sorting algorithm arranges


the items in an array or list in a specific order after receiving the
input.

Sorts are most frequently done in ascending (A-Z, 0-9) or


descending (Z-A, 9-0) numerical or alphabetical (or
lexicographical) order.

The Importance of Sorting Algorithms

Sorting algorithms are crucial in computer science because they


frequently reduce the complexity of an issue. These algorithms
have numerous direct applications, including data structure
algorithms, divide-and-conquer strategies, database algorithms,
and searching algorithms.
It is very important, before choosing the sorting algorithm that
the developer wants, that he determines the requirements of the
system he is working on. He can ask and answer some
questions to be able to choose the appropriate algorithm.

Like how big is the collection being ordered? How much


memory is available to use? Can the group size increase?

Whereas, if the group that he wants to sort takes up a very large


space, it is better to use Insertion sort, which is not always the
fastest, but it does not need a lot of space to work instead of
using Merge sort because it can need a large amount of memory
to work

We note that there is a difference between the sorting


algorithms, and to choose the appropriate algorithm, the
difference between them must be understood, so I will make
a comparison of the sorting algorithms

Stitch algorithms are classified based on several things

1-Based on the number of Swaps: This represents how


frequently the algorithm swaps items to sort the input. The least
amount of permutations is required to sort the selection.
2-How many comparisons are there: The algorithm compares
these items multiple times before sorting the input. The above
examples of sorting algorithms required at least O(nlogn)
comparisons in the best case and O(n2) comparisons in the
worst case for most of the output, according to Big-O notation.

3-Depending on whether or not they use Recursion: Recursion


is used by several sorting algorithms, such as quicksort, to sort
the input. Non-Recursive techniques are used by other sorting
algorithms, such as selection sort and insertion sort. Last but not
least, some sorting algorithms, such as merge sort, use iterative
both

The direct sorting algorithm for a restricted set of


elements is insertion sort.

Example: In insertion sort, the base element is compared to the


previous elements. You can move the previous element to the
next location if the previous elements are larger than the parent
element.

Count from index 1 to the size of the input array.

[10 3 8 0 4 2]

1-

10 3 8 0 4 2
Key=3//staring from 1st index.

Here 'key' will be compared with the previous elements

In this case, 'key is compared with 10 since

3<10

Move element 10 to the next position and insert 'key' to the


previous position

Result:
3 10 8 0 4 2

2-

3 10 8 0 4 2

key = 8 //2nd index

10 > 8 //move 10 to 2nd index and insert 8 to the 1st


index.

Result: [ 3 5 8 1 4 2 ]
Result:

3 8 10 0 4 2
3-

3 8 10 0 4 2

key = 0 //3rd index

10 > 0 => [ 3 8 0 10 4 2 ]

8>0 => [ 3 0 8 10 4 2 ]

3>0 => [ 1 3 8 10 4 2 ]

Result:

0 3 8 10 4 2
4-

0 3 8 10 4 2

key = 4 //4th index

10 > 4 => [ 0 3 8 4 10 2 ]

8 > 4 => [ 0 3 4 8 10 2 ]

3 > 4 ≠> stop


Result:

0 3 4 8 10 2

5-

0 3 4 8 10 2

key = 2 //5th index

10 > 2 => [ 0 3 4 8 2 10 ]

8 > 2 => [ 0 3 4 2 8 10 ]

4 > 2 => [ 0 3 2 4 8 10 ]

3 > 2 => [ 0 2 3 4 8 10 ]

0 > 2 ≠> stop

Result:

0 2 3 4 8 10
The code for the insertion sort algorithm in java

public int[] insertionSort(int[] arr)


for (j =0; j < arr.length; j++) {
int key = arr[j]
int i = j - 1
while (i > 0 and arr[i] > key)
{
arr[i+1] = arr[i]
i -= 1
}
arr[i+1] = key
}
return arr;

Bubble Sort

Bubble sort is a straightforward algorithm that sorts a list,


allowing either lower or higher values to bubble up to the top,
much to how bubbles rise from the bottom of a glass. When it
moves through a list, the algorithm compares nearby items and
swaps them if necessary.

In comparison to other sorting algorithms like quicksort, bubble


sort is extremely sluggish with a worst-case complexity of
O(n2). On the other side, it is among the simplest sorting
algorithms to comprehend and implement from scratch.
From a technical standpoint, bubble sort makes sense for
sorting small arrays or in particular when sort algorithms are
being run on computers with astonishingly few memory
resources.

Bubble algorithm example:


First
Starting with [5, 3, 7, 8, 10], the algorithm compares the first two
elements in the array, 5 and 3. It swaps them because 3 < 5: [3,
5, 7, 4, 10]
It compares the next two values, 5 and 7. As 5 < 7, these are
already in order, and the algorithm moves on [3, 5, 7, 4, 10]
The next two values are also swapped because 4 < 7: [3, 5, 4, 7,
10]
The algorithm does not switch the last two values, 7 and 10
secondly,
because they are already in the right order.
There is no requirement to switch places since 3 5: [3, 5, 6, 7,
10]
Because 4 5: The algorithm switches the following two values.
[3, 4, 5, 7, 10]
No switch since 5 7: [3, 4, 5, 7, 10]
Again, 6 9, therefore there is no swap: [3, 4, 5, 7, 10]
The list is already sorted, but the bubble sort algorithm doesn't
realize this. Rather, it needs to complete an entire pass through
the list without swapping any values to know the list is sorted.
Third

[3, 5, 6, 7, 10] => [3, 5, 4, 7, 10]


[3, 5, 4, 7, 10] => [3, 5, 4, 7, 10]
[3, 5, 4, 7, 10] => [3, 5, 4, 7, 10]
[3, 5, 4, 7, 10] => [3, 5, 4, 7, 10]
Bubble sort is not the most effective sorting method.
Nevertheless, it's easy to comprehend and put into
practice on your code for the bubble algorithm in java

public class BubbleSort {


static void sort(int[] arr) {
int n = arr.length;
int temp = 0;
for(int i=0; i < n; i++){
for(int x=1; x < (n-i); x++){
if(arr[x-1] > arr[x]){
temp = arr[x-1];
arr[x-1] = arr[x];
arr[x] = temp;
}

}
}

}
public static void main(String[] args) {

for(int i=0; i < 15; i++){


int arr[i] = (int)(Math.random() * 100 + 1);
}

System.out.println("array before sorting\n");


for(int i=0; i < arr.length; i++){
System.out.print(arr[i] + " ");
}
bubbleSort(arr);
System.out.println("\n array after sorting\n");
for(int i=0; i < arr.length; i++){
System.out.print(arr[i] + " ");
}
After explaining the insertion sort algorithm and the bubble
algorithm and mentioning an example about it and a simple
explanation for it, I compared them using some properties such
as Space Complexity, Time Complexity

properties insertion sort Bubble Sort


Space Complexity O(1) O(1)
Time Complexity
O(n) Best, O(n* n) Best case
Average O(n* n) performance: O(n)
Worst cases Average case
performance:
O(n*n)
Worst case
performance:
O(n*n)
Stable: Yes Yes
Sorting In Place Yes

(https://www.freecodecamp.org/news/sorting-algorithms-explained-with-examples-
in-python-java-and-c/, 2019)

asymptotic analysis
When choosing the right algorithm for the program, we must
take care of many things, including the algorithm's ease of use,
safety, modularity, and maintainability. For our algorithm to be
effective, we must focus and care about the performance of the
algorithm. Before choosing the algorithm, we will evaluate its
performance

For example, I have a computer and say I run an algorithm on it


and when I run the algorithm I will calculate the time it takes
for the algorithm to solve a problem. It may take 2 seconds, but
there is a problem when using the same algorithm on another
machine and calculating the time. The result may vary, so the
method for calculating the time it takes to execute the algorithm
is not valid. Because it depends on the device itself, not the
algorithm, and we want to evaluate the performance of the
algorithm

So we will use approach analysis in algorithm analysis

using asymptotic analysis. Asymptotic analysis of an


algorithm involves defining mathematical limits or frameworks
for runtime performance. We can easily draw conclusions about
the algorithm's best case, the average case, and worst case
scenarios using asymptotic analysis
When performing asymptotic analysis, it is assumed that the
method will work in a specified time even when there are no
inputs. All other operators, except for "input", are constants.

Calculating the execution time of any operation in terms of


mathematical computation units is known as asymptotic
analysis. For instance, the running time of one operation is
calculated as f(n), but it may be calculated as g for another
operation (n2). This implies that when n increases, the running
time of the first operation will increase linearly, whereas the
running time of the second operation would increase
exponentially. Similarly, if n is considerably small, the running
times of both operations will be very similar.

An algorithm's time requirements often fall into one of three


categories:

Best Case The least amount of time necessary for the software
to run.

Average Case Average amount of time needed to run the


software.

The maximum time needed for program execution in the worst


case.
Asymptotic Notations

Following are the commonly used asymptotic notations to


calculate the running time complexity of an algorithm.

Ο Notation

Ω Notation

θ Notation

Big Oh Notation, Ο

It calculates the worst-case time complexity, or the maximum time an


algorithm can take to run

omega notation Ω

The formal notation to express the minimum execution time of the


algorithm is (n). It measures the best state complexity time, or the fastest
time an algorithm can run.
Using theta notation θ

The formal notation for expressing the lower and upper bounds of an
algorithm's execution time is (n). It is displayed as follows:

Notations of asymptotic values


Below is a list of some common asymptotes
constant − Ο(1)

logarithmic − Ο(log n)

linear − Ο(n)

n log n − Ο(n log n)

quadratic − Ο(n2)

cubic − Ο(n3)

polynomial − nΟ(1)

exponential − 2Ο(n)

There are usually many algorithms that can be used to solve a


problem. Thus, using a method to compare the answers and
decide which one is more optimal is essential. The procedure that
is used to compare algorithms to determine the best algorithm to
use to solve the problem we are facing should be

1-Independent of the computer and its settings, on which the


algorithm is executed.

2-Demonstrates a direct relationship between the number of


inputs.

3-It can unambiguously distinguish between two algorithms.

There are two types of these techniques, time complexity, and


space complexity, I'm going to explain them and then give an
example
Time Complexity: An algorithm's time complexity measures how
long it takes to complete a task about the size of the input. It
should be noted that the time required to complete the procedure
depends on the length of the input rather than the machine's real
processing speed.

The execution time of the valid algorithm is finite. The time


complexity metric is a highly helpful tool for algorithm study. It is
the amount of time required to finish an algorithm. The cost of
each fundamental instruction and the number of times it is
executed must be taken into account to evaluate the time
complexity.

An illustration of calculating the algorithmic complexity

Then, we use We utilize a language called "Big O notation" to


express how time-consuming an algorithm is. The algorithm's
running time is expressed in Big O notation in terms of how
quickly the output grows in comparison to the input (this input is
called "n"). As a result, if we say, for instance, that an algorithm's
running time increases "by the order of the size of the input," we

express that as "O(n)". The algorithm's running time is expressed


as "O(n2)" if we state that it increases "by the order of the square
of the size of the input."

The complexity of Space:

Memory must be able to store temporary data or the solution while


the program is running to solve problems utilizing computers. The
term "space complexity of the algorithm" refers to how much
memory the method needs to solve a certain problem.

The amount of space an algorithm uses to operate as a function of


input length is measured by its space complexity. Here's an
illustration: Imagine you are trying to determine the frequency of
an array's elements.

It is the quantity of memory required to finish an algorithm

We must concentrate on two aspects to estimate the memory


requirement:

1-A fixed component It is unaffected by the magnitude of the input.


It has memory for variables, constants, and instructions (code)

2-(2) A variable part: It is dependent on the input size. It includes


memory for the recursion stack, referenced variables, etc.

After I have defined the complexity and spatial complexity of the


algorithms, I will calculate the spatial and temporal complexity of the
algorithms.

First I have an algorithm for printer gateway based on the number of


times the user enters it

1 2n+2
The time complexity of the following algorithm is:

T(n)=1+1+1+2+2n

=2n+5

(https://www.tutorialspoint.com/data_structures_algorithms/
asymptotic_analysis.htm, n.d.)
ADT

first, we will analyze the many types of built-in data available to us.
The inbuilt data types include int, float, double, long, etc., and we
may do operations like addition, subtraction, division,
multiplication, etc. data type. Only when we need it can we define
these processes. Therefore, we can design data structures along
with their operations to simplify the process of handling problems.
Non-embedded data structures are known as Abstract Data Types
(ADT).

An object's behavior can be described by a set of values and a set


of actions, and this behavior is known as an abstract data type
(ADT). The definition of ADT merely specifies the actions that
must be taken, not how they must be carried out. It is unclear what
algorithms will be utilized to carry out the operations and how the
data will be structured in memory. It is named "abstract" because
it delivers an implementation-independent view.

Abstraction is the process of presenting only the basics while


obscuring the nuances.

The user of a data type does not need to be aware of how that
data type is implemented. For instance, we have been using
primitive values such as int, float, and char data types only with
the understanding that these data types can operate and be
performed without being aware of how they are implemented.

So, a user just needs to be aware of what a data type is capable


of, not how it will be used. Consider ADT as a "black box" that
conceals the internal organization and design of the data type. List
ADT, Stack ADT, and Queue ADT are the three ADTs that we will
now define.

Advantages:

Encapsulation: ADTs offer a mechanism to combine processes


and data into a single unit, making the data structure simpler to
manage and change.

Abstraction: ADTs make working with data structures possible


without requiring users to be familiar with implementation
specifics, which can make programming simpler and less error-
prone.

Data Structure Independence: Several data structures can be


used to implement ADTs, which can make it simpler to adapt to
shifting demands and requirements.

Information concealment: ADTs can safeguard data integrity by


limiting access and blocking unwanted changes.

Programming can become more flexible and modular because of


the modularity of ADTs, which can be coupled to create more
sophisticated data structures.

Disadvantages:

Adding ADTs may result in additional memory and processing


overhead, which could have an impact on speed.

Complexity: Implementing ADTs can be challenging, particularly


for big and intricate data structures.
Learning curve: Understanding the implementation and use of
ADTs is necessary for their use, which can take some time and
effort to learn.

Restricted Flexibility: Certain ADTs may not be suited for all sorts
of data structures or may have limited capabilities.

Cost: Putting ADTs into practice would call for more money and
resources, which would raise the price of development.

A simple example of stack push and pop is used

The result
(https://www.geeksforgeeks.org/abstract-data-types/, n.d.)
ASN

A common interface description language called Abstract Syntax


Notation One (ASN.1) is used to define data structures that can be
cross-platform serialized and deserialized. It is extensively used in
computer networking and messaging, particularly in cryptography.

ASN.1 modules, which are typically a subsection of a larger


standards document written in the ASN.1 language, are where
protocol developers describe data structures. The ASN.1 data
encoding description is independent of a specific computer or
programming language, which is a benefit. An ASN.1 compiler can
compile modules into libraries of code, or codecs, that decode or
encrypt the data structures because ASN.1 is both machine- and
human-readable. Several encodings, including packed, BER, and
XML, can be encoded or decoded using some ASN.1 processors'
code.

Example:-

FooProtocol DEFINITIONS :: = BEGIN

FooQuestion :: = SEQUENCE {
trackingNumber INTEGER،
question IA5String
}

FooAnswer :: = SEQUENCE {
questionNumber INTEGER،
answer BOOLEAN
}

END

(https://en.wikipedia.org/wiki/ASN.1, n.d.)
From what I learned in this course for Data Structures, I created
an application for encoding and decoding texts and files, as well
as images. I will explain how my application works

First, the user will see an interface that contains the following

Label
Text
1
box

Label
2

Label
Button
3
First, the user enters the texts he wants to honor in this box, then
he has to click on the encryption button

I have entered my name Alia to try the application, then I will press
the encryption button
The result

To decrypt I will press the decrypt button


But if the user wants to encrypt a file or an image, he must first
provide the file he wants on his device, then press the button, and
all the files and images on his device will appear to him, then he
chooses the image or file he wants and writes the password that
must contain 16 characters, then he presses Encryption button,
but if he wants to decrypt, he has to take the same steps and write
the same password that he entered when encrypting the file or
image, then press the decryption button

I will apply the steps to encrypt an image on my computer


I choose the image that I want to encrypt

Then I entered the 16-character password


The image has been encrypted after you click the Encrypt button

To decrypt the image, I selected the encrypted image, then


entered the password, and pressed the decrypt button
The images have been successfully decoded

The user can do the same steps by selecting a file

Now I will explain the code that I wrote to build the application

I used Visual Studio and wrote the code in C#

Then I called the libraries I


need

First, I built a class to


write the code inside
Then I declared the variables
and named it DSC using an
array Then I defined a
variable containing the
password and password
encryption and chose the
password mod

I declared a variable of type String, Then I wrote code to convert files


to bytes Then I wrote code to encrypt the bytes that were generated
from the previous code, Then I repeated the code, but for decoding
To activate the button for selecting the file or image, I
double-clicked the button, then I recognized a variable
of the type of open File Dialog and named it off.

Then I wrote a conditional sentence that if the user


chooses a file or images, they must be placed in a
textbook

To protect my code I implemented Error handling,


"try...catch. If the user entered incorrect information,
the program does not crash

For the user to know that he cannot encrypt


or decrypt a file whose size is larger than
255 MB because my program cannot do
that.
In a similar way, I wrote the
code for encoding text using the
array
Also, I wrote an Error handling button so
that the application would not collapse if
the user entered more than 16 numbers or
less, or entered symbols and texts.

I tried and entered 20 numbers, and I


got a message explaining what is
wrong
From my experience studying data structures and my practical
application in the program, I present to you an assessment of data
structures.

First I will explain the benefits of using data structures

Using a data format makes it easier to recover data from the


storage device.

Efficient and efficient handling of both small and large amounts of


data is provided by data structures.

When performing tasks such as storing, retrieving, or manipulating


data, the programmer can speed up the process by using the
correct data structure.

By using an efficient data structure approach, operations can


handle large amounts of data easily.

Most well-structured data structures, including arrays, stacks,


queues, graphs, trees, and linked lists, have well-constructed, pre-
planned actions such as storage, addition, retrieval, manipulation,
and deletion. Programmers can rely on these data structures while
using them.

I will give you an example to prove how the use of matrices


facilitates our work
If we want to store the grades of students in science, it is easy for
us to store them if there are one or two students, but if we have
200 students! It will be very difficult, but if we use the array to
store the students' scores, it may take only several minutes, and
the array not only helps us save time but also saves space, as by
using it we will be able to store the 200 degrees in one place and
with one variable name

It is common to calculate the arithmetic mean for students


in schools or universities and determine whether the
student failed or succeeded with his university average,
where the teacher must store all the student's grades,
collect them and divide them by their number, then if the
result is higher than 10, the student is successful, and if the
result is less than 10, then the student fails Without the
filter, it may take months to produce the results of the
application, but thanks to it, the student's results can be
released in very few days I have illustrated this with an
example using the Java language in the Netbeans
application

Code with explanation


The result

But of course, there are some downsides to using data structures,


which I will summarize as follows

negative aspects of data format

Important drawbacks of data format are listed below:

A highly qualified professional resource is needed to manage the


operations linked to a data structure in an application. Take the
above-mentioned array case, for instance. If we want the
components of the aforementioned array to appear in either
ascending or descending order, we must be familiar with sorting
algorithms like insertion sort, bubble sort, etc. Or a skilled
programmer can create their sorting method. Similar to this, there
might be other difficult tasks that need a committed professional's
help.

More manpower is needed for developing and maintaining


applications with larger applications or data structures. This could
raise the expense of maintaining data structures.
For instance, we have a variety of data structures at our disposal,
including arrays, queues, stacks, linked lists, trees, and graphs.
The more complex the program, the more such data structures will
be used. To develop and maintain the application, you might need
the assistance of several professionals.

Making your data structures can involve complicated algorithms


and take a lot of time and testing before they are fully reliable and
suitable for use in organizational settings. Again, this will result in
higher costs. Additionally, once development is complete, it's
possible to discover that the new data format is not as useful as
anticipated.

(https://www.scaler.com/topics/advantages-of-data-structure/, n.d.)

You might also like