辅导CSC220程序、 写作Java实验程序

” 辅导CSC220程序、 写作Java实验程序CSC220 Assignment05Searching and RecursionThe goal of this weeks assignment is:1. Practice searching2. Continue learning the significance of special cases!3. Learning how to write test to check your implementationThings you must do:1. There are many details in this assignment. Make sure you read the wholething carefully before Writing any code and closely follow this instruction.2. You must complete your assignment individually.3. Always remember Java is case sensitive.4. Your file names, class names, and package name must matchexactly as they are specified here.5. Your project must include the methods you implemented in the lab.Things you must not do:1. You must not change the file names, class names, package names.2. You must not change the signature of any of these methods (name,parameters, ). Just fill in the missing code inside them. However, you aremore than welcome to create any helper methods you need as necessary.Part 0 辅导CSC220作业、 写作Java实验程序 You first must make sure that you have already finished the lab successfullyand have all methods in the lab instruction working properly. DO NOT start your Assignment unless you have all the features in the labworking. The tests we run on your assignment may fail if you have anincorrect lab implementation.Part 1 SortedBinarySet Class ImplementationAfter making sure the methods you implemented during lab work properly, we willextend the functionality of our class by adding new methods. Please implement themethods in the order given and pay close attention to the notes:● public boolean remove(double value)○ This method should first make a call to findIndex() to find the location ofvalue, which for now still Calls the private sequentialFind (this will change in thenext step). If the element is not present in the list (how do we know?), returnfalse. Otherwise, remove the element and return true because the list containedthe given value.○ Be careful about which Member variables should be updated before returningtrue.○ Be sure to test your Remove method before moving forward.● public boolean binaryFind(double target)○ this method will return the index where the element target occurs. This methodmust make use of binary search. If target is not present in the list, it shouldreturn the index where it should be added. Use the same formula we learnedduring the lab.○ Change the boolean usesBinarySearch to be false so that findIndex nowcalls this method instead. insert() and remove() now make use of binary search:-)● public boolean contains(double value)○ this function returns true if this list contains the value○ otherwise, it returns false○ this method must take advantage of the list being sorted and use a binary searchto determine if an item is in the array. (Hint: try reusing your other methods.)● public boolean containsAll(double[] elements)○ this function returns true if all the input values (stored in elements) are in the list○ otherwise, return false○ this method must take advantage of the list being sorted and use a binary searchto determine if an item is in the array. (Hint: try reusing your other methods.)● public SortedBinarySet(double[] input)○ This is another constructor for your class that will accept an array and create anobject of SortedBinarySet that includes the values in the input array○ Be careful of the following cases■ the input might have duplicates (remember your list is not allowed tocontain duplicates)■ the input might not be sorted. Hint: think whether you can reuse any ofthe methods you have implemented to make your job easier.Part 2 TestingUnlike previous Assignments you are not given any tests as a starting point. Youmust create your own tests to examine each method you implemented in theprevious part.Part 3 sequentialFind or binaryFind?As we have seen this week during lecture, some algorithms are more efficient thanothers. For Lab05 we implemented a search routine two ways: sequentialFind(),and binaryFind().● For the last part of this assignment, we would like you to think about which oneis more efficient. Remember that findIndex() will use either method basedon the boolean variable usesBinarySearch.● When you think you have an answer, Set the variable usesBinarySearch tothe appropriate value (either true or false) so findIndex() makes use of thatmethod.○ For example, Setting usesBinarySearch to false would indicate thatsequentialFind() is faster than binaryFind().To test this out in your Tester, You may consider inserting 100,000 elements (using aloop) into the sorted set and comparing the time it takes (usingSystem.nanoTime()) to complete the operation when using sequentialFind orbinaryFind.Remarks● Make sure to Submit your assignment by (re-)uploading your Lab05 folder intoyour csc220-cXXXX folder by the deadline (Tuesday @ 11:59pm)● Be sure to include Tester.java in your submission to BOX. Remember that wewill not run your testing Code; we will only confirm that you have done testing.● For all your assignments, please start early and seek help early (eitherfrom the instructor or the TAs).如有需要,请加QQ:99515681 或邮箱:99515681@qq.com

添加老师微信回复‘’官网 辅导‘’获取专业老师帮助,或点击联系老师1对1在线指导