Skip to content

Implemented merge sort - #17

Open
KausLol wants to merge 1 commit into
lindelwa122:mainfrom
KausLol:merge-sort
Open

Implemented merge sort#17
KausLol wants to merge 1 commit into
lindelwa122:mainfrom
KausLol:merge-sort

Conversation

@KausLol

@KausLol KausLol commented Oct 22, 2025

Copy link
Copy Markdown

Description

Implemented the merge() method in the Sorter class using merge sort algorithm.

Fixes #3

Changes Made

  • Implemented Sorter.merge() method with divide-and-conquer algorithm
  • Added merge_helper() function to merge sorted sublists
  • Added merge_sort_recursive() function for recursive sorting
  • Ensured immutability so the original list is never modified

Test Results

All 12 merge sort tests passing (100%)

  • Basic sorting (ascending/descending)
  • Edge cases (empty, single element, duplicates, negatives, floats)
  • Immutability verification
  • Performance test (100,000 elements in < 0.7s)
  • Custom objects with comparators
  • Already sorted and reverse sorted lists

@lindelwa122

Copy link
Copy Markdown
Owner

@KausLol, impressive work 👏

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

sort.merge

2 participants