# Need a to solution, anybody help

Nathan HighLander
Greenhorn
Posts: 1
1. Implement the square root function using binary search
(DO NOT USE Math.sqrt() OR ANY OTHER Math function except abs()).
NOTE: THIS CODE SHOULD USE BINARY SEARCH, NOT NEWTON's METHOD!
(if you copy code from the web it is likely to be Newton's method, in that case you will not get credit for this problem)
The answer should be accurate to at least 4 decimal places (
public static double mySqrt(double inp){ . . . }

2. Write a function to count the number of times each word appears in some English text.
(The words are separated by white spaces.)
Then print out each word in alphabetic order (you may assume that this is the same as the natural ordering of the String class), and how many times it occurs in the text.
For example, if the input text is:
"arrow bull horn\tafrica \t small \t arrow thin arrow blue nile small africa bile zebra jagged small edge arrow"
africa 2
arrow 4
bile 1
blue 1
bull 1
edge 1
horn 1
jagged 1
nile 1
small 3
thin 1
zebra 1

public static void countWord(java.lang.String text){ . . . }
3 Write a Java method to remove "white spaces" from an array of String. Note the space
characters may occur any where in the strings (not just leading and trailing!!!). Try to write the code as efficiently as possible, since this method may be called millions of times.

public static void removeSpace(java.lang.String[] inStr){ . . .}

Ulf Dittmer
Rancher
Posts: 42969
73
Welcome to JavaRanch.

Please take a moment to choose the correct forum for your questions: CarefullyChooseOneForum. This one is about JME.

Also, DoYourOwnHomework. If you have thoughts on these problems that you'd like help with implementing, we'll try to help. But we're not going to do the work for you.

We also have lots of other tips on how to get the most out of JavaRanch: HowToAskQuestionsOnJavaRanch, e.g. UseAMeaningfulSubjectLine.

I'm closing this topic here. If you have specific questions about any of these, post them to an appropriate forum, maybe one of the "Java in General" forums.
[ April 22, 2008: Message edited by: Ulf Dittmer ]