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 on integers. Find the number search
in the array numbers
. Return the index of the element if...
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...
Given an array of int
s, return the POSITION (i.e., the index) of smallest value in the array. Assume the array has only posivitive...
Given an array of int
s, return the first value in the array. You may assume the array has at least one value.
Given an array of int
s, return the last value in the array. You may assume the array has at least one value.
Given an array of int
s, return true
if all values in the array are even values. This routine should return false
if at least one value is...
Complete the following linear search method. Find the string search
in the array words
. If the string is found, return the string found....
Complete the following binary search method on characters. Find the character search
in the array letters
. Return the index of the...
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...