Questions
Part E (3 marks):  What is the shape of a BST that is O(n) to delete the...

Part E (3 marks):  What is the shape of a BST that is O(n) to delete the root?  Draw an example with at least 8 nodes.

In: Computer Science

Python create a program Dennis has always loved music, snd recently discovered a fascinating genre. Tautograms...

Python create a program
Dennis has always loved music, snd recently discovered a fascinating genre. Tautograms genre.
Tautograns are a special case of aliteration, which is the appearance of the same letter at the beginning of adjacent words. In particular, a sentence is a tautogram if all its word begin with the following sentences are tautograms.
French flowers bloom, San Serrano whistles softly, Pedro ordered pizza.
Dennis wants to dazzle his wife with a romantic letter full of these kinds of prayers. Help Dennus check if each sentence he wrote is tautogram or not.
Input format
Each test case is made up of a single line that contains a sentence. A sentence consists of a sequence of up to 50 words separate by individual spaces. A word is a sequence of up to 20 contiguos uppercase and lowercase letters of the English alphabet. A word contains at least one letter and a sentence contains at least test case is followed by a line containing a single character "*"

Constraints
For each test case, generate a single line that contains an uppercase " Yes " if the sentence is a tautogram, or an uppercase "No" otherwise.
Output Format
"Yes or No"

Sample input 0
Sam Serrano whistles softly
French flowers bloom
Pedro ordered Pizza
This is not tautogram
*
Sample output 0
yes
yes
yes
Not

In: Computer Science

Using python programming language, compare the four tasks. 1. For the following exercises you will be...

Using python programming language, compare the four tasks.

1. For the following exercises you will be writing a program that implements Euler’s method (pronounced ‘oy-ler’). It may be the case that you have not yet encountered Euler’s method in the course. Euler’s method can be found in Chapter 10.2 of your notes, which gives a good description of why this algorithm works. But for our purposes, we only need to know the algorithm itself - so there’s no need to worry if you are yet to understand it.

Euler’s method is used to approximate a function when only the derivative and a particular value is known. Given an initial value y and a corresponding x value, a derivative f’(x), and a step size h, the next value for y is calculated using the following formula:

next y = current y + f'(x)*h

If you want to calculate more steps, just reuse the formula but with your new y value. The new x value is also updated to x+h.

Task: To start, write a function called fdash(x), that returns the value of the derivative at x. The formula for the derivative which we will be using as a placeholder is:

fdash = 0.05x * e^(0.05x)

Round the output to 5 decimal places. Do not print anything, call your function, or ask for any input.

2. Recall the formula for Euler’s method is:

next y = current y + f'(x)*h

Task: Write a function called onestep(x, y, h) that calculates the next y value using Euler’s method with the given x, y and h values. The derivative is the same as used in the previous exercise. Copy paste your function from the previous exercise and use it in your onestep function.

Round the output to 5 decimal places. Do not print anything, call your onestep function, or ask for any input. You should have two functions defined in your code (onestep and fdash).

3. Recall that after one step of Euler’s function is calculated, the new x value is also updated to x+h. Note that it happens in that orde.r First the next y value is found, then the corresponding x value is updated.

Task: Write a function called eulers(x, y, h, n) that uses euler’s method n times with the given x, y and h values. It will return the final y value. Remember to copy paste your onestep and fdash functions. You are encouraged to use them in your eulers function, but it is up to you.

The fdash and onestep functions already round their output, so you will not need to do any rounding inside the eulers function.

Hint: One way of implementing this function is to use a while loop.

If you need help with Euler’s method:

The following example of Euler’s method is given in case you do not understand how it works with multiple steps:

F dash: 2x + 2

Initial x: 1

Initial y: 4

Step size (h): 0.5

Number of steps (n): 3

Step 1:

Fdash = 2*1 + 2 = 2 + 2 = 4

Value of y at step 1: new y = 4 + 4*0.5 = 4 + 2 = 6

New x value = 1 + 0.5 = 1.5

Step 2:

Fdash = 2*1.5 + 2 = 3 + 2 = 5

