Advanced Data Structures and Algorithms: A C# Programming Perspective
VerifiedAdded on 2025/05/04
|25
|3757
|471
AI Summary
Desklib provides solved assignments and past papers to help students succeed.

Contents
Introduction......................................................................................................................................2
LO1..................................................................................................................................................3
P1.................................................................................................................................................3
P2.................................................................................................................................................4
M1................................................................................................................................................5
M2................................................................................................................................................6
LO2..................................................................................................................................................7
P3.................................................................................................................................................7
M3................................................................................................................................................8
LO3..................................................................................................................................................8
P4.................................................................................................................................................8
P5...............................................................................................................................................12
M4..............................................................................................................................................13
LO4................................................................................................................................................13
P6...............................................................................................................................................13
P7...............................................................................................................................................14
M5..............................................................................................................................................15
Conclusion.....................................................................................................................................16
References......................................................................................................................................17
Figure 1: Data structures..................................................................................................................4
Figure 2: Queue data structures.......................................................................................................5
Figure 3: Stack data structures.........................................................................................................6
Figure 4: LIFO.................................................................................................................................7
Introduction......................................................................................................................................2
LO1..................................................................................................................................................3
P1.................................................................................................................................................3
P2.................................................................................................................................................4
M1................................................................................................................................................5
M2................................................................................................................................................6
LO2..................................................................................................................................................7
P3.................................................................................................................................................7
M3................................................................................................................................................8
LO3..................................................................................................................................................8
P4.................................................................................................................................................8
P5...............................................................................................................................................12
M4..............................................................................................................................................13
LO4................................................................................................................................................13
P6...............................................................................................................................................13
P7...............................................................................................................................................14
M5..............................................................................................................................................15
Conclusion.....................................................................................................................................16
References......................................................................................................................................17
Figure 1: Data structures..................................................................................................................4
Figure 2: Queue data structures.......................................................................................................5
Figure 3: Stack data structures.........................................................................................................6
Figure 4: LIFO.................................................................................................................................7
Paraphrase This Document
Need a fresh take? Get an instant paraphrase of this document with our AI Paraphraser

Figure 5: FIFO.................................................................................................................................8
Figure 6: Adding Job.......................................................................................................................8
Figure 7: Removing Job...................................................................................................................9
Figure 8: Selection sort algorithm.................................................................................................10
Figure 9: Merge sort algorithm......................................................................................................11
Figure 10: Operations of the stack.................................................................................................12
Figure 11: Menu............................................................................................................................14
Figure 12: Adding job in queue.....................................................................................................14
Figure 13: Removal of job.............................................................................................................15
Figure 14: Front job.......................................................................................................................15
Figure 15: Rear Job........................................................................................................................16
Figure 16: Total Number of jobs...................................................................................................16
Figure 17: Remove all elements....................................................................................................17
Figure 6: Adding Job.......................................................................................................................8
Figure 7: Removing Job...................................................................................................................9
Figure 8: Selection sort algorithm.................................................................................................10
Figure 9: Merge sort algorithm......................................................................................................11
Figure 10: Operations of the stack.................................................................................................12
Figure 11: Menu............................................................................................................................14
Figure 12: Adding job in queue.....................................................................................................14
Figure 13: Removal of job.............................................................................................................15
Figure 14: Front job.......................................................................................................................15
Figure 15: Rear Job........................................................................................................................16
Figure 16: Total Number of jobs...................................................................................................16
Figure 17: Remove all elements....................................................................................................17

Introduction
The given assessment is subcategorized into four different parts and in every part, the discussion
on data structure with respect to C# is provided in this report. The report consists of discussion
on operations such as the head (), dequeue(), enqueue() and many others with the help of
examples. The assessment consists of all the P points that are present in every LO’s and the
discussion with proper explanation is provided in the report. A program is also created and the
screenshots are given in the report. Use of C# is given in the program as per the requirements of
the assessment.
The given assessment is subcategorized into four different parts and in every part, the discussion
on data structure with respect to C# is provided in this report. The report consists of discussion
on operations such as the head (), dequeue(), enqueue() and many others with the help of
examples. The assessment consists of all the P points that are present in every LO’s and the
discussion with proper explanation is provided in the report. A program is also created and the
screenshots are given in the report. Use of C# is given in the program as per the requirements of
the assessment.
⊘ This is a preview!⊘
Do you want full access?
Subscribe today to unlock all pages.

