java - Insertion sort debug -
I have tried sorting a set of data using an inclusion sort. But when I do not print print output, proper output happens:
giant bird 1 mockingbird 2 vultures 3 redwoodpeckers 6 pigeons 7 crows 10 condos 12 Bluejays 15 dodos 15 baldeagles 25 cardinals 40 hummung birds 88
string [] BN = {"cardinals", "blues", "albatross", "vultures", "Crows", "Mockingbirds", "Conders", "BaldEagles", "Pigeons", "RedHeadWoodPecker", "Hummingbirds", "Dodos"}; Integer [] BQ = {40,15,1,3,10,2,12,25,7,6,88,15}; Public Static Zero SortingMedic Ordernert (String [] BN, Int [] BQF) {For (Int I = 1; I & Lt; Beak.Lamp; I ++) {Int next = BKA [i]; String y = bn [ii]; // Find all entry locations // move all big elements up int j = i; While (j & gt; 0 & amp; amp; amp; amp; amp; amp; amp; & amp; BK [J-1] & gt; Next) {BN [J] = BN [J-1]; BQ [J] = BQ [J-1]; J--; } // insert element beac [j] = next; Arab [J] y =; }
Can someone please help
you need Add a loop to print the individual elements of the cross and array:
(string name: billions) {// for this loop after the end of its kind method included Should be println (name); }
Give advice; By passing Java value and not by reference, you will have to go back an array with modified values if you intend on working with subsequent array array.
Just found that you need both the name and your value; For this, the extended use for the loop will not be used (; index & lt; bn.length; index ++ integer index = 0) {println (billion [index]
Will need to go with something on the lines of + "" + beak [index]); }
More information about loops and arrays can be found in Java tutorials and documents (Google only).
Comments
Post a Comment