Skip to main content
2 votes

Week 2 Merge Sort: Why is it assumed that the elements will be in order when they are merged?

Think of it this way. The unsorted list of n elements is broken into n lists of 1 element each. A one-element list is, by definition, sorted. Now, the merging begins. Pairs of lists are merged by ...
Cliff B's user avatar
  • 69k
2 votes

Selection Sort: Holes in Logic

The main problem is in the following statements: string answer = 0; answer[i]= min_value; Let's see if I can explain it clearly; a variable of type string is really a typedef (an alias in other ...
MARS's user avatar
  • 5,169
1 vote

Pset3: Tideman - Sort_pairs function

check50 doesn't care about how you implemented add_pairs when it's testing sort_pairs, so it doesn't initialize the winsize property. You'll need to remove that property, and access it in sort_pairs. ...
Llenk's user avatar
  • 744
1 vote

Pset 3 -> Counting Sort - need tips to find my error

If you array is declared with 65536 buckets, then aux_list[65536] is outside the bounds (remembering that arrays are zero-indexed). So what happens in your loop when i == 65536?
curiouskiwi's user avatar
  • 18.7k

Only top scored, non community-wiki answers of a minimum length are eligible