Data Structure Practical

Download as docx, pdf, or txt
Download as docx, pdf, or txt
You are on page 1of 32

CERTIFICATE

Name of the College: Smt. Maherbanu College of Science and Commerce


Akola
Name of the Department: BACHELOR OF COMPUTER APPLICATION
This is to certify that this book contains the bonafide record of the practical
work of
Mr. /Miss
_____________________________________________________
Of BCA-IInd year Semester-III for the subject Data Structure during the
Academic year
2023-2024
Dated: ……. / ……. / 20 __________________

____________________
Signature of the Teacher Head of the Department

( Note :In absence of certificate for record book (Appendix-G),


examinee should not be allowed to appear for the practical examination.)
……………………………………………………..……………............................ ...................................…
INDEX
Sr.No. Program Remark

1 Design Program to find sum of N numbers using


array.
2 Design Program to find factorial of N using array.

3 Design Program to find greatest amongest three given


numbers
4 Implementation of traversing technique in array.

5 Implimentation of insertion technique in array.

6 Implimentation of deletion technique in array

7 Implimentation of PUSH and POP operation on Stack

8 Implimentation of insertion and deletion technique in


Queue.

9 Implimentation of List data structure using i) array


ii)Singly linked list.

10 Implementation of recursive technique for finding


factorial of an integer.

11 Implement stack using i) array ii) Singly linked list

12 Implementation of Queue using singly linked list

13 Implementation of data insertion,deletion,search in


Binary search trees.
14 Implementation of data deletion in Binary search trees

15 Implementation of Linear search

16 Implementation of Bubble sort.

17 Implementation of Selection sort.

18 Implementation of Insertion sort.


1. Program to find Sum of N input Numbers using Array

#include<stdio.h>

#include<conio.h>

void main()

int n, sum = 0, c, array[100];

printf("Enter the number of integers you want to add: ");

scanf("%d", &n);

printf("\n\nEnter %d integers \n\n", n);

for(c = 0; c < n; c++)

scanf("%d", &array[c]);

sum += array[c]; // same as sum = sum + array[c]

printf("\n\nSum = %d\n\n", sum);

// return 0;

}
Output:

Enter the number of integers you want to add : 5

Enter 5 integers

54

55

Sum=115
2.Program in c to find factorial of N numbers

#include <stdio.h>

#include<conio.h>

