aspose file tools*
The moose likes Beginning Java and the fly likes Broken code Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Beginning Java
Bookmark "Broken code " Watch "Broken code " New topic
Author

Broken code

Andres John
Ranch Hand

Joined: Jun 07, 2012
Posts: 34
The code is working fine but there is some problem in the algorithms of this problem like i wants a match to be equal to 15 but instead is give me 16 somehow, here is the code:

output:
1 2 3 3 4 7 7 9 10 10
16 17 18 18 19 19 20 20 21 21
21 25 27 27 29 30 31 36 38 39

40 the position of the match is 16
Tony Docherty
Bartender

Joined: Aug 07, 2007
Posts: 2366
    
  50
40 the position of the match is 16

Sorry but that makes no sense to me. What is this algorithm supposed to do and what does it actually do?
Andres John
Ranch Hand

Joined: Jun 07, 2012
Posts: 34
Tony Docherty wrote:
40 the position of the match is 16

Sorry but that makes no sense to me. What is this algorithm supposed to do and what does it actually do?

Sorry for the late reply
this program support to do a recursive method or recursion, it actually sort it the number from lower to high using fastsorting (if you already read the comments)
colton peterson
Ranch Hand

Joined: Nov 18, 2007
Posts: 97

I am still thoroughly confused, for the following reasons:

The printlns in your code do not match the output you gave

Even though you mentioned that the algorithms are supposed to sort something, it looks to me like they are for searching through arrays using different methods, not sorting them

Also you have no main method, and your methods do not call each other, so I do not even know which method you are asking about, as they do different things

40 the position of the match is 16

this line in particular, what does it mean? When searching for 40 it returns that the position is 16? Vice versa? something else entirely?

In the method interpolationSrch() (which I think is the one you are asking about), what do v, s, and e mean? value, start, end? those one letter parameters are killing me. If so I still need to know what you originally call it with to be much more helpful.

I am not trying to sound harsh, I am just very confused, if you could clarify any of the above points, I am sure we could be a lot more helpful in answering your questions

www.mormon.org
 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
 
subject: Broken code