Trusted by 1+ million students worldwide

LO1
P1
The data structure is a type of way through which the data can be gathered as well as organize in
a way so that different operations can be performed on the data and in an effective way as well.
The uses of data structures are widely increasing and all the fields of computer science are
adopting data structures in the field of artificial intelligence, graphics, and many other fields. The
examples of the data structures are arrays, queues, stack, etc. The data structures are of two
different types that are built-in data structures and user-defined data structures. In the built-in
data structure, integer, character, float, and pointer are there and in the user-defined data
structure arrays, lists and files are there, where the list data structure is further divided in linear
as well as in non-linear data structure. In the linear data structure, stacks and queues are included
and in non-linear lists trees and graphs are included (Gulisano et al., 2017).
Figure 1: Data structures
Various data structures are discussed here:
P1
The data structure is a type of way through which the data can be gathered as well as organize in
a way so that different operations can be performed on the data and in an effective way as well.
The uses of data structures are widely increasing and all the fields of computer science are
adopting data structures in the field of artificial intelligence, graphics, and many other fields. The
examples of the data structures are arrays, queues, stack, etc. The data structures are of two
different types that are built-in data structures and user-defined data structures. In the built-in
data structure, integer, character, float, and pointer are there and in the user-defined data
structure arrays, lists and files are there, where the list data structure is further divided in linear
as well as in non-linear data structure. In the linear data structure, stacks and queues are included
and in non-linear lists trees and graphs are included (Gulisano et al., 2017).
Figure 1: Data structures
Various data structures are discussed here:
Paraphrase This Document
Need a fresh take? Get an instant paraphrase of this document with our AI Paraphraser

Queue:
The data structures queue is a type of data structure that is open at both the end and do follow the
principle of FIFO where the elements are inserted from one end that is termed as the enqueue
and from another end the elements can be deleted so that is termed as dequeuing. The principle
of first in first out method is the principle that states that the data item that is inserted first will
get accessed first. For understanding the queue with an example let’s understand it with example.
People standing in a queue in a shopping mall for paying the amount at the counter. The one who
will be the first will pay first at the counter and the one standing, at last, will pay in last. The
operations that are performed in the data structure queue can be enqueue (), dequeue (), head (),
size (), capacity (), isEmpty (), isFull () and peek (). All these operations can be performed on the
queue data structures.
Figure 2: Queue data structures
(Source: (Tutorialspoint.com, 2019))
Stack:
The stack data structure is another data structure that can be used in any area in any field in order
to display the data that is present. The stack data structure based on the principle of LIFO that
The data structures queue is a type of data structure that is open at both the end and do follow the
principle of FIFO where the elements are inserted from one end that is termed as the enqueue
and from another end the elements can be deleted so that is termed as dequeuing. The principle
of first in first out method is the principle that states that the data item that is inserted first will
get accessed first. For understanding the queue with an example let’s understand it with example.
People standing in a queue in a shopping mall for paying the amount at the counter. The one who
will be the first will pay first at the counter and the one standing, at last, will pay in last. The
operations that are performed in the data structure queue can be enqueue (), dequeue (), head (),
size (), capacity (), isEmpty (), isFull () and peek (). All these operations can be performed on the
queue data structures.
Figure 2: Queue data structures
(Source: (Tutorialspoint.com, 2019))
Stack:
The stack data structure is another data structure that can be used in any area in any field in order
to display the data that is present. The stack data structure based on the principle of LIFO that

states Last in First out. The example of the last in first out is used in the computer system on the
browser. The previous arrows and next arrow present on the browser is the example of the stack.
On visiting on the web browser and visiting on different pages, new pages get open that can form
a stack and if one wants to go back to the previous page then back the browser will take the user
to the page that was used previously by the help of stack data structure and this is how the stack
data structure help in working with the computer systems as well.
Figure 3: Stack data structures
(Source: (Callicoder.com, 2019))
There are two different operations that are applied in the stack data structures that are push ()
operation and another one is pop () operation. These two operations help in inserting as well as
deleting the data items in the stack. The push () operation is used to add the elements in the stack
and the pop operation is used to remove the element from the stack. Another example through
which the stack operation can be understood is the plates kept in one order.
browser. The previous arrows and next arrow present on the browser is the example of the stack.
On visiting on the web browser and visiting on different pages, new pages get open that can form
a stack and if one wants to go back to the previous page then back the browser will take the user
to the page that was used previously by the help of stack data structure and this is how the stack
data structure help in working with the computer systems as well.
Figure 3: Stack data structures
(Source: (Callicoder.com, 2019))
There are two different operations that are applied in the stack data structures that are push ()
operation and another one is pop () operation. These two operations help in inserting as well as
deleting the data items in the stack. The push () operation is used to add the elements in the stack
and the pop operation is used to remove the element from the stack. Another example through
which the stack operation can be understood is the plates kept in one order.
⊘ This is a preview!⊘
Do you want full access?
Subscribe today to unlock all pages.

