top of page
HD-wallpaper-python-amoled-coding-coding-dark-dark-programming-python-sky-universe_edited.

DIVIDE & CONQUER

Real-Life Situation/Scenerio: Sorting video editing wars entries by popularity.

In the world of video editing, there are numerous online platforms where users share their editing works. These platforms often host contests or challenges known as "video editing wars" where participants submit their videos. The challenge organizers need to sort the entries based on their popularity, which is determined by factors such as views, likes, and comments. This sorting process is crucial for showcasing the most popular entries to the audience.

maxresdefault.jpg
photo-1515879218367-8466d910aaa4-scaled_edited.jpg
Functionality Dscription

ALGORITHM DESIGN

Merge Sort algorithm divides the list of video editing wars entries into smaller sublists, sorts each sublist individually based on the number of views, and then merges them back together in the correct order.

Why Merge Sort

Insertion Sort is chosen for sorting the video files into categories because of its simplicity and effectiveness for small datasets.

  1. Efficiency: Merge Sort offers consistent performance with a time complexity of O(n log n) in all cases, making it efficient for sorting large numbers of entries.

  2. Stability: Merge Sort is a stable sorting algorithm, meaning it preserves the order of equal elements. In the context of video editing wars, where entries with the same number of views should retain their relative positions, stability is crucial.

  3. Ease of Implementation: Merge Sort is relatively easy to implement and understand, making it suitable for projects where readability and maintainability of code are essential.

  4. Strategy: The Divide and Conquer strategy employed by Merge Sort fits well with the problem of sorting video editing wars entries. By dividing the list into smaller sublists, sorting them individually, and then merging them back together, Merge Sort efficiently handles the task of sorting entries by popularity.

CODE IMPLEMENTATION

function insertionSort(video_files):

for i from 1 to length(video_files) - 1:

key = video_files[i]

j = i - 1

while j >= 0 and video_files[j] > key:

video_files[j + 1] = video_files[j]

j = j - 1

video_files[j + 1] = key

MAIN CODE

432791575_3820686701483877_3929489194585079978_n.png

MAIN CODE OUTPUT

432683412_968201521688884_3532513756209681829_n.png

CODE BREAKDOWN

  • Best Case: O(n log n)

  • Average Case: O(n log n)

  • Worst Case: O(n log n)

CSAL REFLECTION

REFLECTION

GAINED KNOWLEDGE

During the midterm period, I gained a deeper understanding of various sorting algorithms, particularly Merge Sort. I learned about the Divide and Conquer strategy and how it can be applied to efficiently solve problems like sorting large datasets. Additionally, I enhanced my knowledge of Python programming and its applications in algorithm implementation.

© 2022 by Lawrence Acodili
Powered and secured by Wix

Call

+639615667908

Write

acodililawrence200.wixsite.com/lawrenceaco

Follow

  • Facebook
  • Twitter
  • LinkedIn
  • Instagram
bottom of page