Implementation of Data Structures and Algorithms (BTEC HND)
VerifiedAdded on 2023/03/21
|19
|1986
|100
Practical Assignment
AI Summary
This assignment provides a comprehensive exploration of data structures and algorithms, covering fundamental concepts and practical implementations using C#. The document begins by defining various data structures, including arrays, array lists, linked lists, stacks, queues, trees, and strings, along with their respective operations. It then delves into the implementation of algorithms, providing C# code for factorial and Fibonacci calculations, random number generation, and sorting algorithms such as insertion sort. The assignment further includes string manipulation techniques and a practical example of stack implementation. Flowcharts are provided to visualize the logic. This resource is designed to aid students in understanding and applying data structures and algorithms in a practical context. The document is a practical assignment for BTEC HND in Computer Systems Development.

Running head: BTEC HND IN COMPUTER SYSTEMS DEVELOPMENT
BTEC HND in Computer Systems Development
Name of the Student
Name of the University
Authors note
BTEC HND in Computer Systems Development
Name of the Student
Name of the University
Authors note
Paraphrase This Document
Need a fresh take? Get an instant paraphrase of this document with our AI Paraphraser

1BTEC HND IN COMPUTER SYSTEMS DEVELOPMENT
Data structures and valid operations on them
Data structure: Array
An array data structures is considered as the collection of similar stored data elements
stored in at contiguous locations in the memory. The main concept behind this data structure
is the to store multiple same types of data type together. In this way it becomes easier to
calculate the required memory as well as the position of every element in the memory as they
take the same amount of space while by simply adding offset value to the base value or the
starting position (i.e., memory location of the first element) stored in the array.
Available operations on Array
Traversal of the elements − This operation prints all array elements one by one as
stored in array.
Insertion of the elements – Adding element to the array at given index.
Deletion – Deletion of the element from a given index.
Search – Searching for a specific element using the index or value.
Update – This operation is helpful in updating an element at an index.
Data structure: Array list
The Array list can be defined as the resizable arrays that makes the use of the list
interface. The size of array list can be shrunk or grow according to the requirement of the
application that is using it. The elements in the array list can be accessed randomly.
Available operations
Insertion of the element
Traversal and printing
Data structures and valid operations on them
Data structure: Array
An array data structures is considered as the collection of similar stored data elements
stored in at contiguous locations in the memory. The main concept behind this data structure
is the to store multiple same types of data type together. In this way it becomes easier to
calculate the required memory as well as the position of every element in the memory as they
take the same amount of space while by simply adding offset value to the base value or the
starting position (i.e., memory location of the first element) stored in the array.
Available operations on Array
Traversal of the elements − This operation prints all array elements one by one as
stored in array.
Insertion of the elements – Adding element to the array at given index.
Deletion – Deletion of the element from a given index.
Search – Searching for a specific element using the index or value.
Update – This operation is helpful in updating an element at an index.
Data structure: Array list
The Array list can be defined as the resizable arrays that makes the use of the list
interface. The size of array list can be shrunk or grow according to the requirement of the
application that is using it. The elements in the array list can be accessed randomly.
Available operations
Insertion of the element
Traversal and printing

2BTEC HND IN COMPUTER SYSTEMS DEVELOPMENT
Searching specific element
Removal of elements
Sorting elements of the array list.
Data structure: Linked list
The Linked list is represented as a linear data structure. In this data structure, the
elements in the data structure is not stored at contiguous locations of the memory. The
elements stored inside any linked list are connected using pointers in each node along with
the data part with the node.
Insertion of elements − This operation is helpful in adding an element at the
beginning of linked list.
Deletion − Deletes an element from the beginning.
Display – prints all the elements in the linked list.
Searching of an element− Searches for an element with a given key.
Deletion − Deletes an element.
Data structure: Stack
Stack is another abstract data structure that had predefined capacity for certain
number of elements. This kind of data structure can be considered as a simple data structure
which only allows addition/removal of elements in some specific order. Whenever an
element is added to the stack then the it always is stored on the top of stack data structure. In
the similar manner whenever an element is removed from the stack, then the last inserted
element on the top is first removed.
Searching specific element
Removal of elements
Sorting elements of the array list.
Data structure: Linked list
The Linked list is represented as a linear data structure. In this data structure, the
elements in the data structure is not stored at contiguous locations of the memory. The
elements stored inside any linked list are connected using pointers in each node along with
the data part with the node.
Insertion of elements − This operation is helpful in adding an element at the
beginning of linked list.
Deletion − Deletes an element from the beginning.
Display – prints all the elements in the linked list.
Searching of an element− Searches for an element with a given key.
Deletion − Deletes an element.
Data structure: Stack
Stack is another abstract data structure that had predefined capacity for certain
number of elements. This kind of data structure can be considered as a simple data structure
which only allows addition/removal of elements in some specific order. Whenever an
element is added to the stack then the it always is stored on the top of stack data structure. In
the similar manner whenever an element is removed from the stack, then the last inserted
element on the top is first removed.
⊘ This is a preview!⊘
Do you want full access?
Subscribe today to unlock all pages.

