Python Forum
Why won't my merge sort will not work?
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Why won't my merge sort will not work?
#2
Imagine sorting [2, 1].

When you get to line 17, you'll pop the 1 off of r and put it into nu.

Since r is now empty, you'll then hop down to line 22, so the l list with 2 inside is abandoned and [1] is returned. Nothing checks at that point if elements remain in l
ggg likes this post
Reply


Messages In This Thread
Why won't my merge sort will not work? - by ggg - Feb-02-2021, 11:28 PM
RE: Why won't my merge sort will not work? - by bowlofred - Feb-03-2021, 12:11 AM
RE: Why won't my merge sort will not work? - by ggg - Feb-03-2021, 02:43 AM

Possibly Related Threads…
Thread Author Replies Views Last Post
Photo a.sort() == b.sort() all the time 3lnyn0 1 1,369 Apr-19-2022, 06:50 PM
Last Post: Gribouillis

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020