Learn Data Structures by Building the Merge Sort Algorithm - Step 12

Tell us what’s happening:

Similar to the previous post, I have trouble understanding the instruction versus what I wrote…

Your code so far

def merge_sort(array):
    
    middle_point = len(array) // 2
    left_part = array[:middle_point]
    right_part = array[middle_point:]

    merge_sort(left_part)
    merge_sort(right_part)

    left_array_index = 0
    right_array_index = 0
    sorted_index = 0


# User Editable Region

    while left_array_index < len(left_part) and right_array_index < len(right_part):
        if left_array_index < right_array_index:
            pass

# User Editable Region

Your browser information:

User Agent is: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/120.0.0.0 Safari/537.36

Challenge Information:

Learn Data Structures by Building the Merge Sort Algorithm - Step 12

and I have an issue with the result, so apparently this (following) works :

    while left_array_index < len(left_part) and right_array_index < len(right_part):
        if left_part[left_array_index] < right_part[right_array_index]:
            pass

but the instructions were to compare the “index of…”
what I compared above and passes the test is the element AT the index. What am I missing ?

I assume it’s worded wrong, afaik there’s a github where you could request the wording to be adjusted. Or you could make a post in the freeCodeCamp Support section of the forum.

This topic was automatically closed 182 days after the last reply. New replies are no longer allowed.