A DAG is:
Search Results
Searching for: Java
Individual Exercises
The sequence of vertices v1...vn with edges connecting all the vertices is called:
Trees and lists are special cases of graphs.
Based on the adjacency matrix shown below, which of the following statements is true:
The adjacency matrix shown below is an accurate representation of the graph shown below.
On a breadth first search traversal of the graph shown below, and starting at node a, the first three nodes visited are:
On a depth first search traversal of the graph shown below, and starting at node a, the first three nodes visited are:
Below is a class that represents the numbers picked on a lottery ticket.
public class LotteryTicket { private int[] numbers; // your...
This is a test
Complete the following binary search method on integers. Find the number search
in the array numbers
. Return the index of the element if...
Recursive procedure that returns the number of H in a string of heads (H) or tails (T) outcomes. This must be a recursive routine. You...
The method skeleton below takes in an integer variable top
.
Using a while
loop, write a method that will return the sum of all numbers...
The method skeleton below takes in an integer variable top
.
Using a for
loop, write a method that will return the sum of all numbers from...
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...
At the heart of test-driven development is writing ___.
Consider a linear search as shown below.
int linearSearch(int w, int[] num) { // linear search code here }
Assume you call this method...
Binary search is a more efficient search than linear search. Which one of these is true?
What is wrong with this code?
String x; if (x.length() > 0) System.out.println("Hello "+x);
What does this code do?
int nums[] = {}; System.out.println(nums.length);
Write a method replaceSpaceUnderscore
that replaces all spaces with _
(underscores) in the String sentence
.
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...