Trusted by 1+ million students worldwide

3BTEC HND IN COMPUTER SYSTEMS DEVELOPMENT
Valid operations on the stack data structure
There are usually three operations are available for stack data structure which is
traversal, push and pop. Through the push an element is stored in the stack, using pop an
element is deleted from the stack and traversal is helpful in the displaying all the elements
stored in the stack.
Data structure: Queue
Similar to the stack, the queue is another liner data structure that acts as first in first
out manner. In this data structure first element is inserted at the one end or the REAR end.
On the contrary to the stack the removal of an element is takes place from another end which
is denoted as FRONT or the head. In this way the queue becomes an FIFO (First in First
Out) data structure. Therefore, an element inserted first is removed first.
Following are the valid operations on the queue data structure; Traversal of the
elements to access all the elements, Enque or the addition of the elements, Deque or deletion
of an element - This is the process of accessing each and every element of the queue.
Searching for an element and finally merging two queues.
Data structure: Tree
The tree abstract is a recursive collection of data nodes that starts from a root
node. Each of the node consist of a value as well as list of references to the last and next
nodes or to the children nodes. In the tree data structure, the no duplicate constraint is applied
and none of the child nodes points to the root.
Valid operations on the stack data structure
There are usually three operations are available for stack data structure which is
traversal, push and pop. Through the push an element is stored in the stack, using pop an
element is deleted from the stack and traversal is helpful in the displaying all the elements
stored in the stack.
Data structure: Queue
Similar to the stack, the queue is another liner data structure that acts as first in first
out manner. In this data structure first element is inserted at the one end or the REAR end.
On the contrary to the stack the removal of an element is takes place from another end which
is denoted as FRONT or the head. In this way the queue becomes an FIFO (First in First
Out) data structure. Therefore, an element inserted first is removed first.
Following are the valid operations on the queue data structure; Traversal of the
elements to access all the elements, Enque or the addition of the elements, Deque or deletion
of an element - This is the process of accessing each and every element of the queue.
Searching for an element and finally merging two queues.
Data structure: Tree
The tree abstract is a recursive collection of data nodes that starts from a root
node. Each of the node consist of a value as well as list of references to the last and next
nodes or to the children nodes. In the tree data structure, the no duplicate constraint is applied
and none of the child nodes points to the root.
Paraphrase This Document
Need a fresh take? Get an instant paraphrase of this document with our AI Paraphraser

4BTEC HND IN COMPUTER SYSTEMS DEVELOPMENT
Valid operations on the Tree
Insertion of the nodes − Inserts an element in a tree/create a tree.
Searching an element in the tree.
Preorder Traversal of the elements in the tree.
Inorder Traversal of the elements in tree.
Postorder Traversal of the elements in a tree.
Data structure: Strings
Strings data structures are the array of characters. The difference among a character
array and string is the string abstract data structure ends with the \0.
The valid operations are strlen to check the length, strcpy to copy an string, strcmp
for comparing two strings, strstr to find the occurrence of a substring.
Factorial Program
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace Factorial
{
Valid operations on the Tree
Insertion of the nodes − Inserts an element in a tree/create a tree.
Searching an element in the tree.
Preorder Traversal of the elements in the tree.
Inorder Traversal of the elements in tree.
Postorder Traversal of the elements in a tree.
Data structure: Strings
Strings data structures are the array of characters. The difference among a character
array and string is the string abstract data structure ends with the \0.
The valid operations are strlen to check the length, strcpy to copy an string, strcmp
for comparing two strings, strstr to find the occurrence of a substring.
Factorial Program
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace Factorial
{

5BTEC HND IN COMPUTER SYSTEMS DEVELOPMENT
class Program
{
static void Main(string[] args)
{
Console.WriteLine("Enter number for calculating factorial");
int num = Convert.ToInt32(Console.ReadLine());
long factr = RecurFactorial(num);
Console.WriteLine("{0} factorial is {1}", num, factr);
Console.ReadKey();
}
private static long RecurFactorial(int num)
{
if (num == 0)
class Program
{
static void Main(string[] args)
{
Console.WriteLine("Enter number for calculating factorial");
int num = Convert.ToInt32(Console.ReadLine());
long factr = RecurFactorial(num);
Console.WriteLine("{0} factorial is {1}", num, factr);
Console.ReadKey();
}
private static long RecurFactorial(int num)
{
if (num == 0)
⊘ This is a preview!⊘
Do you want full access?
Subscribe today to unlock all pages.

Trusted by 1+ million students worldwide

6BTEC HND IN COMPUTER SYSTEMS DEVELOPMENT
{
return 1;
}
return num * RecurFactorial(num - 1);
}
}
}
Fibonacci
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
{
return 1;
}
return num * RecurFactorial(num - 1);
}
}
}
Fibonacci
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
Paraphrase This Document
Need a fresh take? Get an instant paraphrase of this document with our AI Paraphraser

