Questions
Implement a priority queue using a DoublyLinkedList where the node with the highest priority (key) is...

Implement a priority queue using a DoublyLinkedList where the node with the highest priority (key) is the right-most node.
The remove (de-queue) operation returns the node with the highest priority (key).
If displayForward() displays List (first-->last) : 10 30 40 55
remove() would return the node with key 55.
Demonstrate by inserting keys at random, displayForward(), call remove then displayForward() again.
You will then attach a modified DoublyLinkedList.java (to contain the new priorityInsert(long key) and priorityRemove() methods), and a driver to demonstrate as shown above.

Use the provided PQDoublyLinkedTest.java to test your code.

public class PQDoublyLinkedTest
{
    public static void main(String[] args)
    {                             // make a new list
        DoublyLinkedList theList = new DoublyLinkedList();

        theList.priorityInsert(22);      // insert at front
        theList.priorityInsert(44);
        theList.priorityInsert(66);

        theList.priorityInsert(11);       // insert at rear
        theList.priorityInsert(33);
        theList.priorityInsert(55);
        
        theList.priorityInsert(10);
        theList.priorityInsert(70);
        theList.priorityInsert(30);

        theList.displayForward();     // display list forward
        Link2 removed = theList.priorityRemove();
        System.out.print("priorityRemove() returned node with key: ");
        removed.displayLink2();
        
    }  // end main()
}  // end class PQDoublyLinkedTest

_____________________________________________________________________________________________________________________________________________________

// doublyLinked.java
// demonstrates doubly-linked list
// to run this program: C>java DoublyLinkedApp

class Link
{
public long dData; // data item
public Link next; // next link in list
public Link previous; // previous link in list

public Link(long d) // constructor
{ dData = d; }

public void displayLink() // display this link
{ System.out.print(dData + " "); }

} // end class Link

class DoublyLinkedList
{
private Link first; // ref to first item
private Link last; // ref to last item

public DoublyLinkedList() // constructor
{
first = null; // no items on list yet
last = null;
}

public boolean isEmpty() // true if no links
{ return first==null; }

public void insertFirst(long dd) // insert at front of list
{
Link newLink = new Link(dd); // make new link

if( isEmpty() ) // if empty list,
last = newLink; // newLink <-- last
else
first.previous = newLink; // newLink <-- old first
newLink.next = first; // newLink --> old first
first = newLink; // first --> newLink
}

public void insertLast(long dd) // insert at end of list
{
Link newLink = new Link(dd); // make new link
if( isEmpty() ) // if empty list,
first = newLink; // first --> newLink
else
{
last.next = newLink; // old last --> newLink
newLink.previous = last; // old last <-- newLink
}
last = newLink; // newLink <-- last
}

public Link deleteFirst() // delete first link
{ // (assumes non-empty list)
Link temp = first;
if(first.next == null) // if only one item
last = null; // null <-- last
else
first.next.previous = null; // null <-- old next
first = first.next; // first --> old next
return temp;
}

public Link deleteLast() // delete last link
{ // (assumes non-empty list)
Link temp = last;
if(first.next == null) // if only one item
first = null; // first --> null
else
last.previous.next = null; // old previous --> null
last = last.previous; // old previous <-- last
return temp;
}

// insert dd just after key
public boolean insertAfter(long key, long dd)
{ // (assumes non-empty list)
Link current = first; // start at beginning
while(current.dData != key) // until match is found,
{
current = current.next; // move to next link
if(current == null)
return false; // didn't find it
}
Link newLink = new Link(dd); // make new link

if(current==last) // if last link,
{
newLink.next = null; // newLink --> null
last = newLink; // newLink <-- last
}
else // not last link,
{
newLink.next = current.next; // newLink --> old next
// newLink <-- old next
current.next.previous = newLink;
}
newLink.previous = current; // old current <-- newLink
current.next = newLink; // old current --> newLink
return true; // found it, did insertion
}

public Link deleteKey(long key) // delete item w/ given key
{ // (assumes non-empty list)
Link current = first; // start at beginning
while(current.dData != key) // until match is found,
{
current = current.next; // move to next link
if(current == null)
return null; // didn't find it
}
if(current==first) // found it; first item?
first = current.next; // first --> old next
else // not first
// old previous --> old next
current.previous.next = current.next;

if(current==last) // last item?
last = current.previous; // old previous <-- last
else // not last
// old previous <-- old next
current.next.previous = current.previous;
return current; // return value
}

public void displayForward()
{
System.out.print("List (first-->last): ");
Link current = first; // start at beginning
while(current != null) // until end of list,
{
current.displayLink(); // display data
current = current.next; // move to next link
}
System.out.println("");
}

public void displayBackward()
{
System.out.print("List (last-->first): ");
Link current = last; // start at end
while(current != null) // until start of list,
{
current.displayLink(); // display data
current = current.previous; // move to previous link
}
System.out.println("");
}

} // end class DoublyLinkedList

