Ex1) Download the code from the theory section, you will find zipped file contains the code of Singly linked list and Doubly linked list, in addition to a class Student.
In Class SignlyLinkedList,
1. There is a method display, what does this method do?
2. In class Test, and in main method, create a singly linked list objet, test the methods of the list.
3. To class Singly linked list, add the following methods:
a- Method get(int n), it returns the elements in the node number n, assume the first node number is 1. You need to check that n is within the range of nodes in the list, otherwise method get returns null.
What is the complexity of your method? Test the method in main.
b- Method insertAfter(int n, E e), its return type is void, it inserts element e in a new node after the node number n, assume the first node number is 1. You need to check that n is within the range of nodes in the list, otherwise through an exception.
What is the complexity of your method?
Test the method in main.
c- Method remove(int n): it removes the node number n, and returns the element in that node, assuming the first node number is 1. You need to check that n is within the range of nodes in the list, otherwise method get returns null.
What is the complexity of your method?
Test the method in main.
d- Method reverse( ): it has void return type. It reverse the order of the elements in the singlylinked list.
What is the complexity of your method?
Test the method in main.
Ex2) In Class DoublyLinkedList
1. There are two methods printForward, printBackward, what do they do?
2. In class Test, and in main method, create a doubly linked list objet, test the methods of the list.
4. To class Doubly linked list, add the following methods:
e- Method get(int n), it returns the elements in the node number n, assume the first node number is 1. You need to check that n is within the range of nodes in the list, otherwise method get returns null.
To make your code more efficient, you should start from the end (header or trailer) that is closer to the target node.
What is the complexity of your method?
Test the method in main.
f- Method insertAfter(int n, E e), its return type is void, it inserts element e in a new node after the node number n, assume the first node number is 1. You need to check that n is within the range of nodes in the list, otherwise through an exception. . To make your code more efficient, you should start from the end (header or trailer) that is closer to the target node.
What is the complexity of your method?
Test the method in main.
g- Method remove(int n): it removes the node number n, and returns the element in that node, assuming the first node number is 1. You need to check that n is within the range of nodes in the list, otherwise method get returns null. To make your code more efficient, you should start from the end (header or trailer) that is closer to the target node.
What is the complexity of your method?
Test the method in main.
Assignment:
To class DoublyLinedList, add method remove(E e) which removes all nodes that has data e. This method has void return type.
doublylinkedlist class:
package doubly;
public class DoublyLinkedList <E>{
private Node<E> header;
private Node<E> 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().getData();
}
public E last()
{
if (isEmpty()) return null;
return
trailer.getPrev().getData();
}
private void addBetween(E e, Node<E>
predecessor, Node<E> successor)
{
Node<E> newest=new
Node<>(e,predecessor,successor);
predecessor.setNext(newest);
successor.setPrev(newest);
size++;
}
private E remove(Node<E> node)
{
Node<E>
predecessor=node.getPrev();
Node<E>
successor=node.getNext();
predecessor.setNext(successor);
successor.setPrev(predecessor);
size--;
return node.getData();
}
public void addFirst(E e){
addBetween(e,header,header.getNext());
}
public void addLast(E e){
addBetween(e,trailer.getPrev(),trailer);
}
public E removeFirst(){
if(isEmpty()) return null;
return
remove(header.getNext());
}
public E removeLast()
{
if(isEmpty()) return null;
return remove(trailer.getPrev());
}
public void printForward()
{
for (Node<E>
tmp=header.getNext();tmp!=trailer;tmp=tmp.getNext())
System.out.println(tmp.getData());
}
public void printBackward()
{
for (Node<E>
tmp=trailer.getPrev();tmp!=header;tmp=tmp.getPrev())
System.out.println(tmp.getData());
}
}
node class:
package doubly;
public class Node <E>{
private E data;
private Node<E> prev;
private Node<E> next;
public Node(E d, Node<E> p,Node<E>
n)
{
data=d;
prev=p;
next=n;
}
public E getData() { return data; }
public Node<E> getNext(){ return next; }
public Node<E> getPrev(){ return prev; }
public void setNext(Node<E> n) { next=n;}
public void setPrev(Node<E> p) { prev=p;}
}
student class:
package doubly;
public class Student {
private int id;
private String name;
public Student(int id, String name) {
super();
this.id = id;
this.name = name;
}
public int getId() {
return id;
}
public void setId(int id) {
this.id = id;
}
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
@Override
public String toString() {
return "[id=" + id + ", name=" + name + "]";
}
}
test class:
package doubly;
public class Test {
public static void main(String arg[])
{
DoublyLinkedList<Student> myList=new
DoublyLinkedList<>();
myList.addFirst(new Student(1,"Ahmed"));
myList.addFirst(new Student(2,"Khaled"));
myList.addLast(new Student(3,"Ali"));
myList.removeLast();
myList.printForward();
}
}
In: Computer Science
1.(a) What is a chain reaction?
(b) Why is monobromination of ethane a more practical reaction than the monobromination of propane?
(c) Write the mechanism involved in the chain reaction of monbromination of propane. State the experimental conditions, major and minor products.
Name each of the steps. Explain your answer.
(d) Draw the bond-line formula of 3,4-dimethylhexane.
Is geometric isomerism observed in 3,4-dimethylhexane?
What structural features must be present for stereoisomers to
exist?
thanks
In: Chemistry
In pseudo-code, design an algorithm for finding baking a cake.
In: Computer Science
Joe has common stock and preferred stock outstanding. The preferred stock has a par value of $100, a dividend rate of 4.5%, and is cumulative. During the past 3 years, Joe declared and paid dividends provided at left. Compute the amount of dividends paid to preferred and common shareholders each year.
Preferred stock: | |
Par value | $100 |
Dividend rate | 4.5% |
Shares outstanding | 100,000 |
Dividends declared and paid: | |
Year 1 | 400,000 |
Year 2 | 100,000 |
Year 3 | 1,250,000 |
In: Accounting
The Problem
Facebook has long conducted digital experiments on various aspects of its website. For example, just before the 2012 election, the company conducted an experiment on the News Feeds of nearly 2 million users so that they would see more “hard news” shared by their friends. In the experiment, news articles that Facebook users' friends had posted appeared higher in their News feeds. Facebook claimed that the news stories being shared were general in nature and not political. The stories originated from a list of 100 top media outlets from the New York Times to Fox News. Industry analysts claim that the change may have boosted voter turnout by as much as 3 percent.
Next, Facebook decided to conduct a different kind of experiment that analyzed human emotions. The social network has observed that people's friends often produce more News Feed content than they can read. As a result, Facebook filters that content with algorithms to show users the most relevant and engaging content. For one week in 2012, Facebook changed the algorithms it uses to determine which status updates appeared in the News Feed of 689,000 randomly selected users (about 1 of every 2,500 Facebook users). In this experiment, the algorithm filtered content based on its emotional content. Specifically, it identified a post as “positive” or “negative” if it used at least one word previously identified by Facebook as positive or negative. In essence, Facebook altered the regular news feeds of those users, showing one set of users happy, positive posts while displaying dreary, negative posts to another set.
Previous studies had found that the largely positive content that Facebook tends to feature has made users feel bitter and resentful. The rationale for this finding is that users become jealous over the success of other people, and they feel they are not “keeping up.” Those studies, therefore, predicted that reducing the positive content in users' feeds might actually make users less unhappy. Clearly, Facebook would want to determine what types of feeds will make users spend more time on its site rather than leave the site in disgust or despair. Consequently, Facebook designed its experiment to investigate the theory that seeing friends' positive content makes users sad.
The researchers—one from Facebook and two from academia—conducted two experiments, with a total of four groups of users. In the first experiment, they reduced the positive content of News Feeds; in the second experiment, they reduced the negative content. In both experiments, these treatment conditions were compared with control groups in which News Feeds were randomly filtered without regard to positive or negative content.
The results were interesting. When users received more positive content in their News Feed, a slightly larger percentage of words in their status updates were positive, and a smaller percentage were negative. When positivity was reduced, the opposite pattern occurred. The researchers concluded that the emotions expressed by friends, through online social networks, elicited similar emotions from users. Interestingly, the results of this experiment did not support the hypothesis that seeing friends' positive content made users sad.
Significantly, Facebook had not explicitly informed the participants that they were being studied. In fact, few users were aware of this fact until the study was published in a paper titled “Experimental evidence of massive-scale emotional contagion through social networks” in the prominent scientific journal Proceedings of the National Academy of Sciences. At that point, many people became upset that Facebook had secretly performed a digital experiment on its users. The only warning that Facebook had issued was buried in the social network's one-click user agreement. Facebook's Data Use Policy states that Facebook “may use the information we receive about you . . . for internal operations, including troubleshooting, data analysis, testing, research, and service improvement.” This policy led to charges that the experiment violated laws designed to protect human research subjects.
Some lawyers urged legal action against Facebook over its experiment. While acknowledging the potential benefits of digital research, they asserted that online research such as the Facebook experiment should be held to some of the same standards required of government-sponsored clinical trials. What makes the Facebook experiment unethical, in their opinion, was that the company did not explicitly seek subjects' approval at the time of the study.
Some industry analysts challenged this contention, arguing that clinical research requirements should not be imposed on Facebook. They placed Facebook's experiment in the context of manipulative advertising—on the web and elsewhere—and news outlets that select stories and write headlines in a way that is designed to exploit emotional responses by their readers.
On July 3, 2014, the privacy group Electronic Privacy Information Center filed a formal complaint with the Federal Trade Commission claiming that Facebook had broken the law when it conducted the experiment without the participants' knowledge or consent. EPIC alleged that Facebook had deceived its users by secretly conducting a psychological experiment on their emotions.
Facebook's Response
Facebook Chief Operating Officer Sheryl Sandberg defended the experiment on the grounds that it was a part of ongoing research that companies perform to test different products. She conceded, however, that the experiment had been poorly communicated, and she formally apologized. The lead author of the Facebook experiment also stated, “I can understand why some people have concerns about it (the study), and my co-authors and I are very sorry for the way the (academic) paper described the research and any anxiety it caused.”
For its part, Facebook conceded that the experiment should have been “done differently,” and it announced a new set of guidelines for how the social network will approach future research studies. Specifically, research that relates to content that “may be considered deeply personal” will go through an enhanced review process before it can begin.
The Results
At Facebook, the experiments continue. In May 2015, the social network launched an experiment called Instant Articles in partnership with nine major international newspapers. This new feature allowed Facebook to host articles from various news publications directly on its platform, an option that the social network claims will generate a richer multimedia experience and faster page-loading times.
The following month Facebook began experimenting with its Trending sidebar, which groups news and hashtags into five categories among which users can toggle: all news, politics, science and technology, sports, and entertainment. Facebook maintained that the objective is to help users discover which topics they may be interested in. This experiment could be part of Facebook's new effort to become a one-stop news distributor, an approach that would encourage users to remain on the site for as long as possible.
A 2016 report asserts that Facebook's list of top trending topics is not quite objective. For example, one source stated that Facebook's news curators routinely excluded trending stories from conservative media sites from the trending section. Facebook strongly denied the claim.
Questions
In: Operations Management
In: Operations Management
You have decided that the Fit Stop would be well suited to Organizational Performance Pay. Select the specific organizational performance pay plan that would seem to work best; then design it, describing specifically how you would deal with various design issues. When you are done, the plan should be ready for implementation.
In: Operations Management
The Holtz Corporation acquired 80 percent of the 100,000 outstanding voting shares of Devine, Inc., for $7.50 per share on January 1, 2017. The remaining 20 percent of Devine’s shares also traded actively at $7.50 per share before and after Holtz’s acquisition. An appraisal made on that date determined that all book values appropriately reflected the fair values of Devine’s underlying accounts except that a building with a 5-year future life was undervalued by $46,500 and a fully amortized trademark with an estimated 10-year remaining life had a $76,000 fair value. At the acquisition date, Devine reported common stock of $100,000 and a retained earnings balance of $351,500.
Following are the separate financial statements for the year ending December 31, 2018:
Holtz Corporation |
Devine, Inc. |
||||||
Sales | $ | (786,000 | ) | $ | (379,000 | ) | |
Cost of goods sold | 291,000 | 118,000 | |||||
Operating expenses | 289,000 | 78,000 | |||||
Dividend income | (16,000 | ) | 0 | ||||
Net income | $ | (222,000 | ) | $ | (183,000 | ) | |
Retained earnings, 1/1/18 | $ | (733,000 | ) | $ | (421,500 | ) | |
Net income (above) | (222,000 | ) | (183,000 | ) | |||
Dividends declared | 90,000 | 20,000 | |||||
Retained earnings, 12/31/18 | $ | (865,000 | ) | $ | (584,500 | ) | |
Current assets | $ | 311,500 | $ | 272,500 | |||
Investment in Devine, Inc | 600,000 | 0 | |||||
Buildings and equipment (net) | 722,500 | 456,000 | |||||
Trademarks | 156,000 | 212,000 | |||||
Total assets | $ | 1,790,000 | $ | 940,500 | |||
Liabilities | $ | (605,000 | ) | $ | (256,000 | ) | |
Common stock | (320,000 | ) | (100,000 | ) | |||
Retained earnings, 12/31/18 (above) | (865,000 | ) | (584,500 | ) | |||
Total liabilities and equities | $ | (1,790,000 | ) | $ | (940,500 | ) | |
At year-end, there were no intra-entity receivables or payables.
Prepare a worksheet to consolidate these two companies as of December 31, 2018.
Prepare a 2018 consolidated income statement for Holtz and Devine.
If instead the noncontrolling interest shares of Devine had traded for $5.74 surrounding Holtz’s acquisition date, what is the impact on goodwill?
In: Accounting
What is contract termination? Under what circumstances can a contract be terminated? What are contract amendments? How can a contract be amended?
Please no hand-written answers.
In: Operations Management
Microeconomics
How does monopolistic competition differ from perfect competition? “
As monopolistic competition leads to excess capacity, there will be an unambiguous social gain if government regulation reduces the number of firms and eliminates excess capacity.”
What is meant by excess capacity? Demonstrate (on a graph) that monopolistic competition leads to excess capacity.
Do you agree or disagree with the statement’s policy recommendation? Why? Explain?
In: Economics
What is the present value of a cash flow stream of $1,000 per year annually for 15 years that then grows at 2.0 percent per year forever when the discount rate is 8 percent? (Round intermediate calculations and final answer to 2 decimal places.)
In: Finance
Import a data set (txt file) then do the sorting algorithm using bubble sort, radix sort, insertion sort, and merge sort,
It must show how long it took and how many movements occurred.
Please write codes in C++
Here's data set (should be stored in txt file)
7426
4524
4737
9436
3997
2757
6288
5414
9590
5968
6638
3199
9514
1541
9866
2144
6731
911
2171
6135
6437
912
9417
2662
6606
6349
707
2890
5386
9718
3492
5068
9674
8578
8323
7789
4748
7576
2664
6352
7967
8556
4740
5737
6764
368
1070
3700
1291
5279
9429
9507
2575
3099
2147
9660
2515
2976
4086
8305
6913
1308
7123
7678
8971
7507
139
51
5980
1100
3976
7289
9249
1662
8659
2758
3605
1079
7829
2298
3671
8901
1176
9089
3350
7500
6702
8903
5279
In: Computer Science
consider the following two mutually exclusive projects
what is the cross over rate for these two projects
year | cash flow x | cash flow y |
0 | -19700 | -19700 |
1 | 8775 | 9950 |
2 | 8950 | 7725 |
3 | 8725 | 8625 |
In: Finance
1.convert the following numbers from decimal to binary assuming seven-bit twe's complement binary representation:
a)49 b) -27 c)0 d) -64 e) -1 f) -2
g) what is the range for this computer as written in binary and in decimal?
2.convert the following numbers from decimal to binary assuming nine-bit twe's complement binary representation:
a)51 b) -29 c) -2 d)0 e) -256 f) -1
g ) what is the range for this computer as written in binary and in decimal?
In: Computer Science
Read the scenario and then answer the following questions. GOOD answers will justify and support themselves with material from this week's reading and panoptos. Use the vocabulary of the units!
Mrs. Mordeno came to Honolulu to visit her sonn, Jose, who operated an art gallery. He married to one of his clients, Beth, who paints in her own studio near his gallery. Mrs. Mordeno’s trip was the first out of the Philippines for her and she wanted to see all of the scenic spots in the islands. Jose and Beth were expected to accompany her at the expense of their own work schedules. Mrs. Mordeno planned to stayonly a week but enjoyed herself so much that she decided to stay another month. She wanted to invite her sister and her sister’s children to stay with her. Jose’s apartment was small and did not have enough room for all of them and Jose was expected to pay the travel expenses for all. He tried to explain the situation to his mother. She seemed to accept his tactfully presented arguments and appeared to be satisfied for a few days. Then one day she packed up and returned home.
1. In your estimation, why did Mrs. Mordeno leave? (all you have to do here is make an X next to your answer.
______Mrs. M had other plans and just changed her mind
______ Jose’s inhospitality hurt her and she considered him disrespectful
______ She felt guilty for imposing
______Unable to deal with the pressures of Hawaii, she decided to leave
2. What do you think Mrs. Mordeno's expectations were as a product of collectivist world view? Why? (how did cultural world view factor into her expectations?) (This is one of the 'money' questions for this assignment--I am expecting you to dazzle me here with your ability to apply concepts from unit I (worldview) and III (what has been discussed in regards to family) to support your answer.
3. How do you think Jose viewed her expectations, as someone who is more comfortable with individualist world view?
4. How do you view Mrs. Mordeno’s expectations? Are they different or similar to your expectations when a visitor comes to your home? Are they different or similar to your expectations when you go visiting?
5. What examples of indirect communication do you see in this example?
In: Psychology