Write and Compile a python script to solve the 4-queens problem using Forward Checking algorithm . The code should allow for random starting, and for placed starting. Random Starting means randomly place a queen position on the chessboard. Placed Starting means asked for the user input to place a queen position on the chessboard. Display the iterations until the final solution
"The 4-Queens Problem[1] consists in placing four queens on a 4 x 4 chessboard so that no two queens can capture each other. That is, no two queens are allowed to be placed on the same row, the same column or the same diagonal."
Display the output of the python Script
In: Computer Science
Blurred Sequence
Jojo as a treasure hunter has finally found the ancient treasure box. The treasure box has three layers of lock. Each layer of lock contains clues to unlock the lock.
The first layer of lock gives a sequence of numbers. But as we know that the treasure box is as old as the dinosaurs, the sequence is blurred as it goes to the end. Jojo can only read the first seven numbers of the sequence which is: 1 , 1 , 2 , 3 , 5 , 8 , 13, ... and the rest are blurred.
After a days of researching, Jojo found out that the sequence is a fibonacci sequence which each number is the sum of the two preceding ones. Formally, fibonacci sequence are written as Fi as the i-th fibonacci number and its property is Fi = Fi-1 + Fi-2 where i > 2 and in this case, the base cases are F1 = 1 and F2 = 1.
And it’s not even the riddle yet. The lock gives Jojo two numbers L and R and asks Jojo to get the sum of its digits from L-th fibonacci to R-th fibonacci inclusive. As a good friend of Jojo, help Jojo to solve the first layer lock riddle.
Format Input:
There are T testcases. Each testcase contains two integers L and R which indicates the numbers that the lock gives.
Format Output:
Output T line with format “Case # X: ”, where X indicates the testcase number and then followed by the answer of the riddle.
Constraints
• 1 ≤ T ≤ 100
• 1 ≤ L ≤ R ≤ 64
Sample Input (standard input):
5
1 4
3 5
6 7
9 9
3 11
Sample Output (standard output):
Case #1: 7
Case #2: 10
Case #3: 12
Case #4: 7
Case #5: 59
NOTE: USE C LANGUAGE, DONT USE FUNCTION(RESULT,RETURN),VOID,RECURSIVE, USE BASIC CODE AND CODE IT UNDER int main (){, constraint must be the same
In: Computer Science
Question 3 Coding of a video
Answer this question using your chosen YouTube video.
a) For the chosen video, is there a lot of temporal redundancy
between the frames?
In your opinion, does the temporal redundancy in this video make it
possible to obtain a
very high compression? Explain assuming compression with MPEG, as
seen in
the lesson.
b) Is the chosen video encoded in progressive format? Explain your
answer.
c) (1 point) Does the video contain block effects? Explain why
there is presence or
absence of block effects.
In: Computer Science
In: Computer Science
Determine whether each of these sets is countable or uncountable. for those that are countably infinite. exhibit a one-on-one correspondence between the set of positive integers and that set.
In: Computer Science
Question 4 Audio coding
Answer this question using your chosen YouTube video.
For the chosen video, could the sound be encoded efficiently with
the predictive encoding method
linear (LPC)? Explain your answer.
In: Computer Science
Write a MIPS Assembly program function to calculate the factorial of an input number. Analyze the program for the value 10 and compute the Execution time in a MIPS processor at 2.4GHz. The CPI is 1.
In: Computer Science
Assume the following list of keys for problems
17, 58, 80, 22, 45, 48, 95, 5, 100, 38, 36, 11, 27
|
Problem 4: |
(2 points) The above list is to be sorted using the quick sort algorithm as discussed in this chapter. Use pivot as the middle element of the list.
|
|
Problem 5: |
(2.5 points) Assume the following list of keys: 78, 40, 16, 82, 64, 67, 57, 40, 37, 47, 72, 14, 17, 27, 55 This list is to be sorted using the quick sort algorithm as discussed in this chapter. Use pivot as the median of the first, last, and middle elements of the list.
|
JAVA
In: Computer Science
You can assume that the bottles in a single order are all of the same size.
Given an order, the problem is to calculate the number of litres of lemonade required to fill all the bottles for that order.
The number of litres required for a single bottle is calculated as follows: Multiply 0.9560 with 1, 2 or 3 depending on whether the bottle size is ‘small’, ‘medium’ and ‘large’, respectively.
Part iii of this question involves writing one Python function definition.
iii.Provide a single Python function that implements the algorithm. Follow the instructions above for submitting code.
Your answer must be a translation of your algorithm from part c (ii), otherwise no marks will be awarded.
In: Computer Science
Consider two different implementations, P1 and P2, of the same instruction set. There are five classes of instructions (A, B, C, D, and E) in the instruction set. The clock rate and CPI of each class is given below.
|
CLK Rate |
CPI for A |
CPI for B |
CPI for C |
CPI for D |
CPI for E |
|
|
P1 |
2 GHz |
1 |
1 |
3 |
3 |
2 |
|
P2 |
3 GHz |
1 |
2 |
3 |
4 |
3 |
The total number of instructions for Program X1 are A1, B1, C1, D1 and E1 while the total number of instruction s for X2 are A2, B2, C2, D2, and E2. Compute which program runs faster on each computers P1 and P2.values are A1=230,B1=370,C1=300,D1=140,E1=95 AND A2=330,B2=250,C2=400,D2=180,E2=185
In: Computer Science
Select a research paper topic and develop an abstract.
Write 150 word topic proposal for your final project.
Your topic needs to focus on a critical challenge in cybersecurity facing National Security Professionals. This challenge can come from technology, policy, international relations, economics, or any of the fields where the digital world brings its effects to bear. Think about recent cybersecurity incidents and events. What research question comes to mind when you think of cybersecurity challenges?
Your topic proposals need to be clear and precise. Use bulleted points to clearly state the topic and address the parameters in at least one or two sentences.
In: Computer Science
I'm pretty new to JUnit testing. Can someone demonstrate how to
test one of the tree traversals and the add() and addrecursive()
methods?
public class BinaryTree {
private MorseNode<Character> root = new
MorseNode<Character>();
private MorseNode<Character> left = null;
private MorseNode<Character> right =
null;
public MorseNode<Character> getRoot() {
return root;
}
public void printPostorder(MorseNode<Character>
node) {
if(node == null) {return;}
//System.out.print(node.getLetter());
//traverse left subtree
printPostorder(node.getLeft());
//traverse right subtree
printPostorder(node.getRight());
//node
if(node.getLetter() != null) {
System.out.print(node.getLetter()
+ " ");}
}
public void printPreorder(MorseNode<Character>
node) {
if(node == null) {return;}
//System.out.print(node.getLetter());
//node
if(node.getLetter() != null) {
System.out.print(node.getLetter()
+ " ");}
//traverse left
printPreorder(node.getLeft());
//traverse right
printPreorder(node.getRight());
}
public void printInorder(MorseNode<Character>
node) {
if(node == null) {return;}
//System.out.print(node.getLetter());
//traverse left subtree
printInorder(node.getLeft());
//node
if(node.getLetter() != null) {
System.out.print(node.getLetter()
+ " ");}
//traverse right subtree
printInorder(node.getRight());
}
void printInorder() {
System.out.println("Inorder
Traversal: ");
printInorder(root);
System.out.println();
}
void printPreorder() {
System.out.println("PreOrder
Traversal: ");
printPreorder(root);
System.out.println();
}
void printPostorder() {
System.out.println("PostOrder
Traversal: ");
printPostorder(root);
System.out.println();
}
public void add(String str, char letter)
{
//System.out.println(str + "sssssss " + letter );
if (str.charAt(0) == ".".charAt(0)) {
//`System.out.println(str + letter );
root.setLeft(addRecursive(root.getLeft(),
str.substring(1), letter));
}
else if (str.charAt(0) == "-".charAt(0))
root.setRight(addRecursive(root.getRight(), str.substring(1),
letter));
}
public MorseNode<Character>
addRecursive(MorseNode<Character> current, String str,
char letter) {
if (str.length() == 0) {
return new
MorseNode<Character>(letter);
}
if ( Character.compare(str.charAt(0),
".".charAt(0)) == 0) {
current.setLeft(addRecursive(current.getLeft(),
str.substring(1), letter));
} else if
(Character.compare(str.charAt(0), "-".charAt(0)) == 0)
{
current.setRight(addRecursive(current.getRight(),
str.substring(1), letter));
}
return current;
}
}
import static org.junit.Assert.assertEquals;
import static org.junit.jupiter.api.Assertions.*;
import org.junit.jupiter.api.Test;
class BinaryTreeTest {
@Test
void testInorder() {
BinaryTree object = new BinaryTree();
char a = 'a',b='c',c='c';
String as = ".",bs = ".-",cs="..";
object.add(as, a);
object.add(bs, b);
object.add(cs, c);
String inorder = "c a b";
}
@Test
void testPostorder() {
}
@Test
void testPreorder() {
}
@Test
void testadd() {
}
}
public class MorseNode<T> {
private T letter; //letter of node
private MorseNode<T> left; //left child
private MorseNode<T> right; //right child
public MorseNode() {
}
public MorseNode(T letter) {
this.letter=letter;
}
//GETS letter in node
public T getLetter() {
return letter;
}
//SETS letter in node
public void setLetter(T letter) {
this.letter = letter;
}
//GETS left child node
public MorseNode<T> getLeft() {
return left;
}
//GETS right child node
public MorseNode<T> getRight() {
return right;
}
//SETS left child node
public void setLeft(MorseNode<T> left) {
this.left = left;
}
//SETS right child node
public void setRight(MorseNode<T> right)
{
this.right = right;
}
//print node
public String toString() {
String str = letter.toString();
return str;
}
}
import java.io.File;
import java.io.FileNotFoundException;
import java.util.ArrayList;
import java.util.List;
import java.util.Scanner;
import java.util.StringTokenizer;
public class MorseNodeDriver {
public static void main(String[] args) throws FileNotFoundException {
BinaryTree theTree = new BinaryTree();
File codeFile = new File("morse.txt");
Scanner myReader = new Scanner(codeFile);
while (myReader.hasNextLine() ) {
String data = myReader.nextLine();
// System.out.println(data);
int len = data.length();
//if (len==2)
theTree.add(data.substring(1), data.charAt(0));
}
theTree.printInorder();
theTree.printPostorder();
theTree.printPreorder();
//System.out.println(theTree.toString());
File translateFile = new File("translate.txt");
Scanner read = new Scanner(translateFile);
System.out.println("\n\n____________Translations__________\n");
while(read.hasNextLine()) {
String morsecode = read.nextLine();
//System.out.println(morsecode);
String[] array = morsecode.split(" ");
for(int x = 0; x< array.length; x++) {
//System.out.println(array[x]);
if(array[x].contentEquals("")) {
System.out.print(" ");
}
else if(array[x].contentEquals(".")) { //e
System.out.print(theTree.getRoot().getLeft());
}
else if(array[x].contentEquals("..")) { //i
System.out.print(theTree.getRoot().getLeft().getLeft());
}
else if(array[x].contentEquals("...")) { //s
System.out.print(theTree.getRoot().getLeft().getLeft().getLeft());
}
else if(array[x].contentEquals("....")) { //h
System.out.print(theTree.getRoot().getLeft().getLeft().getLeft().getLeft());
}
else if(array[x].contentEquals("-")) { //t
System.out.print(theTree.getRoot().getRight());
}
else if(array[x].contentEquals("--")) { //m
System.out.print(theTree.getRoot().getRight().getRight());
}
else if(array[x].contentEquals("---")) { //o
System.out.print(theTree.getRoot().getRight().getRight().getRight());
}
else if(array[x].contentEquals(".-")) { //a
System.out.print(theTree.getRoot().getLeft().getRight());
}
else if(array[x].contentEquals("..-")) { //u
System.out.print(theTree.getRoot().getLeft().getLeft().getRight());
}
else if(array[x].contentEquals("...-")) { //v
System.out.print(theTree.getRoot().getLeft().getLeft().getLeft().getRight());
}
else if(array[x].contentEquals("-.")) { //n
System.out.print(theTree.getRoot().getRight().getLeft());
}
else if(array[x].contentEquals("--.")) { //g
System.out.print(theTree.getRoot().getRight().getRight().getLeft());
}
else if(array[x].contentEquals("-.-")) { //k
System.out.print(theTree.getRoot().getRight().getLeft().getRight());
}
else if(array[x].contentEquals("-..-")) { //x
System.out.print(theTree.getRoot().getRight().getLeft().getLeft().getRight());
}
else if(array[x].contentEquals(".-.")) { //r
System.out.print(theTree.getRoot().getLeft().getRight().getLeft());
}
else if(array[x].contentEquals("-..")) { //d
System.out.print(theTree.getRoot().getRight().getLeft().getLeft());
}
else if(array[x].contentEquals("-.--")) { //y
System.out.print(theTree.getRoot().getRight().getLeft().getRight().getRight());
}
//
else if(array[x].contentEquals(".-..")) { //l
System.out.print(theTree.getRoot().getLeft().getRight().getLeft().getLeft());
}
else if(array[x].contentEquals("..-.")) { //f
System.out.print(theTree.getRoot().getLeft().getLeft().getRight().getLeft());
}
else if(array[x].contentEquals("-...")) { //b
System.out.print(theTree.getRoot().getRight().getLeft().getLeft().getLeft());
}
else if(array[x].contentEquals("-.-.")) { //c
System.out.print(theTree.getRoot().getRight().getLeft().getRight().getLeft());
}
else if(array[x].contentEquals(".---")) { //j
System.out.print(theTree.getRoot().getLeft().getRight().getRight().getRight());
}
else if(array[x].contentEquals(".--.")) { //p
System.out.print(theTree.getRoot().getLeft().getRight().getRight().getLeft());
}
else if(array[x].contentEquals("--.-")) { //q
System.out.print(theTree.getRoot().getRight().getRight().getLeft().getRight());
}
else if(array[x].contentEquals(".--")) { //w
System.out.print(theTree.getRoot().getLeft().getRight().getRight());
}
else if(array[x].contentEquals("--..")) { //z
System.out.print(theTree.getRoot().getRight().getRight().getLeft().getLeft());
}
}
System.out.println();
}
//System.out.println(theTree.getRoot().getLeft().getLeft().getLeft().getLeft());
}
}
In: Computer Science
In: Computer Science
List all the I/O techniques and describe each technique in detail with a suitable block diagram.
In: Computer Science
Choose an organization, preferably one that you work in, have worked in, or are familiar with. Throughout the semester, you will be wearing the hat of the Chief Information Security Officer (CISO) for that organization. You will be planning its Cybersecurity strategy, defining all assets that require safeguarding, and identifying all components and controls. You will propose a Cybersecurity Strategy for your organization, a plan for an effective, collaborative, organization-wide cybersecurity posture and defence.
Your Strategy should identify crosscutting principles and apply these principles across IT Strategy goals. Within those goals, the Cybersecurity Strategy should identify the main objectives, with associated major tasks and activities. The Cybersecurity Strategy should also establish the guiding principles and strategic approach needed to drive both near- and long-term priorities for your organisation cybersecurity. It should be aligned with related frameworks and strategies, including the National Institute of Standards and Technology (NIST)'s Cybersecurity Framework. Through this strategy and the associated tasks, your organisation will improve its posture and protect its systems, information, and infrastructure from the cybersecurity threat.
Task
Describe in detail the intrusion detection and prevention measures that you will deploy in your organization
1. The proposal of the appropriate positions for IDS/IPS in a network topology in order to increase the security of the environment, along with providing supportive justifications of the proposed positions.
In: Computer Science