Apr-24-2018, 05:43 PM
Are you sure you're doing it properly?
This sounds like a theoretical question, as opposed to a brute force question.
Refer to: Link
Also, I'm no python expert, but some things I believe can be improved:
1-
2- Is it good to define a local
3- range(len())
4- Since you pass
5- If I had to guess, the problem might be line 29.
This sounds like a theoretical question, as opposed to a brute force question.
Refer to: Link
Also, I'm no python expert, but some things I believe can be improved:
1-
bubblesortOnePass()
's return value is never used, so you don't need to return l
.2- Is it good to define a local
counter
in line 50, then a global counter
in line 17?3- range(len())
4- Since you pass
K
into bubblesortTwoPass()
, I would use k
, as opposed to l
inside the function.5- If I had to guess, the problem might be line 29.