Write a C program to take two integer arrays in ascending order and combine them in a new array in descending order. Remove any duplicates in the final array, if any. Your code must store the arrays as a linked list of objects, each put in a “struct.” All operations should also be carried out using linked lists.
Input: 2 sorted arrays, each on a new line.
Output: An array sorted in descending order, without duplicates.
There is a single white space after each number, even after the last number. There is no new line at the end. Use the following struct as a reference:
struct ELEMENT {
int value;
struct ELEMENT *next;
};
=== Sample test case 1 ===
Input:
2 15 18 34 67 87 88
3 8 18 33 67 89 91
Output:
91 89 88 87 67 34 33 18 15 8 3 2
=== Sample test case 2 ===
Input:
28 36 57 59 68 69 420
17 37 57 59 68
Output:
420 69 68 59 57 37 36 28 17
In: Computer Science
1.Read the Lab6-Background.pdf first.2.Start the “Stack Queue”
applet.3.The purpose of this exercise is to see how you could
reverse a list of names. Push the three names “Alice,” “Bob,” and
“Charles” onto the stack. When you pop the stack 3 times, what do
you see in the text field next to “Pop”?4.Write an algorithm in
pseudo-codethat would describe how to use a stack to reversea
sequence (list)of letters and print them. For instance, if the
original sequence is COMPUTERthe output will be RETUPMOC. Review
pages 249-250 of the textbook(Chapter8)to see the related sample
pseudo-codes.5.A palindrome word is one that has the same sequence
of letters if you read it from right to left or left to right(e.g.,
radar or madam). Describe (in terms of a pseudo-code) how you could
use a stack in conjunction with the original listto determine if a
sequence is a palindrome.Hint:Given that the letters have been
already assigned to both stackand the queueand these two data
structures are ready to be processed (compared).
In: Computer Science
A spaceship leaves the earth, starting from rest and
accelerating at a constance rate of 10m/s^2. its destination is the
Moon, 380,000 km from earth. ignore size of earth and moon. Assume
that both are at rest.
a.) At this rate of acceleration how long will it take the spacecraft to reach the moon?
for part b assume the spaceship accelerates to a halfway point
(same acceleration as a)and then begins to deccelerate to have a
final velocity of 0 when it reaches the moon.
b.) With the new method how long will it take for the spaceship to reach the moon?
the spaceship is carrying a probe which it can launch ouot of the front end of the spacecraft with a speed of 5000 m/s with respect to the spaceship.
c.) Assume the spaceship is traveling the same way as part b, at what distance from the moon should the probe be launched so that it will reach the moon at the same time as the saceship?
suppose the spaceship also has a probe that it can launch in the backward direction at the same speed of 5000 m/s with respect to the ship.
d.) In this case what distance from the moon should the probe be launched so that it will reach the moon at the same time as the ship?
Need to know how to do this type of work for my exam. An
explained answer so i can follow along is greatly appreciated thank
you in advance.
In: Physics
Calculate the effective interest rate for the following nominal interest rates:
a. Interest rate of 11% per year, compounded annually
b. Interest rate of 11% per year, compounded semi-annually
c. Interest rate of 11% per year, compounded quarterly
d. Interest rate of 11% per year, compounded daily e. Interest rate of 11% per year, compounded continuously
In: Economics
In: Computer Science
Matthias Corp. had the following foreign currency transactions during 2017: Purchased merchandise from a foreign supplier on January 20 for the U.S. dollar equivalent of $59,300 and paid the invoice on April 20 at the U.S. dollar equivalent of $51,200. On September 1, borrowed the U.S. dollar equivalent of $308,000 evidenced by a note that is payable in the lender's local currency in one year. On December 31, the U.S. dollar equivalent of the principal amount was $321,000. In Matthias's 2017 income statement, what amount should be included as a net foreign exchange gain or loss?
In: Accounting
What is the pH change when adding 0.15 moles of HCl to a 1 L buffer containing 1.0 M acetic acid and 1 M sodium acetate?
A`) decreased by 0.13 units
B) increse by 0.13 Units
C) increase by 0.15 units
D) decrese by 0.15 Units
E) no change
In: Chemistry
UPDATE: Whole Code
How do I fix this Bold part "!= Null" ? its showing me Error? please Help
#include<iostream>
#include<string>
#include<string.h>
#include<fstream>
#include<stdlib.h>
#include<sstream>
using namespace std;
int main(){
string list[1000];
cout << "! Opening data file... ./Data.CS.SFSU.txt\n";
ifstream fin("Data.CS.SFSU.txt");
if(fin.fail()){
cout << "Error opening file\n";
return 0;
}
cout << "! Loading data...\n";
int count = 0;
while(getline(fin,list[count])!=NULL){
//cout << "--------------------\n";
count++;
}
cout << "! Loading completed...\n";
fin.close();
cout << "! Closing data file... ./Data.CS.SFSU1.txt\n";
cout << "-----DICTIONARY 340 C++-----\n";
while(true){
cout << "Search:";
string line;
getline(cin,line);
cout << "|" << endl;
stringstream ss(line);
string word1, word2, word3;
ss >> word1 >> word2;
if (ss >> word3 || (word2 != "noun" && word2 !=
"adjective" && word2 != "verb")){
cout << "Please enter a search key (and a part of
speech)\n";
}
else {
for (int i = 0; i<word1.length(); i++){
word1[i] = tolower(word1[i]);
}
int found = 0;
cout << count << endl;
for (int i = 0; i< count; i++){
char line2[200];
strcpy(line2, list[i].c_str());
char *ch = strtok(line2,"|");
//cout << ch << endl;
while (ch != NULL){
//cout << ch << endl;
//cout << ch1 << " " << endl;
if (strcmp(ch,(char *)word1.c_str()) == 0){
ch = strtok(NULL,"|");
char line[100];
strcpy(line, ch);
char *ch1 = strtok(line," ");
//cout << line << endl;
if (strcmp(ch1,word2.c_str()) == 0){
ch1 = strtok(NULL," ");
ch1 = strtok(NULL," ");
string s ="";
while (ch1 != NULL){
s = s + ch1 + " ";
ch1 = strtok(NULL," ");
}
cout << word1 << "[" << word2 << "] :"
<< s << endl;
found = 1;
break;
}
}
ch = strtok(NULL,"|");
}
if (found == 1)
break;
}
if (found == 0)
cout << "Not found\n";
}
cout << "|" << endl;
}
return 0;
}
In: Computer Science
What is competition like in the printer/copier hardware
industry? What is the competitive strength of buyers and suppliers?
How strong are the threats of substitute products and new entrants
to the industry? How strong is rivalry among competing firms?
Explain.
Select “true” for those statements that are accurate and choose
“false” for those that are not.
In: Operations Management
| Discuss how the following affect Assets, Income, Liabilities, Common Stock and Retained Earnings on the end of 2019 financial statements (Increase by $x, Decreases by $x, or No Effect): |
| 1. In June 2019, $1000 of gift cards were sold. At the end of the year 2019, $200 has not been redeemed. |
| 2. On November 1st 2019, John paid $300 for a 12 month insurance policy, with it beginning on the same day, and he showed all of it as an expense. |
| 3. The water bill for November 2019 was $100 |
| 4. On December 1st 2019, a consulting contract was signed for work in 2020, with the work starting in January 2020, and gets paid $10000 March 1st 2020. |
| 5. A company pays employees on the first day of the month. This is for working the previous month. December 2019's salaries will be paid on Jan. 1st 2020 is $1200 |
In: Accounting
In: Computer Science
1.
Which of the following describes the element
Cs.
Choose all that apply.
a.consists of diatomic molecules in elemental form
b.is found in nature only combined with other elements
c.reacts vigorously with alkali metals to form salts
d. is very reactive as a metal
e.forms a basic solution in water
f. is one of the group of the least reactive elements
2. Using only the periodic table arrange the
following elements in order of increasing atomic
radius:
boron, fluorine, oxygen, lithium
| Smallest____ | |
| ______ | |
| ______ | |
| Largest_____ |
3. Using only the periodic table arrange the
following elements in order of increasing atomic
radius:
nitrogen, antimony, arsenic, bismuth
| Smallest_____ | |
| ________ | |
| ________ | |
| Largest_____ |
| Please answer this question
according to the general rules you have learned regarding periodic
trends. DO NOT base your answer on tabulated values since exceptions may occur. |
| Please answer this question
according to the general rules you have learned regarding periodic
trends. DO NOT base your answer on tabulated values since exceptions may occur. |
In: Chemistry
Write a response post in your own words .
In light of the COVID-19 outbreak, I have chosen to focus on a Meaning-Focused Coping approach. I have used this approach to focus on the learning that comes along with the pandemic, discovering why and how it happened, why it has affected so many and how it has spread, what is and could be done to combat it and I am also applying my current knowledge in public health to try to see all sides of it. I have also used this time to realize what is really important in my life and have been able to do some self-growth as well which will help me come out stronger on the other side.
To me, resilience is based off of first and foremost the actions of one's self. The decisions that a person makes to deal with a situation make or break their resilience in the future. I have chosen to provide resilience for myself during this time by focusing on staying calm, following the realistic and scientific information without drawing false conclusions, making a new plan for how I will finish the semester strong online remembering to practice self-care while at home.
One specific action that I am taking to prevent the spread of COVID-19 in my community is that I am taking the 14 day home quarantine seriously, since I traveled outside of Alaska for the first week of Spring Break, I have stayed at home and have not come in contact with anyone else. This is very important to be able to flatten the curve of people being infected everyday.
In: Psychology
A 1.458-g sample of a solid, weak, monoprotic acid is used to make 100.0 mL of solution. 40.0 mL of this solution was titrated with 0.07942-M NaOH. The pH after the addition of 16.55 mL of base was 2.94, and the equivalence point was reached with the addition of 46.63 mL of base.
a) How many millimoles of acid are in the original solid sample? Hint: Don't forget the dilution.
b) What is the molar mass of the acid?
c) What is the pKa of the acid?
In: Chemistry
"Discuss whether free market is necessarily efficient.
Give some examples to illustrate the
limitations of government interventions in restoring the market
efficiency. Some economists advocate market-based solutions,
discuss its merits over command-and-control policies."
Please give 3~4 practical examples with your own word and apply
micro-economic theories and concepts to these examples.
In: Economics