The following method takes in a 2 dimensional array as a parameter. Set the first value in each row to 10, then return the array.
Search Results
Searching for: array
Individual Exercises
Write a method that will return true
if int num
is even.
The following method takes in a 1-dimensional array of integers and should change every item that has an even index to the number 100....
The following method takes in a 2D array of characters. for each row at an even index, change every item in that row to '*'.
For example:...
In math, multiplying a matrix by a single number is straightforward. For example, if you had a 2D array of ints
int [][] numbers = { {1,...
The following method takes in an int
representing some number of inches. Implement it so that it returns a string reporting the number of...
The following method takes in a 2D character array. Somewhere in that array, there may be one '*'
character. This method should find that...
The following method will appear in a class with a generic type parameter T
. It takes in a 2D array of elements of that generic type T
,...
Below is a class that represents the numbers picked on a lottery ticket.
public class LotteryTicket { private int[] numbers; // your...
Complete the following binary search method. Find the number search
in the array numbers
. Return -1 if the number is not found. You may...
Complete the following linear search method. Find the number search
in the array numbers
. If the number is found, return the index for...
Complete the following contains
method so it returns true
if the value being searched is found in the array, or false
otherwise. You must...
Complete the following linear search method. Find the number search
in the array numbers
. If the number is found, return the index for...
Complete the following linear search method. Find the string search
in the array words
. If the string is found, return the index for the...
What does this code do?
int nums[] = {}; System.out.println(nums.length);
Complete the method countTimesContains
that returns the number of times the array words
contains the word stored in searchW
. Remember to...
Write a method searchInLastN
that implements a linear search but only looks for values in the last positions, determined by the parameter...
For function recursiveMin
, write the missing part of the recursive call. This function should return the minimum element in an array of...
For the question below, assume the following implementation of LinkedStack:
public class LinkedStack<T> implements StackInterface...
For the question below, assume the following implementation of ArrayQueue with a fixed-size array and one unused slot
public class ...
For the question below, assume the following implementation of ArrayQueue with a fixed-size array and one unused slot
public class ...
For the question below, assume the following implementation of ArrayQueue:
public class ArrayQueue<T> implements QueueInterface...
For the question below, assume the following implementation of ArrayQueue:
public class ArrayQueue<T> implements QueueInterface...