| Author |
[Solved] bubbleSorting + binary searching from methods .
|
Omar Perez
Ranch Hand
Joined: Jul 08, 2011
Posts: 35
|
|
Thank you all folks for all the solutions and proposals, really appreciated.
This the code (done in three classes).
First the bubble sort code an Algorithm for sorting values, in this from min to max;
The bubble code was for a binary search, this is the code for binary search (iterative way);
No you guys are in charge of working the main class. Thank you all for your collaboration.
|
 |
Stephan van Hulst
Bartender
Joined: Sep 20, 2010
Posts: 3053
|
|
Hi Omar,
I haven't looked at your code very carefully, but it looks like you're doing something dangerous on line 43: maybe you should use the == operator instead of the = operator.
|
 |
Omar Perez
Ranch Hand
Joined: Jul 08, 2011
Posts: 35
|
|
Stephan van Hulst wrote:Hi Omar,
I haven't looked at your code very carefully, but it looks like you're doing something dangerous on line 43: maybe you should use the == operator instead of the = operator.
fixed, I got the exception fixed, now having issues with method not returning all values sorted.
|
 |
Seetharaman Venkatasamy
Ranch Hand
Joined: Jan 28, 2008
Posts: 5575
|
|
I do argue you to see Bubble_sort, then your program
|
 |
fred rosenberger
lowercase baba
Bartender
Joined: Oct 02, 2003
Posts: 9955
|
|
it is returning one number because you are telling it to:
return array[9];
says "return the element of the array at index position 9" and NOT "return an array with 9 elements".
|
Never ascribe to malice that which can be adequately explained by stupidity.
|
 |
Jeff Verdegan
Bartender
Joined: Jan 03, 2004
Posts: 5893
|
|
Omar Perez wrote:
Stephan van Hulst wrote:Hi Omar,
I haven't looked at your code very carefully, but it looks like you're doing something dangerous on line 43: maybe you should use the == operator instead of the = operator.
fixed, I got the exception fixed, now having issues with method not returning all values sorted.
Better yet get rid of the == altogether.
|
 |
 |
|
|
subject: [Solved] bubbleSorting + binary searching from methods .
|
|
|