Write a function that accepts an integer argument and checks if the number is
prime. Write a function that keeps count of number of times it’s been invoked
Given an input undirected graph, write a program to find all articulation points in the graph. An articulation point is a vertex whose removal disconnects the graph. (Assume that the input graph is connected.) If a graph has no articulation points, it is called a
biconnected graph.
Input Format: The input is a text file which describes an undirected graph. The first line of the file specifies n & m, the number of vertices and number of edges in the graph respectively. The next m lines specify the m edges of the graph, one line per edge. An edge is described by its end points. If the number of vertices is n, assume that the vertices of the graph are numbered (0,1,..n-1).Input in terminal taken as python main.py ./input.txt
Output Format: Print “Biconnected Graph” if the input graph has no articulation points. If articulation points are found, print the vertices which are the articulation points.
Sample Input 1:
7 8
0 1
0 2
2 1
2 3
4 2
3 5
4 6
5 6
Sample Output 1
Articulation points found:
2
Given an input undirected graph, write a program to check if the graph is two-edge connected or not. If the graph is not two-edge connected, print all the bridge edges. (Assume that the input graph is connected.)
Input Format: The input is a text file which describes an undirected graph. The first line of the file specifies n & m, the number of vertices and number of edges in the graph respectively. The next m lines specify the m edges of the graph, one line per edge. An edge is described by its end points. If the number of vertices is n, assume that the vertices of the graph are numbered (0,1,..n-1).Code is run in terminal as python3 main.py ./input.txt
Output Format: Print YES, if the input graph is two-edge connected, NO otherwise. If printing NO, print all the bridge edges in the graph.
Sample Input 1
(for the graph shown on the right):
8 10
0 1
1 2
0 3
3 4
3 6
4 6
5 4
5 6
7 6
5 7
Sample Output 1:
NO
1 2
0 1
0 3
You are given an array of N non-negative integers: A1, A2, ..., AN. An alternating subsequence is a subsequence in which the indices of any two consecutive elements differ by exactly two in the original array. That is, if Ai1, Ai2, ..., Aik is some subsequence, then for it to be an alternating subsequence, (i2 - i1 = 2), (i3 - i2 = 2), and so on should all hold true. Among all alternating subsequences, find the one which has maximum sum of elements, and output that sum.
Define a struct , FruitType, to store the following data about a fruit: Fruit name (string), color (string), fat (int), sugar ( int ), and carbohydrate (int). Now write a program that implements the struct FruitType, then include two functions. One function must ask the user to input the data about the fruit. The other function must output the data bout the fruit.
import java.util.*;
class App {
public static void main(String[] args) {
Scanner in = new Scanner(System.in);
System.out.println("Enter a String: ");
String string = in.nextLine().toLowerCase();
System.out.print("Enter character to find: ");
String characterFind = in.nextLine().toLowerCase();
int index = string.indexOf(characterFind);
System.out.print("Index Position: ");
while (index >= 0) {
System.out.print(index + " ");
index = string.indexOf(characterFind, index + 1);
}
in.close();
}
}
Do this coding without using characterFind, Array, Array functions, split
1.How do i write a program that prints different messages for different months of the year.
2.2
(Convert Celsius to Fahrenheit) Write a program that reads a Celsius degree in
a double value from the console, then converts it to Fahrenheit and displays the
result. The formula for the conversion is as follows:
fahrenheit = (9 / 5) * celsius + 32
Hint: In Java, 9 / 5 is 1, but 9.0 / 5 is 1.8.
Here is a sample run:
Enter a degree in Celsius: 43
43 Celsius is 109.4 Fahrenheit
The cost to ship a package is a flat fee of 75 cents plus 25 cents per pound.
1. Declare a const named CENTS_PER_POUND and initialize with 25.
2. Get the shipping weight from user input storing the weight into shipWeightPounds.
3. Using FLAT_FEE_CENTS and CENTS_PER_POUND constants, assign shipCostCents with the cost of shipping a package weighing shipWeightPounds.
(Compute the volume of a cylinder) Write a program that reads in the radius
and length of a cylinder and computes the area and volume using the following
formulas:
area = radius * radius
* TT
volume = area * length
Here is a sample run:
Enter the radius and length of a cylinder: 5.5 12 Enter
The area is 95.0331
The volume is 1140.4