0% found this document useful (0 votes)
3 views1 page

Computer Scienc2

Uploaded by

cynthiahmaina16
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)
3 views1 page

Computer Scienc2

Uploaded by

cynthiahmaina16
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/ 1

Computer Science: Algorithms and Data Structures

Date: October 31, 2024


Instructor: Dr. Monica Grant
Course: CS202 - Data Structures and Algorithms

Topic: Sorting Algorithms

Detailed Explanation:

1. Bubble Sort:
o A simple sorting algorithm that compares adjacent elements and swaps them if
they are in the wrong order.
o Time Complexity: O(n2)O(n^2)O(n2).
o Example: Sorting an array by repeatedly swapping adjacent elements that are
out of order.
2. QuickSort:
o A divide-and-conquer algorithm that partitions the array into sub-arrays and
recursively sorts them.
o Time Complexity: Best and Average Case O(nlog⁡n)O(n \log n)O(nlogn),
Worst Case O(n2)O(n^2)O(n2).
o Example: Partitioning an array around a pivot and sorting the left and right
sub-arrays.
3. Merge Sort:
o A stable sorting algorithm that divides the array into halves, recursively sorts
them, and then merges the sorted halves.
o Time Complexity: O(nlog⁡n)O(n \log n)O(nlogn).
o Example: Sorting large datasets efficiently.

You might also like