class DoublyLinkedApp
{
public static void main(String[] args)
{ // make a new list
DoublyLinkedList theList = new DoublyLinkedList();

theList.insertFirst(22); // insert at front
theList.insertFirst(44);
theList.insertFirst(66);

theList.insertLast(11); // insert at rear
theList.insertLast(33);
theList.insertLast(55);

theList.displayForward(); // display list forward
theList.displayBackward(); // display list backward

theList.deleteFirst(); // delete first item
theList.deleteLast(); // delete last item
theList.deleteKey(11); // delete item with key 11

theList.displayForward(); // display list forward

theList.insertAfter(22, 77); // insert 77 after 22
theList.insertAfter(33, 88); // insert 88 after 33

theList.displayForward(); // display list forward
} // end main()
} // end class DoublyLinkedApp

____________________________________________________________________________________________________________________________________________________

In: Computer Science

3-The blood platelet counts of a group of women have a uniform distribution with a mean...

3-The blood platelet counts of a group of women have a uniform distribution with a mean of 362 and a standard deviation of 14.6. What is the approximate percentage of women with platelet counts within two standard deviations of the mean?

4-A department store, on average, has daily sales of $145.87. The standard deviation of sales is $14.04. On Tuesday, the store sold $184.41 worth of goods. Find Tuesday's z score.

6-Use the given sample data to find Q3.

50, 47, 69, 55, 52, 61, 44, 58

In: Statistics and Probability

write an appropriate null hypothesis for this analysis. what are the mean and standard deviation for...

write an appropriate null hypothesis for this analysis.
what are the mean and standard deviation for both groups?
what is the observed value of t?
what is the value of the degrees of freedom that are reported in the output?
a researcher is interested in determining if receiving tennis lessons affects the number of matches won during a 50 match season. in order to conduct the study, one group is randomly assigned to receive formal tennis lessons while the second group does not receive lessons. the number of matches won for each subject is listed below.
lessons: 38 48 32 26 34 24 26 22 32 35 40 26 39
no lessons: 29 30 19 22 30 29 28 34 23 21 29 17 24 36 43

In: Statistics and Probability

A company typically sells 100,000 units at $10 per unit. It runs a promotion that discounts each unit by $4 per unit.


Test Your Understanding: : A company typically sells 100,000 units at $10 per unit. It runs a promotion that discounts each unit by $4 per unit. To promote the discount, the company pays a flat fee of $25,000. The company sells 75,000 additional units in incremental sales. The company tells its marketing team to kill any promotion that has<10% MROI.

    1. Should the company proceed with this promotion and discount?

    2. Why or why not?

In: Finance

When analyzing recursive algorithms, which of the following best describes initial conditions? a) Initial conditions express...

When analyzing recursive algorithms, which of the following best describes initial conditions?

a) Initial conditions express the number of times the basic operation executes when the base case is reached.
b) Initial conditions represent the condition for the base case of a recursive function
c) Initial conditions express the number of times the basic operation runs during the first execution of the function.
d) Initial conditions express the complexity of an algorithm

In: Computer Science

Traffic on Rosedale Road in Princeton, NJ, follows a Poisson process with rate 6 cars per...

Traffic on Rosedale Road in Princeton, NJ, follows a Poisson process with rate 6 cars per minute. A deer runs out of the woods and tries to cross the road. It takes the deer a random time (independent of everything else), uniformly distributed between 2 and 5 seconds, to cross the road. If there is a car passing while the deer is on the road, it will hit the deer with portability 2/3 (independent of everything else). Find the probability of a collision.

