Find Jobs
Hire Freelancers

search algorithm

€8-30 EUR

진행 중
게시됨 4년 이상 전

€8-30 EUR

제출할때 지불됩니다
Now we check this position and go from this position in the required direction, whereby we proceed exponentially here, i.e. in the first step 2^0 in one direction we go 2^1 ... 2^n. As soon as the program has to go once in the opposite direction (e.g.: our values were always too small up to now, but now they are suddenly too large) we have found an interval in which the searched value must lie.  From this moment on we use the binary search as an auxiliary function.  The probabilistic search already has a step in the first attempt. And for each further step, the number of steps is increased. So, if the first Guess is one step away, the number of steps is 2. The binary search is called with the values min and max in such a way that the area is searched which has not yet been covered by the probabilistic search. As a parameter for the number of steps in the binary search, the previous step number +1 is passed. Example:  int[] exampleArray = new int[]{6, 20, 22, 35, 51, 54, 59, 74, 77, 80, 87, 94, 97}; -> For 22 --> [2, 1] -> For 74 --> [7, 3] -> For 74 --> [-1, 3] Implementation: Your task is to implement a method public static int[] probalisticSearch(int[] arr, int value) that implements the algorithm described above. The passed array is always sorted. The searched value int value is always within the range between the smallest and largest value of the array. The return array has at the first position (index 0) the index of the searched value in the array or -1 if the searched number does not appear in the array. In second place (index 1) your function returns how many calls it took to find the correct value or return that the value does not exist in the array. Now we want to compare the performance of the two approaches. For this there is the slightly modified version of public static int[] find (int[] a, int x) in the template, which, like your method, first returns the index and then the required number of calls. Write a method public static void compareApproaches(int[] arr, int min, int max), which searches all values (including min and max and no matter if the values in between are contained in the array or not) between min and max in the array with both variants and returns how many calls the variants needed. In addition, your program should output what was the largest number of steps and at what value this occurred (if there are multiple values with the same number of values, they will output the first with that number). Example:  Array: {0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 2, 3, 100};     Index searching for is: 3     Probabilistic search: Position is: 1 number of Steps is: 1     Probabilistic search: Position is: 2 number of Steps is: 2     Probabilistic search: Position is: 4 number of Steps is: 3     Probabilistic search: Position is: 8 number of Steps is: 4     Probabilistic search: Position is: 16 number of Steps is: 5     Binary search: n1 is: 17 n2 is: 23 number of Steps is: 6     Binary search: n1 is: 21 n2 is: 23 number of Steps is: 7     Binary search: n1 is: 23 n2 is: 23 number of Steps is: 8     ------------------------------------------     Index searching for is: 25     Probabilistic search: Position is: 6 number of Steps is: 1     Probabilistic search: Position is: 7 number of Steps is: 2     Probabilistic search: Position is: 9 number of Steps is: 3     Probabilistic search: Position is: 13 number of Steps is: 4     Probabilistic search: Position is: 21 number of Steps is: 5     Binary search: n1 is: 22 n2 is: 23 number of Steps is: 6     Binary search: n1 is: 23 n2 is: 23 number of Steps is: 7
프로젝트 ID: 22469066

프로젝트 정보

6 제안서
원격근무 프로젝트
활동 중 4년 전

돈을 좀 벌 생각이십니까?

프리랜서 입찰의 이점

예산 및 기간 설정
작업 결과에 대한 급여 수급
제안의 개요를 자세히 쓰세요
무료로 프로젝트에 신청하고 입찰할 수 있습니다
6 이 프로젝트에 프리랜서들의 평균 입찰은 €43 EUR입니다.
사용자 아바타
Hi I am an engineer and have done many java projects. If you are interested in my offer, feel free to contact me. Thank you
€90 EUR 7일에
5.0 (69 건의 리뷰)
6.1
6.1
사용자 아바타
VERY EASY FOR ME As you can see in my review, I've done similar with yours Hello. I have read your description and I am so interested in your project. I am confident in your project and I can finish it clearly on time. I am well experienced and skillful Java and C++ programmer. I have +5 years of experience in software developing. I have finished a lot of project like this. I ensure the best quality of your project and to keep your deadline. Please contact me kindly and let us discuss in more detail. Working with me, you will have a good experience and good friend and save more time and money. After complete project, I can support fixing bugs with free. and support update features with low price. Best regards!
€30 EUR 2일에
4.9 (67 건의 리뷰)
6.1
6.1
사용자 아바타
I'm a java expert having long and full experiences in 3 years and you can check my skill via reviews. Speaking of my Java skill, I can build the various kind of projects using Java such as JavaGUI Desktop Application can be run on Windows and Linux platform using JavaFx and JavaSwing, WebApplication based on Java Servlet using Spring MVC, Spring Boot and Sturuts framework to be exact. please contact me if you have a will to build this with me, so that we can discuss more. Regards
€50 EUR 1일에
4.9 (25 건의 리뷰)
4.7
4.7
사용자 아바타
hi i read all requirement please share more detail i did 5 similar task i will provide 5 star rating work thanks
€50 EUR 7일에
4.7 (5 건의 리뷰)
3.0
3.0
사용자 아바타
Hello, Greetings! ******************** I will SATISFY YOU******************** I will do my best for you. Looking forward to hearing from you and thank you for your consideration. Best Regards Lovely RealMan!
€19 EUR 7일에
0.0 (0 건의 리뷰)
0.6
0.6

고객에 대한 정보

국기 (GERMANY)
Munich, Germany
3.9
4
결제 수단 확인
11월 22, 2019부터 회원입니다

고객 확인

감사합니다! 무료 크레딧을 신청할 수 있는 링크를 이메일로 보내드렸습니다.
이메일을 보내는 동안 문제가 발생했습니다. 다시 시도해 주세요.
등록 사용자 전체 등록 건수(일자리)
Freelancer ® is a registered Trademark of Freelancer Technology Pty Limited (ACN 142 189 759)
Copyright © 2024 Freelancer Technology Pty Limited (ACN 142 189 759)
미리 보기 화면을 준비 중...
위치 정보 관련 접근권이 허용되었습니다.
고객님의 로그인 세션이 만료되어, 자동으로 로그아웃 처리가 되었습니다. 다시 로그인하여 주십시오.