Trusted by 1+ million students worldwide

P2
The stack data structure is an ADT that works on the LIFO principle and this principle can be
understood by the example of a deck of cards. One card kept over another and the card that is on
the top should be removed first and the card that needs to be added in the last is the example of
the LIFO principle. As discussed above the operations of the stack data structures are push and
pop through which the data elements can get add as well as deleted from the stack. The example
to understand the LIFO is given here with the help of an image:
Figure 4: LIFO
(Source: (Theologygaming.com, 2019))
These operations are used for the function calls and this process occurs when the function enters
in to the stack and when the function call gets available then function arguments by default
entered or push in stack which is referred as the base pointers and whenever the function get to
return back to the caller, it will automatically return the function and it gets to pop out or get
deleted from the stack.
The stack data structure is an ADT that works on the LIFO principle and this principle can be
understood by the example of a deck of cards. One card kept over another and the card that is on
the top should be removed first and the card that needs to be added in the last is the example of
the LIFO principle. As discussed above the operations of the stack data structures are push and
pop through which the data elements can get add as well as deleted from the stack. The example
to understand the LIFO is given here with the help of an image:
Figure 4: LIFO
(Source: (Theologygaming.com, 2019))
These operations are used for the function calls and this process occurs when the function enters
in to the stack and when the function call gets available then function arguments by default
entered or push in stack which is referred as the base pointers and whenever the function get to
return back to the caller, it will automatically return the function and it gets to pop out or get
deleted from the stack.
Paraphrase This Document
Need a fresh take? Get an instant paraphrase of this document with our AI Paraphraser

M1
FIFO refers to the First in First Out principle that indicates that the element that will get the entry
first, will be removed first from the queue. The queue can be understood by the example of the
movie ticket counter queue. A person who is in the front position will get the ticket first and
leave the queue from the front position. And the addition of more people will be from the end of
the queue so this is the queue and FIFO principle.
Figure 5: FIFO
(Source: (Images-wixmp-ed30a86b8c4ca887773594c2.wixmp.com, 2019))
The output of the program is shown here to show the two most common operation of the FIFO
that is Enqueue() and Dequeue(). These two operations are used to add the elements as well as to
remove the elements from the queue. Here outputs are given as:
FIFO refers to the First in First Out principle that indicates that the element that will get the entry
first, will be removed first from the queue. The queue can be understood by the example of the
movie ticket counter queue. A person who is in the front position will get the ticket first and
leave the queue from the front position. And the addition of more people will be from the end of
the queue so this is the queue and FIFO principle.
Figure 5: FIFO
(Source: (Images-wixmp-ed30a86b8c4ca887773594c2.wixmp.com, 2019))
The output of the program is shown here to show the two most common operation of the FIFO
that is Enqueue() and Dequeue(). These two operations are used to add the elements as well as to
remove the elements from the queue. Here outputs are given as:

Figure 7: Removing Job
Figure 6: Adding Job
Figure 6: Adding Job
⊘ This is a preview!⊘
Do you want full access?
Subscribe today to unlock all pages.

Trusted by 1+ million students worldwide