Value of y at step 2: new y = 6 + 5*0.5 = 6 + 2.5 = 8.5

New x value = 1.5 + 0.5 = 2

Step 3:

Fdash = 2*2 + 2 = 4 + 2 = 6

Value of y at step 3: new y = 8.5 + 6*0.5 = 8.5 + 3 = 11.5

New x value = 2 + 0.5 = 2.5

So our final value for y is 11.5 after 3 steps (at x = 2.5). For interest, one function with this derivative is y = x**2+2*x+1. At x = 1, y is equal to 4, like in this example. At x = 2.5 (which is our final x value), the value of y is 12.25. This is pretty close to our approximated value of 11.5.

4. An asteroid has been spotted travelling through our solar system. One astrophysicist has predicted that it will collide with Earth in exactly 215 days, using a new method for modelling trajectories. The researcher has asked you and others to verify their claim using a variety of methods. You have been tasked with modelling the asteroid’s trajectory using Euler’s method.

For an asteroid to collide with Earth, it needs to have the same x, y, and z coordinates as the Earth in 215 days (x, y, and z represent the three dimensions. Because solar systems are three dimensional!). If any of the final predicted x, y, and z values are different to the Earth’s, then that will mean the asteroid will not collide with Earth in 215 days.

It has already been proven that the asteroid will have the same x and z coordinates as Earth in 215 days. So, you only need to worry about the y dimension.

The equation for the change in y at day t after the asteroid was discovered is:

y'(t) = (-0.05t+5)*exp(0.002t)*0.05

In other words, this equation is the derivative of y(t). The starting y position of the asteroid is 160.195 million kilometers, which occurs at t = 0. The y position of Earth in 215 days (t = 215) is 150 million kilometers.

Task: Write a function called will_it_hit(h), that returns the number 1 if the asteroid is going to hit Earth in 215 days, and 0 otherwise - along with the Euler’s method prediction of the asteroid’s y poistion.

The Earth will be considered ‘hit’ if the asteroid gets within 0.01 million kilometers of Earth (so abs(earthy - asteroidy)<=0.1). The input for the function is h, which indicates the step size in days. So h = 0.5 indicates that there are two steps of Euler’s method per day, resulting in 215/0.5 = 530 steps of Euler’s method.

As with the previous exercises, the output for the fdash and onestep functions should be rounded to 5 decimal places.

Use your code from the previous exercises. The only thing you will need to change is fdash. We have written tests for each of your functions (fdash, onestep, eulers, will_it_hit), to help you understand where errors might be. Good luck!

Note: All units for the y location of the asteroid should be in millions of kilometers. For example, will_it_hit(5) should give output (0, 151.72445).

In: Computer Science

please do it in C++, will up vote!! please add snap shots of result and explanation....

please do it in C++, will up vote!! please add snap shots of result and explanation.

You are to create a recursive function to perform a linear search through an array.

How Program Works

Program has array size of 5000

Load values into the array, equal to its index value. Index 5 has value 5, index 123 has value 123.

Pass array, key, and size to the recursive function:

int recursiveLinearSearch(int array[],int key, const int size, bool & methodStatus)

User enters key to search for, recursive function calls itself until the key is found (methodStatus is true), print out the key and number of function calls when control is returned to the main

Handle situation of key not found (return number of function calls AND methodStatus of false) – print not found message and number of calls in the main

Function returns a count of how many recursive calls were made

Value returned is the number of calls made to that point, that is, when item is found the value returned is 1 with preceding functions adding 1 to the return value until the actual number of recursive function calls are counted).

Determine smallest key value that causes stack-overflow to occur, even if you need to make array larger than 5000.

Test cases need to include, biggest possible key value, “not found” message, and a stack overflow condition.

In: Computer Science

in java Write a class named “Stock” to model a stock. The properties and methods of...

in java

Write a class named “Stock” to model a stock. The properties and methods of the class are shown in figure below. The method “ percentage ” computes the percentage of the change of the current price vs the previous closing price. Write a program to test the “Stock” class. In the program, create a Stock object with the stock symbol SUND, name Sun Microsystem V, previous closing price of 100. Set a new current price randomly and display the price percentage.

