2.) If G is a directed graph with 20 vertices, how many boolean values will be n
ID: 3561874 • Letter: 2
Question
2.) If G is a directed graph with 20 vertices, how many boolean values will be needed to represent G using an adjacency matrix?
3.) Given the following information, identify if declarations are legal or illegal
A is a class. B is a new class that extends A.
a = new A ( );
b = new B ( );
b1 = new B( );
b2 = new B ( );
Also, there are two methods: f & g. f has an argument of type A, g has an argument of type B.
e) f(b) f) g(a) g) g(b)
4) Write a recursive method that meets the following criteria. The method will take an integer called x, and print out all EVEN number integers between x and 0. Legal values have been checked prior to the method call; this method can expect x to be a positive integer greater than 50 and less than or equal to 100.
5) Assume you have a linked list using the following node (and head declaration):
class node {
node next;
int data } node head;
Write a short method that will quickly sort the data using a bubblesort (pairwise or list-wise). Do not use any built in list sorting methods. Your method takes a reference to the head of the list and will return nothing (void), but the list will be sorted numerically, from lowest to highest.
6) Assume you have a stack built with an array of characters. There is a variable called Top which gives the index of the first open cell on the top of the stack (example shown below). Write a search method that takes a character target value and returns true if it in the stack; false otherwise. The stack is not to be changed in this
Explanation / Answer
@bruce williamson
YOU CANNOT HAVE A RETURN STATEMENT IN A METHOD WITH A VOID RETURN TYPE!!!! TERRIBLE PROGRAMMING!
Related Questions
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.