M2
The sorting technique is used in the arrangement of the data in the order it can be either
ascending or in descending order. These sorting techniques help the user to find the required
element quickly and efficiently. There are many techniques through which sorting can be done
and there are:
Bubble sort.
Selection sort.
Merge sort.
Quicksort.
Insertion sort and many more.
These are effective and most commonly used sorting techniques, here is a comparison of the
selection sorting technique, as well as merge sorting technique, is given.
Comparison of Selection sorting and Merge sorting
The selection sort algorithm is based on the principle that helps in searching either the maximum
or the minimum element from the array that is not sorted and the task is to sort that array. For
understanding this let’s consider the array elements of 9, 7, 5, 2. This is an unsorted array that
needs to be sorted so the process starts with the smallest number 2 and swaps this with the largest
number 9, similarly pick the 5 and swap with the 7, continue this process the array will get sort.
The time complexity of the selection sort will be O (N2).
Algorithm of the selection sort is given as:
The sorting technique is used in the arrangement of the data in the order it can be either
ascending or in descending order. These sorting techniques help the user to find the required
element quickly and efficiently. There are many techniques through which sorting can be done
and there are:
Bubble sort.
Selection sort.
Merge sort.
Quicksort.
Insertion sort and many more.
These are effective and most commonly used sorting techniques, here is a comparison of the
selection sorting technique, as well as merge sorting technique, is given.
Comparison of Selection sorting and Merge sorting
The selection sort algorithm is based on the principle that helps in searching either the maximum
or the minimum element from the array that is not sorted and the task is to sort that array. For
understanding this let’s consider the array elements of 9, 7, 5, 2. This is an unsorted array that
needs to be sorted so the process starts with the smallest number 2 and swaps this with the largest
number 9, similarly pick the 5 and swap with the 7, continue this process the array will get sort.
The time complexity of the selection sort will be O (N2).
Algorithm of the selection sort is given as:
Paraphrase This Document
Need a fresh take? Get an instant paraphrase of this document with our AI Paraphraser

Figure 8: Selection sort algorithm
(Source: (Image.slidesharecdn.com, 2019))
Now let’s discuss merge sorting technique that differs from the selection technique. Merge sort
technique works on the principle of divide and conquer method. The merge sort technique helps
the array to get divide one array in two half arrays (Liu et al., 2017). The merge () function is used
for merging the arrays that are divided. The merge sorting is the algorithm that is considered as
recursive. Time complexity of the merge sort technique is T (n) = 2 T (n/2) + 0 (n).
(Source: (Image.slidesharecdn.com, 2019))
Now let’s discuss merge sorting technique that differs from the selection technique. Merge sort
technique works on the principle of divide and conquer method. The merge sort technique helps
the array to get divide one array in two half arrays (Liu et al., 2017). The merge () function is used
for merging the arrays that are divided. The merge sorting is the algorithm that is considered as
recursive. Time complexity of the merge sort technique is T (n) = 2 T (n/2) + 0 (n).

Figure 9: Merge sort algorithm
(Source: (I.stack.imgur.com, 2019))
LO2
P3
ADT is the Abstract data type which is the data type that resembles many existing data types that
are primitive. These ADT’s contains many operations as well as values of data which are
essential and have the operation constraints. Stack-based on the LIFO in which the elements
enter from last and deleted from first. The use of functions and attributes are here also the stack
functions are not visible in the program as the code remains hidden. As the operation of push
from the stack used for the addition of elements without function added in the main function.
This is justifying that stack has the abstract data type.
The web browser pages stored in the browser so that it can get remember and when the user
wants to visit on the previous page the by the help of previous arrow present on the browser the
request will be sent to the server so that the cache file is observed where the pages get stored,
(Source: (I.stack.imgur.com, 2019))
LO2
P3
ADT is the Abstract data type which is the data type that resembles many existing data types that
are primitive. These ADT’s contains many operations as well as values of data which are
essential and have the operation constraints. Stack-based on the LIFO in which the elements
enter from last and deleted from first. The use of functions and attributes are here also the stack
functions are not visible in the program as the code remains hidden. As the operation of push
from the stack used for the addition of elements without function added in the main function.
This is justifying that stack has the abstract data type.
The web browser pages stored in the browser so that it can get remember and when the user
wants to visit on the previous page the by the help of previous arrow present on the browser the
request will be sent to the server so that the cache file is observed where the pages get stored,
⊘ This is a preview!⊘
Do you want full access?
Subscribe today to unlock all pages.

Trusted by 1+ million students worldwide
1 out of 25
Related Documents

Your All-in-One AI-Powered Toolkit for Academic Success.
+13062052269
info@desklib.com
Available 24*7 on WhatsApp / Email
Unlock your academic potential
Copyright © 2020–2025 A2Z Services. All Rights Reserved. Developed and managed by ZUCOL.