Stock

private String symbol
private String name
private double previousClosingPrice

private double currentPrice
public Stock()
public Stock(String symbol, String name)

public String getSymbol()
public String getName()
public double getPreviousClosingPrice()
public double getCurrentPrice()
public void setSymbol(String symbol)
public void setName(String name)
public void setPreviousClosingPrice(double price)
public void setCurrentPrice(double price)
public double percentage()

In: Computer Science

Cryptography- Run S-DES with key: 1000100111 and plaintext: 01010101

Cryptography-

Run S-DES with key: 1000100111 and plaintext: 01010101

In: Computer Science

Discuss some major problems and issues that can cause (a) network design in general, and (b)...

Discuss some major problems and issues that can cause (a) network design in general, and (b) LAN design in particular, to fail.

In: Computer Science

Count all nonzero elements, odd numbers and even numbers in a linked list. Code needed in...

Count all nonzero elements, odd numbers and even numbers in a linked list.

Code needed in java through single linked list.

In: Computer Science

JAVA PROGRAM Overview : You will create a card deck program that allows the player to...

JAVA PROGRAM Overview :

You will create a card deck program that allows the player to shuffle a deck of cards and play a game that draws and plays cards until all cards in the deck have been used.

Instructions:

The application must be able to perform the following tasks :

1. At the start of a new game, it shuffles all cards using a deck shuffler

2. The player then draws X number of cards from the deck and 'plays' the cards by displaying them in the UI

3. The played cards are then added to a discard pile.

4. The player draws X new cards and repeats playing and discarding cards.

5. When there are no cards left in the deck, the game should ask the player of they want to play again.

-if the answer is yes, create a new deck with the discard pile and start again

-if the answer is no, end the game with a creative message to the player.

Requirements:

- The player must be able to continue to draw cards without errors.

- It should include different methods for drawing, shuffling and playing cards.

-It must include three arrays of a card, using a custom class that includes { Title: string, Description: String}

In: Computer Science

Type the Python code for all the questions. 1 2 Q1: Using DataFrame, with Figure 1...

Type the Python code for all the questions. 1 2 Q1: Using DataFrame, with Figure 1 data, store the hypermarket data for rows and columns. Display the output as shown in Figure 1. 0 ITEMS NAME DISCOUNT 1 Grocery Rice 56 2 Electronics Mobile 25% 3 Food Apple 30% Figure 1 Q2: Update and display the "Rice" discount from 5% to 10%. Your output should be like Figure 2 now. 1 2 0 ITEMS NAME DISCOUNT 1 Grocery Rice 108 2 Electronics Mobile 25% 3 Food Apple 30% Figure 2 NO Q3: Use Figure 3 data to add and display a new column. Your output should be like Figure 3 now. 0 1 2 3 ITEMS NAME DISCOUNT STOCK Grocery Rice 10% 100 Electronics Mobile 25% 3 Food Apple 30% W NO 20 40 Figure 3

In: Computer Science

- What is meant by term “inelastic traffic” on a network? - Explain the primary difference...

- What is meant by term “inelastic traffic” on a network?

- Explain the primary difference between network applications that use client-server architecture and applications that use peer-to-peer architecture.

- What is meant by the term “peer-churn” with respect to peer-to-peer application architectures?

- Describe in one sentence what is represented by a “port” number to the protocol operating in the transport layer in layered protocol architecture.

Please don't copy and paste from the internet. Thank you

In: Computer Science

ASAP PLEASE... USE PYTHON Design and implement in a language of your choice, i.e. a C++...

ASAP PLEASE... USE PYTHON

Design and implement in a language of your choice, i.e. a C++ , Java, or Python as you prefer, program that calculates the molecular weight of a formula. Your program should accept a formula in whatever form you choose as input from the user, and should display the molecular weight for that formula. Your program must be able to handle formulas that:

  • consist of a single element, e.g., He    (worth 40 points)
  • consist of a sequence of elements, e.g., H H O    (worth 20 points)
  • contain numeric constants, e.g., H2O    (worth 20 points)
  • contain nested formulas, e.g., (NH4)2SO4    (worth 20 points)

