ComputerScienceExpert

(11)

$18/per page/

About ComputerScienceExpert

Levels Tought:
Elementary,Middle School,High School,College,University,PHD

Expertise:
Applied Sciences,Calculus See all
Applied Sciences,Calculus,Chemistry,Computer Science,Environmental science,Information Systems,Science Hide all
Teaching Since: Apr 2017
Last Sign in: 9 Weeks Ago, 6 Days Ago
Questions Answered: 4870
Tutorials Posted: 4863

Education

  • MBA IT, Mater in Science and Technology
    Devry
    Jul-1996 - Jul-2000

Experience

  • Professor
    Devry University
    Mar-2010 - Oct-2016

Category > Programming Posted 09 May 2017 My Price 9.00

Write a recursive methodcompareStrings

Hey check the attachment please and let me know if you need more information. Thank you

 

Note: Problem 3 is a little challenging! If you get everything working fully, your maximum grade on thishomework is 45/35 points.1.(5 pts)Write a recursive methodcompareStrings(String s1, String s2). This method should return0 if the stringss1ands2contain exactly the same characters in the same order, 1 ifs1isalphabetically (using ASCII values) “greater than”s2, or -1 ifs1is alphabetically “less than”s2.Hint: Think about the base case(s)! When can you immediately return a value without needing anyrecursive calls?Examples:compareStrings(“Enterprise”, “defiant”)should return -1 (since ASCII values for capitalsprecede those for lower-case characters)compareStrings(“enterprise”,“enter”)should return 1compareStrings(“Excelsior”, “”)should return 1compareStrings(“”,“Excelsior”)should return -12.(15 pts)In theRecursiveLL<E>class that we discussed in lecture, add recursive methods for eachof the following wrappers. Your recursive methods should add at least one parameter to keep track ofthe current node in the list.You can use the posted code as a starting point.a.(4 pts)contains(E someItem)– returnstrueifsomeItemexists in the list,falseif not.b.(4 pts)search(E someItem)– returns the index of the first occurrence ofsomeItemif itexists in the list, or -1 ifsomeItemis not in the list.c.(7 pts)reverse()– reverses the calling list. (Hint: write a recursive method that reverses thelist starting from a specific node, returning the head of the reversed list.)3.(25 pts)You are developing the next great graphics program to compete with the likes of AdobePhotoshop and GIMP.At the moment, your program works only on binary images (i.e., each pixel canbe only black or white).You are working on a “magic wand” feature where clicking on a single pixel will select that pixel as well asall contiguous pixels. Two pixelsAandBare considered contiguous if 1) they are the same color, and 2)they can be connected by a path of pixels that have the same color asAandB. Diagonal pixels are notconsidered contiguous. For example, in the image below, pixelsAandBare contiguous, butAandCarenot.ACBWrite a program that allows the user to specify a text file to read image data from. Each row of pixelsconsists of 0’s and 1’s separated by spaces, with 0 indicating white and 1 indicating black. You can assumethat each row of the text file will have the same number of columns. However, the number of rows andcolumns can be anything. For example, the image above would be represented in the text file as

Attachments:

Answers

(11)
Status NEW Posted 09 May 2017 03:05 AM My Price 9.00

-----------

Not Rated(0)