In: Statistics and Probability

A rocket sits initially at rest on the surface of the earth, until it begins burning...

A rocket sits initially at rest on the surface of the earth, until it begins burning its engines. While burning its engines, it accelerates upward at 30.0 m/s2 for 30.0 s. It then runs out of fuel and continues ascending to its maximum height in free fall. Ignoring air resistance, (i) what is the rocket’s maximum altitude, and (ii) how much time passes from liftoff to reaching its maximum altitude?

In: Physics

A 25kg block is placed 2.7m above the ground on a frictionless ramp. At the bottom...

A 25kg block is placed 2.7m above the ground on a frictionless ramp. At the bottom of a ramp there is an ideal spring.

A. If the block is let go, how fast will the block be moving at the bottom of the ramp?

B. The block runs into the spring and compresses the spring a total of .35m before coming to a stop. What is the spring constant of the spring?

The block then slides back up the ramp. How high (above the ground) does the block get before coming to a stop?

In: Physics

Suppose the airline industry consisted of only two​ firms: American and Texas Air Corp. Let the...

Suppose the airline industry consisted of only two​ firms: American and Texas Air Corp. Let the two firms have identical cost​ functions,

​C(q)=40q.

Assume that the demand curve for the industry is given by

P=130−Q

and that each firm expects the other to behave as a Cournot competitor.

Calculate the​ Cournot-Nash equilibrium for each​ firm, assuming that each chooses the output level that maximizes its profits when taking its​ rival's output as given. What are the profits of each​ firm? ​(For all of the​ following, enter a numeric response rounded to two decimal​ places.)

When​ competing, each firm will produce?units of output.

In​ turn, each firm will earn profit of $?.

What would be the equilibrium quantity if Texas Air had constant marginal and average costs of $25 and American had constant marginal and average costs of

​$40​?

If Texas Air had constant marginal and average costs of $25 and American had constant marginal and average costs of $40​,

American would produce ?units and Texas Air Corp. would produce ?units.

In​ turn, American's will earn profit of $? and Texas Air Corp. will earn profit of $?.

In: Economics

A researcher is interested in whether the phonics method of teaching reading is more or less...

A researcher is interested in whether the phonics method of teaching reading is more or less effective than the sight method, depending on what grade the child is in. Twenty children were randomly selected from each of three grades: kindergarten (K), first grade (1), and second grade. Achievement was measured in terms of reading comprehension where higher scores indicate better comprehension. Within each grade, 10 children were assigned to each of two methods of teaching reading - phonics or sight. The data are as follows:

                        Grade Levels

                        K         1          2                                              K         1                2

                        14        25        49                                            17        35            34

                        20        29        49                                            22        36            33

                        16        27        46                                            19        40            34

Sight    21        31        46                   Phonics           20        34            39

                        20        27        44                                            26        37            38

                        14        34        43                                            18        41            33

                        21        32        50                                            26        42            35

                        23        34        43                                            18        33            42

                        14        35        48                                            25        34            42

                        15        28        52                                            23        43            38

  1. State the Null hypotheses for each main effect and interaction – 5 points
  2. Present the means and SD for each level of each factor– 5 points.
  3. Test the null hypothesis for both main effects and interactions and present the ANOVA source table with all relevant statistics– 15 points.

Tests of Between-Subjects ANOVA source Table

Dependent Variable: RC

Source

Type III Sum of Squares

df

Mean Square

F

Sig.

Partial Eta Squared

method

grade

method * grade

Error

Total

Corrected Total

a. R Squared = (Adjusted R Squared = . Sig = 0 means p is < .001. SPSS takes out the probability value to 8 decimals. So, reporting Sig as .000 means the probability (p) is less than or below the .001 level.

  1. Specify all variables– 5 points.
  2. Compute, report and explain results from the HSD post hoc follow-up test– 10 points..
  3. Present a graph of the interaction of the two factors– 5 points.
  4. Write a statement as to your conclusions– 5 points..

Note. This is a Two-Way ANOVA (i.e., 2 IVs). One IV has two levels and one IV has three levels. Thus, a 2 X 3 ANOVA that will produce 6 cell means, 2 row means and 3 column means.

In: Statistics and Probability