Flash Sort | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 1

Flash Sort

could Anyone help me to fix the bugs in this code I tried but can't fix all the bugs the line l commeted! https://code.sololearn.com/c9434xiqrh4X/?ref=app

19th Jan 2019, 7:12 PM
Hamdan Farooq
Hamdan Farooq - avatar
13 Answers
+ 2
Reading about flashsort now. http://www.neubert.net/Flacodes/FLACodes.html#Sprung3 https://en.wikipedia.org/wiki/Flashsort https://www.geeksforgeeks.org/quick-sort/ Why is you m value this formula ? int m = (int)((0.2 * length) + 2); wikipedia -> m=0.1n Sorry have to stop here . I can see j is continuing to increase, which causes the index out of bound. But I do not know why that is. https://code.sololearn.com/cmH0f8Ix9eQ0
19th Jan 2019, 9:21 PM
sneeze
sneeze - avatar
+ 2
I will try. The geeks for geeks looked very readable. I like dr dobbs but the articles are hard to read.
19th Jan 2019, 10:02 PM
sneeze
sneeze - avatar
+ 1
I did not read the whole code. But I do miss a program class Can you check the place of your brackets. Do you mean to end the main method after 3 lines, or is this bracket here by misstake static void Main(string[] args) { Program p = new Program(); int [] a = new int[7] {1,2,3,6,1,9,7}; p.flashsort(a, 7); } //this is the end of main { //but there is not class-defintion or method-definition here if (length == 0) { return; }
19th Jan 2019, 8:16 PM
sneeze
sneeze - avatar
+ 1
I correct this mistake but still it's not working 😥
19th Jan 2019, 8:28 PM
Hamdan Farooq
Hamdan Farooq - avatar
+ 1
That is fine. I had a look and there is a infinite loop created. It seems that "j" is not set. This makes j always smaller than L[K], which makes the loop infite. https://code.sololearn.com/cmH0f8Ix9eQ0
19th Jan 2019, 8:54 PM
sneeze
sneeze - avatar
+ 1
yes but when I uncommented the while loop it's not run infinite times but in that loop I faced exception index out of bounds and I cannot find a way to solve this problem and get the desired output
19th Jan 2019, 9:01 PM
Hamdan Farooq
Hamdan Farooq - avatar
+ 1
do you have any knowledge about flash sort if you know about it then please check the the formula that I Use it in the program
19th Jan 2019, 9:03 PM
Hamdan Farooq
Hamdan Farooq - avatar
+ 1
Sorry, I do not have knowledge of flashsort, I am just reading your code.
19th Jan 2019, 9:04 PM
sneeze
sneeze - avatar
+ 1
no problem and thanks ☺️
19th Jan 2019, 9:07 PM
Hamdan Farooq
Hamdan Farooq - avatar
+ 1
thanks a lot
19th Jan 2019, 9:45 PM
Hamdan Farooq
Hamdan Farooq - avatar
+ 1
when finish this article can you answer my this question I'm still confused about it https://www.sololearn.com/discuss/1657440/?ref=app
19th Jan 2019, 9:47 PM
Hamdan Farooq
Hamdan Farooq - avatar
+ 1
yeah
19th Jan 2019, 10:13 PM
Hamdan Farooq
Hamdan Farooq - avatar
0
yes but when I uncommented the while loop it's not run infinite times but in that loop I faced exception index out of bounds and I cannot find a way to solve this problem and get the desired output
19th Jan 2019, 9:01 PM
Hamdan Farooq
Hamdan Farooq - avatar