Sorting Algorithms (2. Sorting)

General question:

I’m at the Algorithms Complexity section. I completed the first 4 so far. I probably grasps about 50% of it.

The examples somewhat help me comprehend bits and pieces, but I’m almost 75% lost on Sorting Algorithms (partly due to my subpar understanding from prior sections - even after reading).

Question is…is there any outside material people recommend to get a concrete understanding of these concepts?

I think mainly the time complexity:

N*N/2 + N/2 - N

E.g. this screenshot confuses me VS the comments I added below (to calculate)

# is there a reason we don't calculate like prior sections?
def selection_sort(values):
    N = len(values)                                                # 1
    for range_start in range(N):                                   # N             
        index = select_minimum_index_in_range(values, range_start) # N - range_start
        swap(values, range_start, index)                           # N

Thanks all.

1 Like

Please share the screen link.

1 Like