Explanation:
:*):*):*)*)*:)*:)*:*)*:**:*)*:)*:)*:*):*)*P:)*:*):*)
:*
):*
)*:
)*:*
):*):*)*:*):*)*:*):*):*):)*:*):*):*):*)
:*):*)
Data Structure in C++
Using namespace std;
In this assignment you will implement a variation of Mergesort known as a bitonic mergesort, recursively.
In a normal mergesort, the input to the merge step is a single array, which is divided into two sections, both sorted ascending. We assume that the first half (0 up to but not including size/2) is the first section and the second half (size/2 up to but not including size) is the second section.
In a bitonic mergesort, we use the same arrangement, except that the second sequence is sorted in descending order: the first half goes up, and then the second half goes down. This means that when we are doing a merge, sometimes we want to merge the results into ascending order, while other times we want to merge into descending order (depending on which "half" of the final array the result will end up in). So we add another parameter, to describe the direction the output should be sorted into:
void merge(int* input, int size, int* output, bool output_asc);
If output_asc == true then after the merge output should contain size elements, sorted in ascending order. If output_asc == false, output should contain the elements sorted in descending order.
The other thing we glossed over in class was the allocation of the temporary space needed by the algorithm. It’s quite wasteful to allocate it in each recursive call: it would be better to allocate all the necessary space up front, and then just pass a pointer to it. In order to do this, we’ll write the recursive mergesort function in a helper function which will preallocate the space needed for the results:
int* mergesort(int* input, int size) {
int* output = new int[size];
mergesort(input, size, output, true);
return output;
}
void mergesort(int *input, int size, int* output, bool output_asc) {
// Your implementation here
}
The parameter output_asc serves the same purpose here as for merge: it tells the function that we want the output to be sorted ascending.
Interface
You must implement the functions
void merge(int* input, int size, int* output, bool output_asc);
int* mergesort(int* input, int size);
void mergesort(int *input, int size, int* output, bool output_asc);
Download a template .cpp file containing these definitions. This file is also available on the server in /usr/local/class/src.
merge must run in O(n) time with n= size. mergesort (both versions) must run in O(nlogn) time, and must use O(n) space. If you allocate any space other than the output array, you should free it before your function returns.
The test runner will test each function separately, and then in combination. It checks the result of sorting to make sure that it’s actually sorted, and then nothing is missing or added from the original (unsorted) sequence.
The code .cpp is available bellow
#include<iostream>
using namespace std;
//declaring variables
void merge(int* ip, int sz, int* opt, bool opt_asc); //merging
int* mergesort(int* ip, int sz);
void mergesort(int *ip, int sz, int* opt, bool opt_asc);
void merge(int* ip, int sz, int* opt, bool opt_asc)
{
int s1 = 0;
int mid_sz = sz / 2;
int s2 = mid_sz;
int e2 = sz;
int s3 = 0;
int end3 = sz;
int i, j;
if (opt_asc==true)
{
i = s1;
j = e2 - 1;
while (i < mid_sz && j >= s2)
{
if (*(ip + i) > *(ip + j))
{
*(opt + s3) = *(ip + j);
s3++;
j--;
}
else if (*(ip + i) <= *(ip + j))
{
*(opt + s3) = *(ip + i);
s3++;
i++;
}
}
if (i != mid_sz)
{
while (i < mid_sz)
{
*(opt + s3) = *(ip + i);
s3++;
i++;
}
}
if (j >= s2)
{
while (j >= s2)
{
*(opt + s3) = *(ip + j);
s3++;
j--;
}
}
}
else
{
i = mid_sz - 1;
j = s2;
while (i >= s1 && j <e2)
{
if (*(ip + i) > *(ip + j))
{
*(opt + s3) = *(ip + i);
s3++;
i--;
}
else if (*(ip + i) <= *(ip + j))
{
*(opt + s3) = *(ip + j);
s3++;
j++;
}
}
if (i >= s1)
{
while (i >= s1)
{
*(opt + s3) = *(ip + i);
s3++;
i--;
}
}
if (j != e2)
{
while (j < e2)
{
*(opt + s3) = *(ip + j);
s3++;
j++;
}
}
}
for (i = 0; i < sz; i++)
*(ip + i) = *(opt + i);
}
int* mergesort(int* ip, int sz)
{
int* opt = new int[sz];
mergesort(ip, sz, opt, true);
return opt;
}
void mergesort(int *ip, int sz, int* opt, bool opt_asc)
{
if (sz > 1)
{
int q = sz / 2;
mergesort(ip, sz / 2, opt, true);
mergesort(ip + sz / 2, sz - sz / 2, opt + sz / 2, false);
merge(ip, sz, opt, opt_asc);
}
}
int main()
{
int arr1[12] = { 5, 6, 9, 8,25,36, 3, 2, 5, 16, 87, 12 };
int arr2[14] = { 2, 3, 4, 5, 1, 20,15,30, 2, 3, 4, 6, 9,12 };
int arr3[10] = { 10, 9, 8, 7, 6, 5, 4, 3, 2, 1 };
int *opt;
cout << "Arays after sorting:\n";
cout << "Array 1 : ";
opt = mergesort(arr1, 12);
for (int i = 0; i < 12; i++)
cout << opt[i] << " ";
cout << endl;
cout << "Array 2 : ";
opt = mergesort(arr2, 14);
for (int i = 0; i < 14; i++)
cout << opt[i] << " ";
cout << endl;
cout << "Array 3 : ";
opt = mergesort(arr3, 10);
for (int i = 0; i < 10; i++)
cout << opt[i] << " ";
cout << endl;
return 0;
}
In 2-5 paragraphs, describe how technology helps business professionals to be more efficient.
The ways that technology helps business professionals to be more efficient is that Business professionals may stay more organized, communicate more effectively, and keep firms secure with the use of technology.
Technology makes it simpler to connect with employees by utilizing e-mail and memos, and it helps keep employee information and corporate paperwork a lot more organized using computers and software.
How does technology improve the productivity of business people?By streamlining time-consuming procedures, technology also increases office productivity. For instance, using document management software eliminates the need for manual data entry, filing, as well as in file retrieval.
Therefore, one can say that Technology can be used to safeguard private executive decisions, financial data, and other forms of proprietary information that gives a company a competitive edge. Simply simply, technology aids firms in protecting their ideas from rivals.
Learn more about technology from
https://brainly.com/question/1162014
#SPJ1
Secondary sources
information gathered from primary sources.
Answer:
The answer is interpret Proof is down below
Explanation:
Here is the proooooooffffffff i made a 90 but this one was right
Secondary sources interpret information gathered from primary sources.
What are Secondary sources of information?A secondary source is known to be made up of discussion that is often based on a primary information source.
Hence, the feature of secondary sources are known to give some kind of interpretation to all the information that has been gathered from other primary sources.
Learn more about Secondary sources from
https://brainly.com/question/896456
#SPJ2
Screenshot is the image of your active MS Word PowerPoint window
Is it true or false?
true
Screenshots are basically snapshots of your computer screen. You can take a screenshot of almost any program, website, or open window. PowerPoint makes it easy to insert a screenshot of an entire window or a screen clipping of part of a window in your presentation.
Why the shape of a cell is hexagonal
Answer:
Hexagonal cell shape is perfect over square or triangular cell shapes in cellular architecture because it cover an entire area without overlapping i.e. they can cover the entire geographical region without any gaps.
I hope this helps
Pls mark as brainliest
The intentional defacement or destruction of a website is called: Group of answer choices spoofing. cybervandalism. cyberwarfare. phishing. pharming.
Answer:
cybervandalism
Explanation:
The intentional defacement or destruction of a website is called cybervandalism. This ultimately implies that, cybervandalism is carried out or done by someone through the use of computer technology such as an internet to destroy data (informations).
Additionally, the defacement or destruction of a website simply means changing the appearance and data relating a website. Some of the tools use for cybervandalism is a file transfer protocol (FTP), structured query language (SQL) injection etc.
In may 2005, President Donald Trump's Wikipedia web page was vandalized by an attacker.
It should be noted that intentional defacement or destruction of a website is called cybervandalism.
Cybervandalism can be regarded as the damage or destruction which is been carried out in digital form.
It may involves the cyber vandals which involves the defacing of a website.Therefore, cybervandalism serves as intentional defacement or destruction of a website.
Learn more about cybervandalism at;
https://brainly.com/question/11408596
Seamus has too much text in one cell but wants all the information to be visible at once. What should he do? force the text to wrap force the text to spill-over truncate the text force the text to be inserted to next cell
Answer:
A: force the text to wrap
Explanation:
Just took the test and got it right!!! Hope this helps :D
Answer:
A) Force the text to wrap
Explanation:
Did it on ed2020
what is scientific and
Answer:
And what??????????????
Write a C program to input basic salary of an employee and calculate gross salary according to given conditions.
Basic Salary <= 10000 : HRA = 20%, DA = 80%
Basic Salary is between 10001 to 20000 : HRA = 25%, DA = 90%
Basic Salary >= 20001 : HRA = 30%, DA = 95%
Your program must calculate each employee's gross pay amount.
Answer:
Written in C
#include <stdio.h>
int main() {
float salary;
printf("Salary: ");
scanf("%f", &salary);
float HRA, DA;
if(salary <= 10000){
HRA = 0.20; DA = 0.80;
}
else if(salary >= 10000 && salary <= 20000){
HRA = 0.25; DA = 0.90;
}
else{
HRA = 0.30; DA = 0.95;
}
salary = salary + salary * HRA + salary * DA;
printf("Gross Salary: %.2f\n", salary);
return 0;
}
Explanation:
I've added the full program as an attachment where I used comments as explanation
If you want Nud3s add me on sc Kermit4lyfe1
Answer:
que pinga this is a hw website not snap
Explanation:
Backing up and synchronization are the same thing.
A.)True
B.) False
Answer: A.)true
Explanation: This is true for a number of reasons, the first being that synced files
Plz answer me will mark as brainliest
Answer:
7. true
8.B
Hopefully those are correct!
Explanation:
In HTML5, the
(line break) tag does not require a closing tag.
true or false
Jason works as a financial investment advisor. He collects financial data from clients, processes the data online to calculate the risks associated with future investment decisions, and offers his clients real-time information immediately. Which type of data processing is Jason following in the transaction processing system?
A.
online decision support system
B.
online transaction processing
C.
online office support processing
D.
online batch processing
E.
online executive processing
I believe the answer is A. because he has to listen to what the people tell him and he information he has to think about and make a choice on what to reply with.
I hope this helps and its correct please let me know if its wrong have a great day//night.
5-5. Design an Ethernet network to connect a single client P C to a single server. Both the client and the server will connect to their workgroup switches via U T P. The two devices are 900 meters apart. They need to communicate at 800 M b p s. Your design will specify the locations of any switches and the transmission link between the switches.
5-6. Add to your design in the previous question. Add another client next to the first client. Both connect to the same switch. This second client will also communicate with the server and will also need 800 M b p s in transmission speed. Again, your design will specify the locations of switches and the transmission link between the switches.
Answer:
ok so u have take the 5 and put 6
Explanation:
5-5. Ethernet network design: UTP connections from client PC and server to workgroup switches, 900m fiber optic link between switches, 800 Mbps communication.
5-6. Additional client connects to the same switch, UTP connection, maintains existing fiber optic link, 800 Mbps communication with the server.
What is the explanation for this?5-5. For connecting a single client PC to a single server, both located 900 meters apart and requiring communication at 800 Mbps, the following Ethernet network design can be implemented:
- Client PC and server connect to their respective workgroup switches via UTP.
- Use fiber optic cables for the 900-meter transmission link between the switches.
- Install switches at the client PC and server locations.
- Ensure that the switches support at least 1 Gbps Ethernet speeds to accommodate the required transmission speed.
5-6. In addition to the previous design, for adding another client next to the first client:
- Connect both clients to the same switch.
- Use UTP cables to connect the second client to the switch.
- Ensure the switch supports 1 Gbps Ethernet speeds.
- Maintain the existing fiber optic transmission link between the switches.
- The second client can also communicate with the server at the required 800 Mbps transmission speed.
Learn more about Network Design at:
https://brainly.com/question/7181203
#SPJ2
Select a cybersecurity career that interests you. Describe the job duties and identify the skills required to excel in that career. Then, make a career plan.
Answer:
it's business
Explanation:
business you started with small and work for it grow up.
The Environmental Master Equation includes all of the following terms except:
O Resource use per person
O Population
•Percent of resource emitted into the atmosphere
•Environmental impact per unit of resource use
Answer: [C]: " percent of resource emitted into the atmosphere ."
________________________
Explanation:
In the "Environmental Master Equation"—
Note that the:
"Environmental impact" ;
= (population) * (resource use per unit population) *
(environmental impact per unit of resource use) .
________________________
The question asks:
"The Environmental Master Equation includes all of the following terms —EXCEPT ...[with 4 (four) answer choices following.]."
________________________
Consider the given answer choices:
[A]: "resource user per person"—which is the same as"
"(resource use per UNIT [emphasis added] population" ;
— which does appear in the equation;
→ so we can rule out "Choice: [A]."
________________________
[B]: "population" —this is included within the equation; so we can rule out "Choice: [B]."
________________________
[C]: "percentage of resource emitted into the atmosphere" ;
Note: This clearly does NOT appear within the equation; so this is a likely answer choice.
________________________
Note: There is one more answer choice—so let us examine:
________________________
[D]: "environmental impact per unit of resource use" —this is included within the equation, so we can rule out "Choice: [D]."
________________________
Furthermore, the particular answer choices given—A, B, and D ; constitute all elements within the "Environmental Master Equation."
________________________
As such: The correct answer is:
[C]: "percent of resource emitted into the atmosphere."
________________________
Hope this is helpful to you!
Best wishes in your academic pursuits!
________________________
Answer:
•Percent of resource emitted into the atmosphere
Explanation:
Hope this will help
Who is a software engineer
Which of the following is a feature of high-level code?
Language makes it easier to detect problems
Requires a lot of experience
Easy for a computer to understand
Runs quicker
If Maya wants to access a view that would control multiple slides within a presentation, which view should she utilize? Master view Color view Slide Sorter view Normal view
Answer:
Slide Shorter View
Explanation:
If Maya wants to access a view that would control multiple slides within a presentation, which view should she utilize Slide Shorter View.
What is Slide shorter view?View of the Slide Sorter from the task bar displays the Slide View button in PowerPoint, either from the View tab on the ribbon or at the bottom of the slide window.
The Slide Sorter view (below) shows thumbnails of each slide in your presentation in a horizontally stacked order. If you need to rearrange your slides, the slide show view comes in handy.
You can simply click and drag your slides to a new spot or add sections to categorize your slides into useful groupings.
Therefore, If Maya wants to access a view that would control multiple slides within a presentation, which view should she utilize Slide Shorter View.
To learn more about Slide shorter view, refer to the link:
https://brainly.com/question/13736919
#SPJ6
This is Java! Help is appreciated :)
public class TvShow {
int x;
public TvShow(String showName, int numMinutes){
}
public int getNumActors(String actors){
//method code goes here but since it's just a signature we don't put anything here.
return 0;
}
TvShow show22 = new TvShow("Leave it to Beaver", x);
public double cost(int i){
return 0;
}
public static void main(String[] args) {
}
}
class Tester {
public static void main(String[] args) {
TvShow tv = new TvShow("", 0);
tv.show22.cost(0);
}
}
I hope this helps in some way!
3.What are the pros and cons of using a linked implementation of a sparse matrix, as opposed to an array-based implementation
Answer:
speed and storage
Explanation:
The pros and cons of both are mainly in regards to speed and storage. Due to linked lists elements being connected to one another it requires that each previous element be accessed in order to arrive at a specific element. This makes it much slower than an array-based implementation where any element can be quickly accessed easily due to it having a specific location. This brings us to the other aspect which is memory. Since Arrays are saved as a single block, where each element has a specific location this takes much more space in the RAM as opposed to a linked implementation which is stored randomly and as indexes of the array itself.
Array Implementation:
Pros: Much Faster and Easier to target a specific elementCons: Much More Space neededLinked Implementation
Pros: Less overall space neededCons: Much slower speed.sum_even Write a program that reads an integer 0 < n < 2^32, returns the sum of all digits in n that are divisible by 2. For example, if n = 341238 the output would be 14, because it is the sum of 4 + 2 + 8. Hint: a signed int may not be enough.
Answer:
Written in Python
n = int(input("Num: "))
sum_even = 0
if n > 0 and n < 2**32:
strn = str(n)
for i in range(0,len(strn)):
if int(strn[i])%2 == 0:
sum_even = sum_even+ int(strn[i])
print(sum_even)
Explanation:
This line prompt user for input
n = int(input("Num: "))
This line initializes sum_even to 0
sum_even = 0
This line checks for valid input
if n > 0 and n < 2**32:
This line converts input to string
strn = str(n)
This line iterates through each digit of the input
for i in range(0,len(strn)):
This if condition checks for even number
if int(strn[i])%2 == 0:
This adds the even numbers
sum_even = sum_even+ int(strn[i])
This prints the sum of all even number in the user input
print(sum_even)
A bank has three types of accounts: checking, savings, and loan. Following are the attributes for each type of account:
CHECKING: Acct No, Date Opened, Balance, Service Charge
SAVINGS: Acct No, Date Opened, Balance, Interest Rate
LOAN: Acct No, Date Opened, Balance, Interest Rate, Payment
Assume that each bank account must be a member of exactly one of these subtypes. Using generalization, develop an EER model segment to represent this situation using the traditional EER notation, the Visio notation, or other tools like Lucidchart / Draw.io. Remember to include a subtype discriminator.
Answer:
please find the attachment of a graph:
Explanation:
Description of the model:
Generalization is the method used here just for the EER model, which sweeping generalization is a way to identify the common characteristics of a sequence to create a common entity. This is an approach from the bottom up. Its verification, savings, and credit firms are extended to a higher-level object's account. So, the entity entities (Account) are the common traits of these bodies. As well as the specific qualities are the part of specialized entities (checks, savings, and loans). This EER model is shown via the subgroup and supertype notes. The Balance has calculated the distance, throughout the entity type entity are key patterns of the subgroup entities. The wood beaded includes Acct No, Balanced and Open Date. The key was its underliner Acct No. the very first key. CHECKING, SAVINGS, and LOAN are the subsection organizations of the Supertype Account.Its subtypes get the traits that are not normal. It Testing feature is the uncommon extra fee feature. Its SAVINGS post-type feature has the peculiar exchange rate feature. Its LOAN subgroup feature produces unusual interest in fixed payment characteristics.Enhanced Entity relationships[EER] represent the requirements and complexities of a complex database.
What is Enhanced Entity-relationship?Here, the account entity generalized into three entities and these are checking, savings, and loan.
Also, the common attribute the three of them have can be considered in the account entity which is common in them while the individual attributes must be specified under its own entity.
EER models are the helpful tools used for designing databases that have high-level models.
Learn more about databases on:
https://brainly.com/question/518894
What is the process to add images to your library panel in Adobe Animate CC?
Answer choices
Choose file>import>import library
Choose file>open>insert image
Choose file>export>export file
Choose file> New> file
Answer:
Choose file>import>import library
Explanation:
because it is the process to add images to your library
"Jean-luc Doumont notes that slide software is an effective presentation tool, especially when the speech goal is to:"
Hi, your question is incomplete. Here are the options:
A. persuade the audience.
B, encourage critical thinking.
C. increase discussion.
D. relay detailed information
Answer:
D. relay detailed information
Explanation:
Indeed, slide software (like MS Powerpoint) would be an effective presentation tool, especially when the speech goal is to relay detailed information.
For example, a graph showing the exponential growth in the number of smartphone users in the United States for the last 15 years would be effectively presented using a slide that shows this data because it will allow the audience to easily see the detailed information.
What does GDF is a measure of a nations?
Which is an example of a function header in Python? left (40): def drawT(): left def
Answer:
B
Explanation:
Answer:
b def drawT():
Explanation:
Jax needs to write a block of code that will organize a list of items alphabetically. Which function should he use? append() print() sort() order()
In python, the sort() function will alphabetically sort a list of strings
To write a block of code that will organize a list of items alphabetically In python, the sort() function will alphabetically sort a list of strings.
What is python?A high-level, all-purpose programming language is Python. Code readability is prioritized in its design philosophy, which makes heavy use of indentation. Python uses garbage collection and has dynamic typing. It supports a variety of paradigms for programming, including functional, object-oriented, and structured programming.
Python is a popular computer programming language used to create software and websites, automate processes, and analyze data. Python is a general-purpose language, which means it may be used to make many various types of applications and isn't tailored for any particular issues.
Sorting in Python simply means putting the data in a specific format or order. The order of the data pieces can be sorted either ascendingly or descendingly. Python programming contains certain built-in functions that allow you to sort the list's elements, just like C++ and Java.
Therefore, Thus option (C) is correct.
Learn more about python here:
https://brainly.com/question/18502436
#SPJ2
guy if you now nitro type pls login and search prouy pro and you will se the legenddetroyer click my team and plssssss come to my team
Answer:
ok
Explanation:
Answer:
I will join ala you don't disband it. XD
Explanation:
I am You-Drive-Me-Crazy