Iterate through the given array and return the number of fours.
Search Results
Individual Exercises
Complete the following binary search method. Find the number num
in the array array
. Return -1 if the number is not found. You may assume...
Write a function in Java that takes in the int[] array
, sorts it using bubble sort, then returns back the sorted array.
May Tricks owns a chain of magic shops. She hands you a list of her store locations and asks you to find a way of quickly looking up the...
What would be the Big O Complexity for the following method?
public boolean crossRoad(boolean isSafe, int height, int length) { if...
Given is an adjacency matrix and a starting index.
Complete the depth first traversal method. Comments noted with //_________________ are...
Write a function in Java that takes the int array arr
and returns a new array with each number being doubled. Be sure to make use of...
What would be the Big O Complexity for the following method?
public static void arrayDoubleValue(int[] nums, int[][] nums2) { for (int i...
"Determine which exception is needed for each case and put them in the corresponding catch statement with the appropriate variable. Do ...
Complete the method so that the number num
is set to index point index
in the array named array
. Be sure to handle the exception with the...
Surround the appropriate lines of code with a try catch block so that first, an exception is caught when the String index is out of...
Return an array with the same contents, but double the size of the array passed in. The new slots will be filled with zeros. Use the...
Return the index of first four in an array. Return -1 if there are none.
Write the method findMin
that will return the smallest number in an array of integers.
The following method takes an integer array as a parameter. Write code that loops through the array to find the value 1. If 1 is found,...
Return the index of the last occurrence of a given number in an array. Return -1 if the number is not in the array.
The following method is a Selection Sort method. Within the method, there is an error on one line. You job is to find that line and fix...
Given is the number of edges and vertices in a directed graph. Using this information return the density of the graph.
Number of possible...
Roxy has written a method to count the number of people in her neighborhood, excluding children under 16 and individuals who are only...
Finish the code to complete the insertion sort method. Each comment denoted with //_________________ is a single line that needs to be...
The mere presence of oversized arrays makes Priscilla Perfect sick to her stomach. Such wasted space is an imperfection she cannot bear....
Priscilla Perfect detests imperfection (hence the name). Write a program to analyze a given array and return true if the array is worthy...
[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 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...