Need help with trying to rewrite the getFrequencyOf method using recursion. I will provide the original non recursive code also. Try not to use the toArray method and use node chain. Non-recursive...


Need help with trying to rewrite the getFrequencyOf method using recursion. I will provide the original non recursive code also. Try not to use the toArray method and use node chain.



Non-recursive method


public int getFrequencyOf(T anEntry) {
int frequency = 0;
int counter = 0;
Node currentNode = firstNode;


while ((counter < numberofentries)="" &&="" (currentnode="" !="null))">
if (anEntry.equals(currentNode.data)) {
frequency++;
}
counter++;
currentNode = currentNode.next;
}
return frequency;
}



Jun 04, 2022
SOLUTION.PDF

Get Answer To This Question

Related Questions & Answers

More Questions ยป

Submit New Assignment

Copy and Paste Your Assignment Here