7BTEC HND IN COMPUTER SYSTEMS DEVELOPMENT
namespace ConsoleApp1
{
class Program
{
public static int Fibonacci(int num)
{
if (num == 0) return 0;
if (num == 1) return 1;
return Fibonacci(num - 1) + Fibonacci(num - 2);
}
static void Main(string[] args)
{
{
Console.Write("Enter the count of the elements in Fibbonacci series: ");
int length = Convert.ToInt32(Console.ReadLine());
for (int i = 0; i < length; i++)
{
Console.Write("{0} ", Fibonacci(i));
}
namespace ConsoleApp1
{
class Program
{
public static int Fibonacci(int num)
{
if (num == 0) return 0;
if (num == 1) return 1;
return Fibonacci(num - 1) + Fibonacci(num - 2);
}
static void Main(string[] args)
{
{
Console.Write("Enter the count of the elements in Fibbonacci series: ");
int length = Convert.ToInt32(Console.ReadLine());
for (int i = 0; i < length; i++)
{
Console.Write("{0} ", Fibonacci(i));
}

8BTEC HND IN COMPUTER SYSTEMS DEVELOPMENT
Console.ReadKey();
}
}
}
}
Random function and sorting
Flowchart
Console.ReadKey();
}
}
}
}
Random function and sorting
Flowchart
⊘ This is a preview!⊘
Do you want full access?
Subscribe today to unlock all pages.

Trusted by 1+ million students worldwide

9BTEC HND IN COMPUTER SYSTEMS DEVELOPMENT
Paraphrase This Document
Need a fresh take? Get an instant paraphrase of this document with our AI Paraphraser

10BTEC HND IN COMPUTER SYSTEMS DEVELOPMENT
Code
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
//using System;
using System.IO;
namespace ConsoleApp1
{
class Program
{
void inssort(int[] arra)
{
int n = arra.Length;
for (int i = 1; i < n; ++i)
{
int keys = arra[i];
int j = i - 1;
Code
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
//using System;
using System.IO;
namespace ConsoleApp1
{
class Program
{
void inssort(int[] arra)
{
int n = arra.Length;
for (int i = 1; i < n; ++i)
{
int keys = arra[i];
int j = i - 1;

11BTEC HND IN COMPUTER SYSTEMS DEVELOPMENT
while (j >= 0 && arra[j] > keys)
{
arra[j + 1] = arra[j];
j = j - 1;
}
arra[j + 1] = keys;
}
}
static void printsortArray(int[] arr)
{
int n = arr.Length;
for (int i = 0; i < n; ++i)
Console.Write(arr[i] + " ");
Console.Write("\n");
}
static void Main(string[] args)
{
while (j >= 0 && arra[j] > keys)
{
arra[j + 1] = arra[j];
j = j - 1;
}
arra[j + 1] = keys;
}
}
static void printsortArray(int[] arr)
{
int n = arr.Length;
for (int i = 0; i < n; ++i)
Console.Write(arr[i] + " ");
Console.Write("\n");
}
static void Main(string[] args)
{
⊘ This is a preview!⊘
Do you want full access?
Subscribe today to unlock all pages.

Trusted by 1+ million students worldwide
1 out of 19
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.