0% found this document useful (0 votes)
6 views3 pages

Bubble Sort Algorithm

The document outlines a bubble sort algorithm for sorting a list of characters in alphabetical order, detailing its inefficiencies and providing a C code implementation. It includes sections for academic details, coding phases, testing, and rubrics for evaluation. The total score for the experiment is 50, with various criteria for assessment.

Uploaded by

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

Bubble Sort Algorithm

The document outlines a bubble sort algorithm for sorting a list of characters in alphabetical order, detailing its inefficiencies and providing a C code implementation. It includes sections for academic details, coding phases, testing, and rubrics for evaluation. The total score for the experiment is 50, with various criteria for assessment.

Uploaded by

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

School: ............................................................................................................. Campus: .......................................................

Academic Year: ...................... Subject Name: ........................................................... Subject Code: ..........................

Semester: ............... Program: ........................................ Branch: ......................... Specialization: ..........................

Date: .....................................

(Learning by Doing and Discovery)

Sort the list E, X, A, M, P, L, E in alphabetical order by Bubble sort.


* Coding Phase: Algorithm
Bubble Sort Algorithm:
 Bubble sort is a simple comparison
comparison-based
based algorithm that
repeatedly steps through the list, compares adjacent elements,
and swaps them if they are in the wrong order.
 The algorithm passes through the list multiple times until no

swaps are needed, indicating that the list is sorted.


 Bubble sort has a time complexity of O(n^2), making it

inefficient for large datasets.


 Despitee its simplicity, bubble sort is rarely used in practice due to
its poor performance on large datasets.
Applied and Action Learning

* Coding Phase: C-Code

#include <stdio.h>

void swap(char *a, char *b) {


char temp = *a;
*a = *b;
*b = temp;
}
void bubbleSort(char arr[], int n) {
int i,j;
for (i = 0; i < n - 1; i++) {
for (j = 0; j < n - i - 1; j++) {
if (arr[j] > arr[j + 1]) {
swap(&arr[j], &arr[j + 1]);
}
}
}
}
int main() {
char arr[] = {'E', 'X', 'A', 'M', 'P', 'L', 'E'};
int i, n = sizeof(arr) / sizeof(arr[0]);
bubbleSort(arr, n);
printf("Sorted array using Bubble Sort: ");
for (i = 0; i < n; i++) {
printf("%c ", arr[i]);
}
printf("\n");
return 0;
}

*As applicable according to the experiment


One sheet per experiment (10-20) to be used.
Applied and Action Learning

Testing Phase: Compilation of Code (error detection)

* Implementation Phase: Final Output (no error)

Rubrics
Concept 10
Planning and Execution/ 10
Practical Simulation/ Programming
Result and Interpretation 10
Record of Applied and Action Learning 10
Viva 10
Total 50

Signature of the Student:

Signature of the Faculty:


*As applicable according to the experiment.

You might also like