The representation of data and the algorithm you choose for your implementation are entirely up to you. The interface for your program should clearly describe the expected input form so the user can interact effectively. Grading emphasis for this assignment is on correctness only -- inefficiency and inelegance may be commented on but will not adversely affect your grade except in extreme cases.

The periodic table of elements can be found in many sources, incuding numerous Web pages (e.g., www.chemicalelements.com/show/mass.html). A list of elements with their atomic weights is written as raw text below:

    H    1.0080    He   4.0026    Li   6.9410    Be   9.0122    B   10.8100

    C   12.0110    N   14.0067    O   15.9994    F   18.9984    Ne  20.1790

    Na  22.9898    Mg  24.3050    Al  26.9815    Si  28.0860    P   30.9738

    S   32.0600    Cl  35.4530    Ar  39.9480    K   39.1020    Ca  40.0800

    Sc  44.9559    Ti  47.9000    V   50.9414    Cr  51.9960    Mn  54.9380

    Fe  55.8470    Co  58.9332    Ni  58.7100    Cu  63.5460    Zn  65.3700

    Ga  69.7200    Ge  72.5900    As  74.9216    Se  78.9600    Br  79.9040

    Kr  83.8000    Rb  85.4678    Sr  87.6200    Y   88.9059    Zr  91.2200

    Nb  92.9064    Mo  95.9400    Tc  98.9062    Ru 101.0700    Rh 102.9055

    Pd 106.4000    Ag 107.8680    Cd 112.4000    In 114.8200    Sn 118.6900

    Sb 121.7500    Te 127.6000    I  126.9045    Xe 131.3000    Cs 132.9055

    Ba 137.3400    La 138.9055    Ce 140.1200    Pr 140.9077    Nd 144.2400

    Pm 145.0000    Sm 150.4000    Eu 151.9600    Gd 157.2500    Tb 158.9254

    Dy 162.5000    Ho 164.9303    Er 167.2600    Tm 168.9342    Yb 173.0400

    Lu 174.9700    Hf 178.4900    Ta 180.9479    W  183.8500    Re 186.2000

    Os 190.2000    Ir 192.2200    Pt 195.0900    Au 196.9665    Hg 200.5900

    Tl 204.3700    Pb 207.2000    Bi 208.9806    Po 210.0000    At 210.0000

    Rn 222.0000    Fr 223.0000    Ra 226.0254    Ac 227.0000    Th 232.0381

    Pa 231.0359    U  238.02900   Np 237.0482    Pu 242.0000    Am 243.0000

    Cm 247.0000    Bk 249.0000    Cf 251.0000    Es 254.0000    Fm 253.0000

    Md 256.0000    No 256.0000    Lr 257.00

In: Computer Science

- What event will cause the sender to initiate fast retransmit when using TCP? - Describe...

- What event will cause the sender to initiate fast retransmit when using TCP?

- Describe briefly the relationship between the round trip time (RTT) observed between a sender and a receiver and the retransmit timer used in TCP.

- Describe briefly the basic difference in service provided by an email server using POP3 protocol compared to an email server using IMAP protocol.

Please don't copy and paste from the internet. Thank you

In: Computer Science

bandwidth- 5 MHz transmission power-100mW noise power -10mW 1) whats the signal to noise ratio (SNR)...

bandwidth- 5 MHz
transmission power-100mW
noise power -10mW

1) whats the signal to noise ratio (SNR)
2) if u send a file of 700 Mbits on this channel. what is the max data rate of this channel and how long will it take to transmit the file
3) if we need a max data rate of 30Mbps, how much is the required channel bandwidth?( both noise power and transmission power dont change)

In: Computer Science

“So much Fake News. Never been more voluminous or more inaccurate,” tweeted President Trump. A database...

