Undecidability .20 marks
Let L1 = {M | M is a TM that halts on the empty tape leaving exactly two words on its tape in the form Bw1Bw2B} where B represents Blank like w1 w2 . (a) The problem of deciding whether an arbitrary Turing machine will accept an arbitrary input is undecidable. Prove formally using problem reduction, that given an arbitrary Turing machine M, the problem of deciding if M ∈ L1 is undecidable.
(b) Is L1 recursive, recursively enumerable, non-recursively enumerable, uncomputable? Justify your answer.
In: Computer Science
Q3) Our implementation of a doubly list relies on two sentinel nodes, header and trailer. Re-implement the DoublyLinkedList without using these nodes.
I want the answer to be a text not on a paper please
class DoublyLinkedList:
public class DoublyLinkedList {
public static class Node{
private E element;
private Node prev;
private Node next;
public Node(E e, Node p, Node n){
element = e;
prev = p;
next = n;
}
public E getElement() {
return element;
}
public Node getPrev() {
return prev;
}
public Node getNext() {
return next;
}
public void setPrev(Node p) {
next = p;
}
public void setNext(Node n) {
next = n;
}
}
private Node header;
private Node trailer;
private int size = 0;
public DoublyLinkedList(){
header = new Node<>(null,null,null);
trailer = new Node<>(null, header, null);
header.setNext(trailer);
}
public int size(){
return size;
}
public boolean isEmpty(){
return size ==0;
}
public E first(){
if(isEmpty())
return null;
return header.getNext().getElement();
}
public E last(){
if(isEmpty())
return null;
return trailer.getPrev().getElement();
}
}
In: Computer Science
An analysis of the emergency services responding to a hazardous chemical incident needs to be performed. In the scenario analyzed, some youths had broken into a farm and disturbed some chemicals in sacking. One of the youths had been taken to the hospital with respiratory problems, whilst the others were still at the scene. The police were sent to investigate the break-in at the farm. They called in the fire service to identify the chemical and clean up the spillage. The overall analysis shows four main sub-goals: receive notification of an incident, gather information about the incident, deal with the chemical incident, and resolve the incident. Perform a hierarchical task analysis for the above scenario. [Hint your answer should demonstrate all features of HTA Notations such as Selection, Iteration, Sequence and Unit task]
In: Computer Science
Write down a while loop that calculates and displays the SQUARE of ten ODD numbers (from 1 to 19) in a loop style execution:
C++
In: Computer Science
1000-1200 WORDS
Choose an existing web site that you think can be improved or you have experienced problems with and explore the site thoroughly.
In: Computer Science
Question
Objective:
The purpose of this lab is for you to become familiar with Python’s built-in text container -- class str -- and lists containing multiple strings. One of the advantages of the str class is that, to the programmer, strings in your code may be treated in a manner that is similar to how numbers are treated. Just like ints, floats, a string object (i.e., variable) may be initialized with a literal value or the contents of another string object. String objects may also be added together (concatenation) and multiplied by an integer (replication). Strings may also be compared for “equality” and arranged into some order (e.g., alphabetical order, ordering by number of characters, etc.). Finally, strings may be placed in containers which can then be passed as arguments to functions for more complex manipulations.
Specifications:
Write an interactive Python program composed of several functions that manipulate strings in different ways. Your main() function prompts the user for a series of strings which are placed into a list container. The user should be able to input as many strings as they choose (i.e., a sentinel-controlled loop). Your main function will then pass this list of strings to a variety of functions for manipulation (see below).
The main logic of your program must be included within a loop that repeats until the user decides he/she does not want to continue processing lists of strings. The pseudo code for the body of your main() function might be something like this:
# Create the main function
def main():
# declare any necessary variable(s)
# // Loop: while the user wants to continue processing more lists of words
#
# // Loop: while the user want to enter more words (minimum of 8)
# // Prompt for, input and store a word (string) into a list # // Pass the list of words to following functions, and perform the manipulations
# // to produce and return a new, modified, copy of the list.
# // NOTE: None of the following functions can change the list parameter it
# // receives – the manipulated items must be returned as a new list.
#
# // SortByIncreasingLength(…)
# // SortByDecreasingLength(…)
# // SortByTheMostVowels(…)
# // SortByTheLeastVowels(…)
# // CapitalizeEveryOtherCharacter(…)
# // ReverseWordOrdering(…)
# // FoldWordsOnMiddleOfList(…)
# // Display the contents of the modified lists of words
#
# // Ask if the user wants to process another list of words
Deliverable(s):
Your deliverable should be a Word document with screenshots showing the sample code you have created, and discuss the issues that you had for this project related to AWS and/or Python IDE and how you solved them.
Submit the program you develop including captured output. Also turn in screen captures from running your program inputting, as a minimum, three (3) sets word lists (no fewer than 8 words per list).
In: Computer Science
L ={x^a y^b z^c | c=a+b}
a) Prove that L is not regular.
b)Prove by giving a context-free grammar that the L is context free.
c)Give a regular expression of the complement L'.
In: Computer Science
C++
Create a class called Musicians to contain three functions string ( ), wind ( ) and perc ( ).
Each of these functions should initialize a string array to
contain the following instruments:
- veena, guitar, sitar, sarod and mandolin under
string ( )
- flute, clarinet saxophone, nadhaswaram and
piccolo under wind ( )
- tabla, mridangam, bangos, drums and tambour
under perc ( )
It should also display the contents of the arrays that are initialized.
Create a derived class called TypeIns to contain a function called get ( ) and show ( ). The get ( ) function must display instruments as follows:
Type of instruments to be displayed
a. String instruments
b. wind instruments
c. Percussion instruments
The show ( ) function should display the relevant detail according to our choice. The base class variables must be accessible only to its derived classes.
In: Computer Science
Hello There!
I have a question to answer please, I don't understand it, it is about data communication and networking "Wireshark"
Capture ICMP packets with “Wireshark” and analyze the results.
Capturing Basics and Filters
1_ Create a filter to show only HTTP traffic with destination port 80.
2_ Create a filter to exclude ARP and ICMP traffic from visualization.
3_ Create a filter to show DNS queries to a specific domain. TIP: Use the keyword contains to search a specific value in the payload.
I want to see screenshots please and outcomes,
Thanks!
In: Computer Science
Thus, an expression can contain a sequence of delimiters such as
{ [ ( ) ( ) ] ( ) }
but not
[ ( ] )
For convenience, we will say that a balanced expression contains delimiters that are paired correctly, or are balanced.
In: Computer Science
Create a java program for Student profile with the following requirements.
To test the program, create a class StudentTest with the main method.
In the main method:
Answer:
In: Computer Science
Create a C++ program based on the following criteria:
In: Computer Science
For this portion of the lab, you will reuse the Python program
you wrote before.
That means you will open the lab you wrote in the previous
assignment and change it. You should NOT start from scratch. Also,
all the requirements/prohibitions from the previous lab MUST also
be included /omitted from this lab.
Redesign the solution so that some portions of the code are
repeated. In lab 4 you validated input to ensure that the user
entered inputs within certain values. If the user entered an
invalid value, the program terminated. Now you will add a loop such
that the user gets three chances to enter a valid value. If the
user enters an invalid value more than three times in a row, the
program should issue an error message and terminate.
The program I wrote before is shown below.
How can I apply the new requirements to reuse this program?
#Get a value from user.
Miles = float(input('How many miles would you like to convert into
kilometers: '))
#Condition
if Miles >= 0:
#Convert miles to kilomters
Kilometers = Miles * 1.6
#Display result
print(Miles,"miles is equal to", Kilometers,"kilometers.")
#Get a value from user.
Gallons = float(input('How many gallons would you like to convert
into liters: '))
#Condition
if Gallons >= 0:
#Convert gallons to liters
Liters = Gallons * 3.9
#Display result
print(Gallons,"gallons is equal to", Liters,"liters.")
#Get a value from user.
Pounds = float(input('How many pounds would you like to convert
into kilograms: '))
#Condition
if Pounds >= 0:
#Convert pounds to kilograms
Kilograms = Pounds * 0.45
#Display result
print(Pounds,"pounds is equal to", Kilograms,"kilograms.")
#Get a value from user.
Inches = float(input('How many inches would you like to convert
into centimeters: '))
#Condition
if Inches > 0:
#Convert inches to centimeters
Centimeters = Inches * 2.54
#Display result
print(Inches,"inches is equal to",Centimeters,"centimeters.")
#Get a value from user.
Fahrenheit = float(input('How many fahrenheit would you like to
convert into celsius: '))
#Condition
if Fahrenheit < 1000:
#Convert fahrenheits to celsius
Celsius =(Fahrenheit - 32) * 5/9
#Display result
print(Fahrenheit,"fahrenheits is equal
to",Celsius,"celsius.")
else:
#Display error message
print('Invalid value!')
else:
#Display error message
print('Invalid value!')
else:
#Display error message
else:
#Display error message
print('Invalid value!')
else:
#Display error message
print('Invalid value!')
In: Computer Science
In: Computer Science
how to run child process and parent process in parallel/at the same time in python using os
In: Computer Science