Given a class Answer<E>
, write a method that converts argument e
into String and returns that value. If the value is a primitve, (...
Search Results
Individual Exercises
The method mapNums returns a HashMap that stores values of how many times a given key digit has appeared in an input String. Write a...
Given is the number of edges and vertices in a directed graph. Using this information return the density of the graph.
Number of possible...
Given an int
, return a double
of precisely half the initial value. The int
will need to be converted into a double
before any other...
Roxy has written a method to count the number of people in her neighborhood, excluding children under 16 and individuals who are only...
You’re an employee at an ice cream shop and your shop needs help organizing who’s in line. People usually come to this shop with their...
Finish the code to complete the insertion sort method. Each comment denoted with //_________________ is a single line that needs to be...
What's wrong with the following code? Assume both the interface and class share the same package.
public interface Account { int...
Given a stack with Integers, write a function that pops the top two numbers from the stack, adds them together and pushes the result back...
Octavia has given you a list of movies. She is tired of deciding what to watch by name and now wants to be able to pick them by the...
You are in charge of keeping student records. Those records are recorded in a hash map that uses a student's ID number as the key in...
The LinearNode class is used to represent the individual nodes in a linear LinkedList. This particular LinkedList is doubly linked....
Mars' new colony needs your help. This morning, a flurry of distress signals reached Earth, each encrypted with a secret message....
The mere presence of oversized arrays makes Priscilla Perfect sick to her stomach. Such wasted space is an imperfection she cannot bear....
Use the following recursive method:
public int mysteryMethod(int n) { if (n < 0) { return 5; } else { return mysteryMethod(n - 1) +...
Complete the hashing algorithm for a hash table so that it functions using open addressing. Remember to store both keys and values in...
Priscilla Perfect detests imperfection (hence the name). Write a program to analyze a given array and return true if the array is worthy...
In mathematics, the Perrin Numbers are defined by the recursion relation
P(n) = P(n - 2) + P(n -3) for n > 2
with initial values
P(0)...
[Based on an exercise at https://codeworkout.cs.vt.edu/]
Given two int
arrays a
and b
, each with two elements, return a new array with...
Write a method quicksort that takes in an ArrayList of integers and returns them in ascending order, using a quicksort style of sorting....
Write an algorithm that takes an ArrayList and uses a recursive binary search to return both the index of a given String, or -1 if the...
As a wild publicity stunt May Tricks has made her Middletown store disappear! You have no idea how she did this or if the store will ever...
Since May Tricks has proved to be a very unpredictable client you have decided to take extra precautions. By creating a remove vertex...
Given a string str
and an int n
, return a string made of the first n
characters of the string, followed by the first n - 1
characters of...
[Based on an exercise at https://codeworkout.cs.vt.edu/]
Given an array of Strings, return a single String that is made up of all strings...