int main() {

int n, i;

unsigned long long fact = 1;

printf("Enter an integer: ");

scanf("%d", &n);

// shows error if the user enters a negative integer

if (n < 0)

printf("Error! Factorial of a negative number doesn't exist.");

else {

for (i = 1; i <= n; ++i) {

fact *= i;

printf("Factorial of %d = %llu", n, fact);

} return 0;

OUTPUT:
3. Design :Program to find greatest among 3 given numbers using Array

#include <stdio.h>

int main()
{
int a[1000],i,n,min,max;

printf("Enter size of the array : ");


scanf("%d",&n);

printf("Enter elements in array : ");


for(i=0; i<n; i++)
{
scanf("%d",&a[i]);
}

min=max=a[0];
for(i=1; i<n; i++)
{
if(min>a[i])
min=a[i];
if(max<a[i])
max=a[i];
}
printf("minimum of array is : %d",min);
printf("\nmaximum of array is : %d",max);

return 0;
}

Output:
Enter size of the array : 5
Enter elements in array : 1 2 3 5 4
minimum of array is : 1
maximum of array is : 5
Practical No. 4
Aim: - Practical to demonstrate traversing of an Array.
# include<stdio.h>
# include<conio.h>
void main( )
{
int a[10], i, j, n;
clrscr();
printf(“Enter the range of array elements\n”);
scanf(“%d”,&n);
printf(“Enter the array elements\n”);
for(i=0; i<n; i++)
{
scanf(“%d\t”,&a[i]);
}
printf(“Array elements are-\n”);
for(i=0; i<n; i++)
{
printf(“%d\n”,a[i]);
}
getch();
}

OUTPUT
Enter the range of array elements
10
Enter the array elements
11
22
33
44
55
66
77
88
99
100
Array elements are –
11
22
33
44
55
66
77
88
99
100
Practical No.5
Aim: - Practical to demonstrate insertion operation of array.

#include<stdio.h>
#include<conio.h>
void main( )
{
int a[10],ub,k,n,item,i,max;
clrscr( );
printf(“Enter the range of an array\n”);
scanf(“%d”,&n);
printf(“Enter the array elements\t”);
for(i=0;i<n;i++)
{
scanf(“%d”,&a[i]);
}
max=10;
ub=n-1;
printf(“Enter the position of an element where you want to insert\n”);
scanf(“%d”,&k);
printf(“Enter the element you want to insert\n”);
scanf(“%d”,&item);
printf(“After inserting the new element into the array\t”);
if(ub==max-1)
{
printf(“Array Overflow\n”);
}
else
{
while(ub>=k)
{
a[ub+1]=a[ub];
ub--;
}
}
for(i=0;i<=n;i++)
{
if(i==k) {
a[i]=item;
}
printf(“%d\n”, a[i]);
}
getch();
}

OUTPUT
Enter the range of an array
5
Enter the array elements
11
22
33
44
55
Enter the position of an element where you want to insert
3
Enter the element you want to insert
100
After inserting the new element into the array
11
22
33
100 44
55

Practical No.6
Aim: - Practical to demonstrate deletion operation on array.
#include<stdio.h>
#include<conio.h>
void main( )
{
int a[10],lb,ub,k,n,i,max;
clrscr( );
printf(“Enter the range of an array\n”);
scanf(“%d”,&n);
printf(“Enter the array elements\t”);
for(i=0;i<n;i++)
{
scanf(“%d”,&a[i]);
}
max=10;
lb=0;
ub=n-1;
printf(“Enter the position of an element you want to delete\n”);
scanf(“%d”,&k);
if(ub==0)
{
printf(“Array Underflow\n”);
}
else
{
while(k<ub)
{
a[k]=a[k+1]; k++;
}
}
printf(“After deleting the element of an array\n”);
for(i=0;i<ub;i++)
{
printf(“%d\n”, a[i]);
}
getch();
}
OUTPUT
Enter the range of an array
5
Enter the array elements
11
22
33
44
55
Enter the position of an element you want to delete
1
After deleting the element into the array
11
33
44
55

Practical No.7 (i)


Aim: - Practical to demonstrate PUSH operation on Stack.
SOURCE CODE
# include<stdio.h>
# include<conio.h>
void main()
{
int n,item,top,max,i,Stack[10];
clrscr();
printf("Enter the range of stack elements\n");
scanf("%d",&n);
top=n-1;
max=10;
printf("Enter the Stack Elements are:-\n");
for(i=0;i<n;i++)
{
scanf("%d",&Stack[i]);
}
printf("Stack Elements\n");
for(i=top;i>=0;i--)
{
printf("TOP=%d\t%d\n",i,Stack[i]);
}
printf("Enter the number which you want to PUSH in the Stack\n");
scanf("%d",&item);
if(top==max-1)
{
printf("Stack Overflow");
}
else
{
top=top+1;
Stack[top]=item;
printf("STACK after PUSH operation:-\n");
for(i=top;i>=0;i--)
{
printf("TOP=%d\t%d\n",i,Stack[i]);
}}
getch();
}
OUTPUT-1
Enter the range of stack elements
5
Enter the Stack Elements are:-
11
22
33
44
55
Stack Elements
TOP=4 55
TOP=3 44
TOP=2 33
TOP=1 22
TOP=0 11
Enter the number which you want to PUSH in the Stack
66
STACK after PUSH operation:-
TOP=5 66
TOP=4 55
TOP=3 44
TOP=2 33
TOP=1 22
TOP=0 11OUTPUT-2
Enter the Stack Elements are:-
1
2
3
4
5
6
7
8
9
10
Stack Elements
TOP=9 10
TOP=8 9
TOP=7 8
TOP=6 7
TOP=5 6
TOP=4 5
TOP=3 4
TOP=2 3
TOP=1 2
TOP=0 1
Enter the number which you want to PUSH in the Stack
11
Stack Overflow

Practical No.7(ii)
Aim: - Practical to demonstrate POP operation on Stack.
SOURCE CODE
# include<stdio.h>
# include<conio.h>
void main()
{
int n,top,i,max,Stack[10];
clrscr();
printf("Enter the range of stack elements\n");
scanf("%d",&n);
max=10;
top=n-1;
if(top!=-1)
{
printf("Enter the Stack Elements are:-\n");
for(i=0;i<n;i++)
{
scanf("%d",&Stack[i]);
}
printf("Stack Elements are:-\n");
for(i=top;i>=0;i--)
{
printf("TOP=%d\t%d\n",i,Stack[i]);
}
Stack[top]=NULL;
top=top-1;
printf("STACK after POP operation:-\n");
for(i=top;i>=0;i--)
{
printf("TOP=%d\t%d\n",i,Stack[i]);
}
}
else
{
printf("Stack Underflow\nTOP=-1");
}
getch();
}OUTPUT-1
Enter the range of stack elements
5
Enter the Stack Elements are:-
1
2
3
4
5
Stack Elements are:-
TOP=4 5
TOP=3 4
TOP=2 3
TOP=1 2
TOP=0 1
STACK after POP operation:-
TOP=3 4
TOP=2 3
TOP=1 2
TOP=0 1
OUTPUT-2
Enter the range of stack elements
0
Stack Underflow
TOP=-1

Practical No.8(i)
Aim: - Practical to demonstrate Enqueue operation on Queue.
SOURCE CODE
# include<stdio.h>
# include<conio.h>
void main()
{
int n,item,Front,Rear,max,i,q[10];
clrscr();
printf("Enter the range of Queue elements\n");
scanf("%d",&n);
Front=1;
Rear=n;
max=10;
printf("Enter the Queue Elements:-\n");
for(i=1;i<=n;i++)
{
scanf("%d",&q[i]);
}
printf("Queue Elements are:-\n");
for(i=1;i<=n;i++)
{
printf("%d\n",q[i]);
}
printf("FRONT=%d\tREAR=%d\n",Front,Rear);
printf("Enter the number which you want to PUSH in the Stack\n");
scanf("%d",&item);
if(Rear==max)
{
printf("Queue Overflow");
} else
{
Rear=Rear+1;
q[Rear]=item;
printf("Queue after Enqueue operation:-\n");
for(i=1;i<=Rear;i++)
{
printf("%d\n",q[i]);
}
printf("FRONT=%d\tREAR=%d\n",Front,Rear);
}
getch();
}
OUTPUT-1
Enter the range of Queue elements
5
Enter the Queue Elements:-
11
22
33
44
55
66
Queue Elements are:-
11
22
33
44
55
66
FRONT=1 REAR=6
Enter the number which you want to PUSH in the Stack
77Queue after Enqueue operation:-
11
22
33
44
55
66
77
FRONT=1 REAR=7
OUTPUT-2
Enter the range of Queue elements
5
Enter the Queue Elements:-
1
2
3
4
5
6
7
8
9
10
Queue Elements are:-
1
2
3
4
5
6
7
8
9
10
FRONT=1 REAR=10
Enter the number which you want to PUSH in the Stack
11
Queue Overflow

Practical No.8(ii)
Aim: - Practical to demonstrate Dequeue operation on Queue.
SOURCE CODE
# include<stdio.h>
# include<conio.h>
void main()
{
int n,item,Front,Rear,i,q[10];
clrscr();
printf("Enter the range of Queue elements\n");
scanf("%d",&n);
if(n>0)
{
Front=1;
Rear=n;
printf("Enter the Queue Elements:-\n");
for(i=1;i<=n;i++)
{
scanf("%d",&q[i]);
}
printf("Queue Elements are:-\n");
for(i=1;i<=n;i++)
{
printf("%d\n",q[i]);
}
printf("FRONT=%d\tREAR=%d\n",Front,Rear);
q[Front]=NULL;
Front=Front+1;
printf("Queue after Deque operation:-\n");
for(i=Front;i<=Rear;i++)
{
printf("%d\n",q[i]);
}
printf("FRONT=%d\tREAR=%d\n",Front,Rear);
}
else
{
Front=0;
Rear=0;
printf("Queue is Underflow\n"); printf("FRONT=%d\tREAR=%d\n",Front,Rear);
}
getch();
}
OUTPUT-1
Enter the range of Queue elements
5
Enter the Queue Elements:-
1
2
3
4
5
Queue Elements are:-
1
2
3
4
5
FRONT=1 REAR=5
Queue after Deque operation:-
2
3
4
5
FRONT=2 REAR=5
******OUTPUT-2******
Enter the range of Queue elements
0
Queue is Underflow
FRONT=0 REAR=0
PRACTICAL NO.9 i
Aim: Implementation of List data structure using singly linked list.
1. #include <stdio.h>
2. #include <stdlib.h>
3. //Represent a node of singly linked list
struct node{
4. int data;
5. struct node *next;
6. };
7.
8. //Represent the head and tail of the singly linked list
9. struct node *head, *tail = NULL;
10.
11. //addNode() will add a new node to the list
12. void addNode(int data) {
13. //Create a new node
14. struct node *newNode = (struct node*)malloc(sizeof(struct node));
15. newNode->data = data;
16. newNode->next = NULL;
17.
18. //Checks if the list is empty
19. if(head == NULL) {
20. //If list is empty, both head and tail will point to new node
21. head = newNode;
22. tail = newNode;
23. }
24. else {
25. //newNode will be added after tail such that tail's next will point to newNode
26. tail->next = newNode;
27. //newNode will become new tail of the list
28. tail = newNode;
29. }
30. }
31.
32. //display() will display all the nodes present in the list
33. void display() {
34. //Node current will point to head
35. struct node *current = head;
36.
37. if(head == NULL) {
38. printf("List is empty\n");
39. return;
40. }
41. printf("Nodes of singly linked list: \n");
42. while(current != NULL) {
43. //Prints each node by incrementing pointer
44. printf("%d ", current->data);
45. current = current->next;
46. }
47. printf("\n");
48. }
49.
50. int main()
51. {
52. //Add nodes to the list
53. addNode(1);
54. addNode(2);
55. addNode(3);
56. addNode(4);
57.
58. //Displays the nodes present in the list
59. display();
60.
61. return 0;
62. }
63. Output:
64. Nodes of singly linked list:
65. 1234

Practical no.9 ii
Aim: Implement Stack using Array

#include <stdio.h>

#define MAX_SIZE 100

int stack[MAX_SIZE];
int top = -1;

void push(int data) {


if (top == MAX_SIZE - 1) {
printf("Overflow stack!\n");
return;
}
top++;
stack[top] = data;
}

int pop() {
if (top == -1) {
printf("Stack is empty!\n");
return -1;
}
int data = stack[top];
top--;
return data;
}

int main()
{
push(1);
push(2);
push(3);
push(4);
push(5);
push(3);

printf("Elements in the stack are: ");


while (top != -1) {
printf("%d ", pop());
}
printf("\n");
return 0;
}

Output:
Elements in the stack are: 3 5 4 3 2 1

Practical No.10
Aim: - Practical to demonstrate Factorial of a number using Recursion.
SOURCE CODE
# include<stdio.h>
# include<conio.h>
int factorial(int);
void main( )
{
int n,f;
clrscr();
printf("Enter the number: ");
scanf("%d",&n);
f=factorial(n);
printf("Factorial of the number %d is %d",n,f);
getch();
}
int factorial(int n)
{ int f;
if(n==1)
return(1);
else
f=n*factorial(n-1);
return(f);
}
OUTPUT
Enter the number: 6
Factorial of the number 6 is 720

Practical No.11
Aim: -Implenentation of Stack
#include<stdio.h>
#include<stdlib.h>

int n, top = -1, *stack;

void push(int x){


if(top==n) return;
stack[++top]=x;
}

int pop(){
if(top==-1) return -1;
return stack[top--];
}

int peek(){
if(top==-1) return -1;
return stack[top];
}

void display(){
for(int i=top ; i>-1 ; i--) printf("%d ",stack[i]);
printf("\n\n");
}

int main(){

n = 10;

printf("Initializing the stack with size 10\n\n");

stack = (int*)malloc(n*sizeof(int));

printf("Pushing elements into the stack\n1\n2\n3\n\n");

push(1);
push(2);
push(3);

printf("Displaying elements of the stack -\n");

display();

printf("The top of the stack = %d\n\n",peek());

printf("Pop the top of the stack = %d\n\n",pop());

printf("Pop the top of the stack = %d\n\n",pop());

printf("Displaying elements of the stack -\n");

display();

return 0;
}

OUTPUT:
Initializing the stack with size 10
Pushing elements into the stack
1
2
3

Displaying elements of the stack -


321

The top of the stack = 3

Pop the top of the stack = 3

Pop the top of the stack = 2

Displaying elements of the stack -


1

Practical no.12
Aim:Implementation of Queue using Array
#include<stdio.h>
#define n 5
int main()
{
int queue[n],ch=1,front=0,rear=0,i,j=1,x=n;
printf("Queue using Array");
printf("\n1.Insertion \n2.Deletion \n3.Display \n4.Exit");
while(ch)
{
printf("\nEnter the Choice:");
scanf("%d",&ch);
switch(ch)
{
case 1:
if(rear==x)
printf("\n Queue is Full");
else
{
printf("\n Enter no %d:",j++);
scanf("%d",&queue[rear++]);
}
break;
case 2:
if(front==rear)
{
printf("\n Queue is empty");
}
else
{
printf("\n Deleted Element is %d",queue[front++]);
x++;
}
break;
case 3:
printf("\nQueue Elements are:\n ");
if(front==rear)
printf("\n Queue is Empty");
else
{
for(i=front; i<rear; i++)
{
printf("%d",queue[i]);
printf("\n");
}
break;
case 4:
exit(0);
default:
printf("Wrong Choice: please see the options");
}
}
}
return 0;
}

Queue using Array


1.Insertion
2.Deletion
3.Display
4.Exit
Enter the Choice:1

Enter no 1:10

Enter the Choice:1

Enter no 2:54

Enter the Choice:1

Enter no 3:98

Enter the Choice:1

Enter no 4:234

Enter the Choice:3

Queue Elements are:


10
54
98
234

Enter the Choice:2

Deleted Element is 10
Enter the Choice:3

Queue Elements are:


54
98
234

Practical 13 and 14 and 15


Program for Insertion and Deletion of node in Binary search tree.
#include <stdio.h>
#include <stdlib.h>

struct node {
int data; //node will store some data
struct node *right_child; // right child
struct node *left_child; // left child
};

//function to create a node


struct node* new_node(int x) {
struct node *temp;
temp = malloc(sizeof(struct node));
temp -> data = x;
temp -> left_child = NULL;
temp -> right_child = NULL;

return temp;
}

// searching operation
struct node* search(struct node * root, int x) {
if (root == NULL || root -> data == x) //if root->data is x then the element is found
return root;
else if (x > root -> data) // x is greater, so we will search the right subtree
return search(root -> right_child, x);
else //x is smaller than the data, so we will search the left subtree
return search(root -> left_child, x);
}

// insertion
struct node* insert(struct node * root, int x) {
//searching for the place to insert
if (root == NULL)
return new_node(x);
else if (x > root -> data) // x is greater. Should be inserted to the right
root -> right_child = insert(root -> right_child, x);
else // x is smaller and should be inserted to left
root -> left_child = insert(root -> left_child, x);
return root;
}

//function to find the minimum value in a node


struct node* find_minimum(struct node * root) {
if (root == NULL)
return NULL;
else if (root -> left_child != NULL) // node with minimum value will have no left child
return find_minimum(root -> left_child); // left most element will be minimum
return root;
}

// deletion
struct node* delete(struct node * root, int x) {
//searching for the item to be deleted
if (root == NULL)
return NULL;
if (x > root -> data)
root -> right_child = delete(root -> right_child, x);
else if (x < root -> data)
root -> left_child = delete(root -> left_child, x);
else {
//No Child node
if (root -> left_child == NULL && root -> right_child == NULL) {
free(root);
return NULL;
}

//One Child node


else if (root -> left_child == NULL || root -> right_child == NULL) {
struct node *temp;
if (root -> left_child == NULL)
temp = root -> right_child;
else
temp = root -> left_child;
free(root);
return temp;
}

//Two Children
else {
struct node *temp = find_minimum(root -> right_child);
root -> data = temp -> data;
root -> right_child = delete(root -> right_child, temp -> data);
}
}
return root;
}

// Inorder Traversal
void inorder(struct node *root) {
if (root != NULL) // checking if the root is not null
{
inorder(root -> left_child); // traversing left child
printf(" %d ", root -> data); // printing data at root
inorder(root -> right_child); // traversing right child
}
}

int main() {
struct node *root;
root = new_node(20);
insert(root, 5);
insert(root, 1);
insert(root, 15);
insert(root, 9);
insert(root, 7);
insert(root, 12);
insert(root, 30);
insert(root, 25);
insert(root, 40);
insert(root, 45);
insert(root, 42);

inorder(root);
printf("\n");

root = delete(root, 1);

root = delete(root, 40);


root = delete(root, 45);

root = delete(root, 9);

inorder(root);
printf("\n");

return 0;
}
OUTPUT:

1 5 7 9 12 15 20 25 30 40 42 45
5 7 12 15 20 25 30 42

Practical 16 and17
Aim: Implenentation of Binary search and Linear search
#include <stdio.h>
#include <conio.h>
# include <stdlib.h>
void main()
{
Int a[10],n,flag=0,i,lb,ub,key,mid,ch;
clrscr();
printf("enter the size of the elements\n");
scanf("%d",&n);
printf("enter the elements\n");
for(i=0;i<n;i++)
scanf("%d",&a[i]);
printf("enter any key element to search\n");
scanf("%d",&key);
printf("menu\n");
printf("\n1.linear search\n2.binary search \n");
printf("enter your choice:\n"); scanf("%d",&ch);
switch(ch)
{ case 1:for(i=0;i<n;i++) if(a[i]==key)
{
flag=1;
break;}
case 2:for(lb=0,ub=n-1;lb<=ub;)
{
mid=(lb+ub)/2;
if(key==a[mid])
{
flag=1;
break;
}
else if(key<a[mid]) ub=mid-1;
else lb=mid+1;
}
84break;

default:exit(0);
}
if(flag==1)
printf("seach is successful");
else
printf("search is not successful \n");
getch();
}
OUTPUT:
Enter the size of the elements 5
Enter the elements 32 6 3 9 5
Enter any element to search 3
Menu
1. Linear search
2. Binary search Enter your choice: 2
Search is successful

Practical no. 18
Program: Implementation of Bubble Sort
#include<stdio.h>
#include<conio.h>
#define TRUE 1
#define FALSE 0
void bubblesort(int x[],int n); void main()
{
intnum[10],i,n;
clrscr();
printf("Enter the no of elements\n"); scanf("%d",&n);
printf("Enter the elements\n"); for(i=0;i<n;i++) scanf("%d",&num[i]);
bubblesort(num,n);
printf("sorted elements are\n"); for(i=0;i<n;i++) printf("%d\t",num[i]);
getch();}
void bubblesort(int x[],int n)
{
inthold,j,pass,K=TRUE;
for(pass=0;pass<n-1&&K==TRUE;pass++)
{ K=FALSE;
for(j=0;j<n-pass-1;j++) if(x[j]>x[j+1])
{
K=TRUE;
hold=x[j];
x[j]=x[j+1];
x[j+1]=hold;}}}
OUTPUT:
Enter the no of elements 5
Enter the elements 36 23 59 68 2
Sorted elements are 2 23 36 59 68
Practical no.19
Program: Implementation for Selection Sort
#include<stdio.h>
#include<conio.h> void main()
{
intn,i,j,a[10],min,t;
clrscr();
printf("enter how many elements\n"); scanf("%d",&n);
printf("enter the elements\n"); for(i=0;i<n;i++) scanf("%d",&a[i]); for(i=0;i<n-1;i++)
{
min=i;
for(j=i+1;j<n;j++)
{
if(a[min]>a[j])
min=j;
}
t=a[i];
a[i]=a[min];
a[min]=t;
87}

printf("the sorted elements are \n"); for(i=0;i<n;i++)


printf("%5d",a[i]);
getch();
}
OUTPUT:
Enter how many elements 5
Enter the elements 56 48 46 23 35
The sorted elements are 23 35 46 56 98
Practical no.20
Program:Implementation of insertion sort
#include<stdio.h>
#include<conio.h> void main()
{
intn,i,a[10],t,j;
clrscr();
printf("enter how many elements\n");
scanf("%d",&n);
printf("enter the elements\n");
for(i=0;i<n;i++)
scanf("%d",&a[i]);
for(i=1;i<n;i++)
{
for(j=i;j>0;j--)
{
if(a[j]<a[j-1])
{
t=a[j]; a[j]=a[j-1]; a[j-1]=t;
}}}
printf("the sorted elements are\n"); for(i=0;i<n;i++)
printf("%5d",a[i]);
getch();
}
OUTPUT:
Enter how many elements 5
Enter the elements 26 36 98 12 5
The sorted elements are 5 12 26 36 98

You might also like