“So much Fake News. Never been more voluminous or more inaccurate,” tweeted President Trump. A database of Trump remarks contains 320 references to fake news, named as term of the year in 2017. Leading news channels are not immune, for example in 2016 a story claiming HH Shaikh Mohammad Bin Zayed Al Nayhan had chanted a Hindu prayer went viral in India and was tweeted by main news channels. Fake news has been blamed for causing tension between countries, for example the Deputy Chairman of Dubai Police blamed Al Jazeera for deepening the crisis between Qatar and the UAE. Fake news has also resulted in tighter regulation of social media, and is now seen as a threat to democracy and free debate.

Historically, political interests have always misrepresented facts, but the identification, categorization and concept of fake news has become more complex and challenging. One team of students from Berkeley identified four classifications; clickbait, propaganda, commentary and humour and built a tool www.classify.news which scores the truth of information based on its URL. Their site claims 84% accuracy but the sample is based on only 5000 articles. IBM tested a prototype Question Answering Machine (QAM) called Watson to separate fact from fiction, and Google funded a fact checking operation called Full Fact to develop an automated fact-checking system. However, the successful implementation of fact checking models requires a constantly updated corpus of knowledge which is verified.

There are different data science architectures to check facts. The traditional NLP method of fake news detection is used by Thomson Reuters, a trusted global news source. Tracer News is a sensitive algorithmically driven system which filters news stories and social feeds for truth, and assigns a veracity score. It’s claimed to be 84% accurate, and with a sample of 5 tweets the system achieves 78% accuracy on distinguishing rumour and fact.

Research has shown that tweets containing false news spread faster and wider on Twitter than those with valid news. One estimate claims that in the month before the 2016 US election people read up to 3 articles of fake news. How this may possibly effect our attitudes is unknown, and psychologists have taken an interest in fake news. The Cognitive Reflection Test (CRT) was used to measure the ability to think analytically and consequently to predict people who can distinguish fake news from real news. Research has shown that if people agree with a message then they are more likely to believe it.

Social platforms such as Facebook are attempting to crack down on fake news in response to pressure. Facebook was accused of publishing fake posts using the name Lewis, who is a financial expert. Many people were thereby scammed to trust a financial product. Lewis pursued legal action to force social media to change their policy on advertising and be liable for hosting scams. Facebook are now playing an editorial role by changing the way News Feed functions. CEO Zuckerberg commented that sensationalism, misinformation and polarization are too common.

Countries such as Malaysia are making fake news punishable with up to 10 years in prison in an effort to protect national security. The law penalizes those who create, offer, circulate, print or publish fake news, which is defined as “any news, information, data and reports which is, or are, wholly or partly false whether in the form of features, visuals or audio recordings or in any other form capable of suggesting words or ideas”. Opponents call this an attack on freedom of speech and fear the new law could be used to penalize critical attacks on the government.

Human fact checkers are a rigorous and expensive way to combat fake news. A simple claim could take hours to verify and the manpower required could be considerable. If the responsibility lies with algorithms, false positives and negatives could lead to the suppression of a news story. In the UAE, the Youth Media Council is playing a role in the UAE’s strategy of developing the media sector and verifying credible from fake news. In a Dubai competition the winners research had explored a fake news incident whereby students’ names were spread on social media as soldiers who had died. Workshops to educate and teach young people skills to identify fake news were suggested.

Technology has enabled anyone to create news and for that news to go viral. The success of the message is not reliant on the truth of the contents, and there is too much information to validate. Many questions are raised about the effects of tagging news as fake, susceptibility to fake news, is fake news more real if its viral, and how to identify fake news. How can we create and sustain a global culture which promotes and values truth? What indeed is the truth of an event when multiple perspectives of the same event can hold truth.

  1. What is/are the problem/problems here? Is there an underlying fundamental problem?
  2. Who are the major stakeholders and what are their perspectives?
  3. What are the major ethical, legal, and security aspects associated with the problem.
  4. What are the intended and unintended consequences of existing computing solutions? Consider the consequences on individuals, organizations and society within local and global contexts
  5. What recommendations would you propose that will lead to potential solutions.

In: Computer Science