reset password
Author Message
astrong2
Posts: 25
Posted 14:44 Jan 27, 2018 |

Is anyone else having trouble getting binary search to work with all 3 of the String, Double, and Integer lists? How can I make this work? So far it's only working with Integer

astrong2
Posts: 25
Posted 15:25 Jan 27, 2018 |

I figured it out, for anyone who had the same problem as me, make sure to use compareTo()

smallch
Posts: 10
Posted 16:28 Jan 27, 2018 |

Also, binary search will only work on sorted lists

astrong2
Posts: 25
Posted 16:32 Jan 27, 2018 |

How would you go about sorting for type E[]?

smallch
Posts: 10
Posted 16:47 Jan 27, 2018 |

We have to make selection sort, so you can just use that to sort it first, I guess, but doing that would change the order of the list.

Last edited by smallch at 16:57 Jan 27, 2018.
jungsoolim
Posts: 38
Posted 21:05 Jan 27, 2018 |
astrong2 wrote:

Is anyone else having trouble getting binary search to work with all 3 of the String, Double, and Integer lists? How can I make this work? So far it's only working with Integer

Please make sure the list is sorted especially for a list of String.

Thanks!