Answer:
See explaination
Explanation:
public class PalindromeChange {
public static void main(String[] args) {
System.out.println("mom to non palindrom word is: "+changTONonPalindrom("mom"));
System.out.println("mom to non palindrom word is: "+changTONonPalindrom("aaabbaaa"));
}
private static String changTONonPalindrom(String str)
{
int mid=str.length()/2;
boolean found=false;
char character=' ';
int i;
for(i=mid-1;i>=0;i--)
{
character = str.charAt(i);
if(character!='a')
{
found=true;
break;
}
}
if(!found)
{
for(i=mid+1;i<str.length();i++)
{
character = str.charAt(i);
if(character!='a')
{
found=true;
break;
}
}
}
// This gives the character 'a'
int ascii = (int) character;
ascii-=1;
str = str.substring(0, i) + (char)ascii+ str.substring(i + 1);
return str;
}
}
Let U = {b1, b2, , bn} with n ≥ 3. Interpret the following algorithm in the context of urn problems. for i is in {1, 2, , n} do for j is in {i + 1, i + 2, , n} do for k is in {j + 1, j + 2, ..., n} do print bi, bj, bk How many lines does it print? It prints all the possible ways to draw three balls in sequence, without replacement. It prints P(n, 3) lines. It prints all the possible ways to draw an unordered set of three balls, without replacement. It prints P(n, 3) lines. It prints all the possible ways to draw three balls in sequence, with replacement. It prints P(n, 3) lines. It prints all the possible ways to draw an unordered set of three balls, without replacement. It prints C(n, 3) lines. It prints all the possible ways to draw three balls in sequence, with replacement. It prints C(n, 3) lines.
Answer:
Check the explanation
Explanation:
Kindly check the attached image for the first step
Note that the -print" statement executes n(n — I)(n — 2) times and the index values for i, j, and k can never be the same.
Therefore, the algorithm prints out all the possible ways to draw three balls in sequence, without replacement.
Now we need to determine the number of lines this the algorithm print. In this case, we are selecting three different balls randomly from a set of n balls. So, this involves permutation.
Therefore, the algorithm prints the total
P(n, 3)
lines.
Dave owns a construction business and is in the process of buying a laptop. He is looking for a laptop with a hard drive that will likely continue to function if the computer is dropped. Which type of hard drive does he need?
Answer:
Solid state drive
Explanation:
The term solid-state drive is used for the electronic circuitry made entirely from semiconductors. This highlights the fact that the main storage form, in terms of a solid-state drive, is via semiconductors instead of a magnetic media for example a hard disk. In lieu of a more conventional hard drive, SSD is built to live inside the device. SSDs are usually more resistant to physical shock in comparison to the electro-mechanical drives and it functions quietly and has faster response time. Therefore, SSD will be best suitable for the Dave.
Select the correct navigational path to create the function syntax to use the IF function.
Click the Formula tab on the ribbon and look in the ???
'gallery
Select the range of cells.
Then, begin the formula with the ????? click ?????. and click OK.
Add the arguments into the boxes for Logical Test, Value_if_True, and Value_if_False.
Answer:
1. Logical
2.=
3.IF
Explanation:
just did the assignment
Retail price data for n = 60 hard disk drives were recently reported in a computer magazine. Three variables were recorded for each hard disk drive: y = Retail PRICE (measured in dollars) x1 = Microprocessor SPEED (measured in megahertz) (Values in sample range from 10 to 40) x2 = CHIP size (measured in computer processing units) (Values in sample range from 286 to 486) A first-order regression model was fit to the data. Part of the printout follows: __________.
Answer:
Explanation:
Base on the scenario been described in the question, We are 95% confident that the price of a single hard drive with 33 megahertz speed and 386 CPU falls between $3,943 and $4,987
6. Why did he choose to install the window not totally plumb?
Answer:
Because then it would break
Explanation:
You achieve this by obtaining correct measurements. When measuring a window, plumb refers to the vertical planes, and level refers to the horizontal planes. So he did not install the window totally plumb
Write a program with total change amount as an integer input that outputs the change using the fewest coins, one coin type per line. The coin types are dollars, quarters, dimes, nickels, and pennies. Use singular and plural coin names as appropriate, like 1 penny vs. 2 pennies. Ex: If the input is: 0 or less, the output is: no change Ex: If the input is: 45 the output is: 1 quarter 2 dimes
Answer:.
// Program is written in C++.
// Comments are used for explanatory purposes
// Program starts here..
#include<iostream>
using namespace std;
int main()
{
// Declare Variables
int amount, dollar, quarter, dime, nickel, penny;
// Prompt user for input
cout<<"Amount: ";
cin>>amount;
// Check if input is less than 1
if(amount<=0)
{
cout<<"No Change";
}
else
{
// Convert amount to various coins
dollar = amount/100;
amount = amount%100;
quarter = amount/25;
amount = amount%25;
dime = amount/10;
amount = amount%10;
nickel = amount/5;
penny = amount%5;
// Print results
if(dollar>=1)
{
if(dollar == 1)
{
cout<<dollar<<" dollar\n";
}
else
{
cout<<dollar<<" dollars\n";
}
}
if(quarter>=1)
{
if(quarter== 1)
{
cout<<quarter<<" quarter\n";
}
else
{
cout<<quarter<<" quarters\n";
}
}
if(dime>=1)
{
if(dime == 1)
{
cout<<dime<<" dime\n";
}
else
{
cout<<dime<<" dimes\n";
}
}
if(nickel>=1)
{
if(nickel == 1)
{
cout<<nickel<<" nickel\n";
}
else
{
cout<<nickel<<" nickels\n";
}
}
if(penny>=1)
{
if(penny == 1)
{
cout<<penny<<" penny\n";
}
else
{
cout<<penny<<" pennies\n";
}
}
}
return 0;
}
*Sometimes it is difficult to convince top management to commit funds to develop and implement a SIS why*
Step-by-step Explanation:
SIS stands for: The Student Information System (SIS).
This system (a secure, web-based accessible by students, parents and staff) supports all aspects of a student’s educational experience, and other information. Examples are academic programs, test grades, health information, scheduling, etc.
It is difficult to convince top management to commit funds to develop and implement SIS, this can be due to a thousand reasons.
The obvious is that the management don't see the need for it. They would rather have students go through the educational process the same way they did. Perhaps, they just don't trust the whole process, they feel more in-charge while using a manual process.
Components of a product or system must be
1) Reliable
2) Flexible
3) Purposeful
4)Interchangeable
Answer:
The correct answer to the following question will be Option D (Interchangeable).
Explanation:
Interchangeability applies towards any portion, part as well as a unit that could be accompanied either by equivalent portion, component, and unit within a specified commodity or piece of technology or equipment.This would be the degree to which another object can be quickly replaced with such an equivalent object without re-calibration being required.The other three solutions are not situation-ally appropriate, so option D seems to be the right choice.
Explain possible ways that Darla can communicate with her coworker Terry, or her manager to make sure Joe receives great customer service?
Answer:
They can communicate over the phone or have meetings describing what is and isn't working for Joe. It's also very important that Darla makes eye contact and is actively listening to effectively handle their customer.
Explanation:
For this problem, you will write a function standard_deviation that takes a list whose elements are numbers (they may be floats or ints), and returns their standard deviation, a single number. You may call the variance method defined above (which makes this problem easy), and you may use sqrt from the math library, which we have already imported for you. Passing an empty list to standard_deviation should result in a ZeroDivisionError exception being raised, although you should not have to explicitly raise it yourself.
Answer:
import math def standard_deviation(aList): sum = 0 for x in aList: sum += x mean = sum / float(len(aList)) sumDe = 0 for x in aList: sumDe += (x - mean) * (x - mean) variance = sumDe / float(len(aList)) SD = math.sqrt(variance) return SD print(standard_deviation([3,6, 7, 9, 12, 17]))Explanation:
The solution code is written in Python 3.
Firstly, we need to import math module (Line 1).
Next, create a function standard_deviation that takes one input parameter, which is a list (Line 3). In the function, calculate the mean for the value in the input list (Line 4-8). Next, use the mean to calculate the variance (Line 10-15). Next, use sqrt method from math module to get the square root of variance and this will result in standard deviation (Line 16). At last, return the standard deviation (Line 18).
We can test the function using a sample list (Line 20) and we shall get 4.509249752822894
If we pass an empty list, a ZeroDivisionError exception will be raised.
Kitchen Gadgets sells a line of high-quality kitchen utensils and gadgets. When customers place orders on the company’s Web site or through electronic data interchange (EDI), the system checks to see if the items are in stock, issues a status message to the customer, and generates a shipping order to the warehouse, which fills the order. When the order is shipped, the customer is billed. The system also produces various reports.
1. List four elements used in DFDs, draw the symbols, and explain how they are used.
2. Draw a context diagram for the order system.
3. Draw a diagram 0 DFD for the order system.
4. Explain the importance of leveling and balancing. Your boss, the IT director, wants you to explain FDDs, BPM, DFDs, and UML to a group of company managers and users who will serve on a systems development team for the new marketing system.
Answer:
Ahhhhh suckkkkkkkkkkk
Describe how DMA is
used to
transfer data
from peripherals.
Answer:
Think of DMA as a co-processor that is used to quickly transfer data between main memory and peripherals without the intervention of the CPU.
To encrypt messages I propose the formula C = (3P + 1) mod 27, where P is the "plain text" (the original letter value) and C is the "cipher text" (the encrypted letter value). For example, if P = 2 (the letter 'c' ), C would be 7 (the letter 'h') since (3(2) + 1) mod 27 = 7. There is a problem though: When I send the message 'c' to my friend, encrypted as 'h', they don't know whether the original message was 'c' or another letter that also encrypts to 'h'. What other letter(s) would also encrypt to 'h' besides 'c' in this system?
Answer:
C = (3P+1) % 27
so when P will be max 26,when P is 26 the (3P+1) = 79. And 79/27 = 2 so let's give name n = 2.
Now doing reverse process
We get ,
P = ((27*n)+C-1)/3
Where n can be 0,1,2
So substituting value of n one by one and the C=7(corresponding index of h)
For n= 0,we get P=2, corresponding char is 'c'
For n=1,we get P=11, corresponding char is 'l'
For n=2,we get P= 20, corresponding cahr is 'u'.
So beside 'c',the system will generate 'h' for 'l' and 'u' also.
The cord of a bow string drill was used for
a. holding the cutting tool.
b. providing power for rotation.
c. transportation of the drill.
d. finding the center of the hole.
Answer:
I don't remember much on this stuff but I think it was B
Write a program that maintains a database containing data, such as name and birthday, about your friends and relatives. You should be able to enter, remove, modify, or search this data. Initially, you can assume that the names are unique. The program should be able to save the data in a fi le for use later. Design a class to represent the database and another class to represent the people. Use a binary search tree of people as a data member of the database class. You can enhance this problem by adding an operation that lists everyone who satisfi es a given criterion. For example, you could list people born in a given month. You should also be able to list everyone in the database.
Answer:
[tex]5909? \times \frac{?}{?} 10100010 {?}^{?} 00010.222 {?}^{2} [/tex]
Computer A has an overall CPI of 1.3 and can be run at a clock rate of 600 MHz. Computer B has a CPI of 2.5 and can be run at a clock rate of 750 MHz. We have a particular program we wish to run. When compiled for computer A, this program has exactly 100,000 instructions. How many instructions would the program need to have when compiled for Computer B, in order for the two computers to have exactly the same execution time for this program
Answer:
Check the explanation
Explanation:
CPI means Clock cycle per Instruction
given Clock rate 600 MHz then clock time is Cー 1.67nSec clockrate 600M
Execution time is given by following Formula.
Execution Time(CPU time) = CPI*Instruction Count * clock time = [tex]\frac{CPI*Instruction Count}{ClockRate}[/tex]
a)
for system A CPU time is 1.3 * 100, 000 600 106
= 216.67 micro sec.
b)
for system B CPU time is [tex]=\frac{2.5*100,000}{750*10^6}[/tex]
= 333.33 micro sec
c) Since the system B is slower than system A, So the system A executes the given program in less time
Hence take CPU execution time of system B as CPU time of System A.
therefore
216.67 micro = =[tex]\frac{2.5*Instruction}{750*10^6}[/tex]
Instructions = 216.67*750/2.5
= 65001
hence 65001 instruction are needed for executing program By system B. to complete the program as fast as system A
The number of instructions that the program would need to have when compiled for Computer B is; 65000 instructions
What is the execution time?
Formula for Execution time is;
Execution time = (CPI × Instruction Count)/Clock Time
We are given;
CPI for computer A = 1.3
Instruction Count = 100000
Clock time = 600 MHz = 600 × 10⁶ Hz
Thus;
Execution time = (1.3 * 100000)/(600 × 10⁶)
Execution time(CPU Time) = 216.67 * 10⁻⁶ second
For CPU B;
CPU Time = (2.5 * 100000)/(750 × 10⁶)
CPU Time = 333.33 * 10⁻⁶ seconds
Thus, instructions for computer B for the two computers to have same execution time is;
216.67 * 10⁻⁶ = (2.5 * I)/(750 × 10⁶)
I = (216.67 * 10⁻⁶ * 750 × 10⁶)/2.5
I = 65000 instructions
Read more about programming instructions at; https://brainly.com/question/15683939
The Monte Carlo (MC) Method (Monte Carlo Simulation) was first published in 1949 by Nicholas Metropolis and Stanislaw Ulam in the work "The Monte Carlo Method" in the Journal of American Statistics Association. The name Monte Carlo has its origins in the fact that Ulam had an uncle who regularly gambled at the Monte Carlo casino in Monaco. In fact, way before 1949 the method had already been extensively used as a secret project of the U.S. Defense Department during the so-called "Manhattan Project". The basic principle of the Monte Carlo Method is to implement on a computer the Strong Law of Large Numbers (SLLN) (see also Lecture 9). The Monte Carlo Method is also typically used as a probabilistic method to numerically compute an approximation of a quantity that is very hard or even impossible to compute exactly like, e.g., integrals (in particular, integrals in very high dimensions!). The goal of Problem 2 is to write a Python code to estimate the irrational number
Answer:
can you give more detail
Explanation:
A company that wants to send data over the Internet has asked you to write a program that will encrypt it so that it may be transmitted more securely. All the data is transmitted as four-digit integers. Your app should read a four-digit integer entered by the user and encrypt it as follows: Replace each digit with the result of adding 7 to the digit and getting the remainder after dividing the new value by 10. Then swap the first digit with the third, and swap the second digit with the fourth. Then display the encrypted integer. Write a separate app that inputs an encrypted four-digit integer and decrypts it (by reversing the encryption scheme) to form the original number. Use the format specifier D4 to display the encrypted value in case the number starts with a 0
Answer:
The output of the code:
Enter a 4 digit integer : 1 2 3 4
The decrypted number is : 0 1 8 9
The original number is : 1 2 3 4
Explanation:
Okay, the code will be written in Java(programming language) and the file must be saved as "Encryption.java."
Here is the code, you can just copy and paste the code;
import java.util.Scanner;
public class Encryption {
public static String encrypt(String number) {
int arr[] = new int[4];
for(int i=0;i<4;i++) {
char ch = number.charAt(i);
arr[i] = Character.getNumericValue(ch);
}
for(int i=0;i<4;i++) {
int temp = arr[i] ;
temp += 7 ;
temp = temp % 10 ;
arr[i] = temp ;
}
int temp = arr[0];
arr[0] = arr[2];
arr[2]= temp ;
temp = arr[1];
arr[1] =arr[3];
arr[3] = temp ;
int newNumber = 0 ;
for(int i=0;i<4;i++)
newNumber = newNumber * 10 + arr[i];
String output = Integer.toString(newNumber);
if(arr[0]==0)
output = "0"+output;
return output;
}
public static String decrypt(String number) {
int arr[] = new int[4];
for(int i=0;i<4;i++) {
char ch = number.charAt(i);
arr[i] = Character.getNumericValue(ch);
}
int temp = arr[0];
arr[0]=arr[2];
arr[2]=temp;
temp = arr[1];
arr[1]=arr[3];
arr[3]=temp;
for(int i=0;i<4;i++) {
int digit = arr[i];
switch(digit) {
case 0:
arr[i] = 3;
break;
case 1:
arr[i] = 4;
break;
case 2:
arr[i] = 5;
break;
case 3:
arr[i] = 6;
break;
case 4:
arr[i] = 7;
break;
case 5:
arr[i] = 8;
break;
case 6:
arr[i] = 9;
break;
case 7:
arr[i] = 0;
break;
case 8:
arr[i] = 1;
break;
case 9:
arr[i] = 2;
break;
}
}
int newNumber = 0 ;
for(int i=0;i<4;i++)
newNumber = newNumber * 10 + arr[i];
String output = Integer.toString(newNumber);
if(arr[0]==0)
output = "0"+output;
return output;
}
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
System.out.print("Enter a 4 digit integer:");
String number = sc.nextLine();
String encryptedNumber = encrypt(number);
System.out.println("The decrypted number is:"+encryptedNumber);
System.out.println("The original number is:"+decrypt(encryptedNumber));
}
}
Write a statement that calls the recursive method backwardsAlphabet() with parameter startingLetter.
import java.util.Scanner; public class RecursiveCalls { public static void backwardsAlphabet(char currLetter) { if (currLetter == 'a') { System.out.println(currLetter); } else { System.out.print(currLetter + " "); backwardsAlphabet((char)(currLetter - 1)); } } public static void main (String [] args) { Scanner scnr = new Scanner(System.in); char startingLetter; startingLetter = scnr.next().charAt(0); /* Your solution goes here */ } }
Answer:
Following are the code to method calling
backwardsAlphabet(startingLetter); //calling method backwardsAlphabet
Output:
please find the attachment.
Explanation:
Working of program:
In the given java code, a class "RecursiveCalls" is declared, inside the class, a method that is "backwardsAlphabet" is defined, this method accepts a char parameter that is "currLetter". In this method a conditional statement is used, if the block it will check input parameter value is 'a', then it will print value, otherwise, it will go to else section in this block it will use the recursive function that prints it's before value. In the main method, first, we create the scanner class object then defined a char variable "startingLetter", in this we input from the user and pass its value into the method that is "backwardsAlphabet".Write a functionvector merge(vector a, vector b)that merges two vectors, alternating elements from both vectors. If one vector isshorter than the other, then alternate as long as you can and then append the remaining elements from the longer vector. For example, if a is 1 4 9 16and b is9 7 4 9 11then merge returns the vector1 9 4 7 9 4 16 9 1118. Write a predicate function bool same_elements(vector a, vector b)that checks whether two vectors have the same elements in some order, with the same multiplicities. For example, 1 4 9 16 9 7 4 9 11 and 11 1 4 9 16 9 7 4 9 would be considered identical, but1 4 9 16 9 7 4 9 11 and 11 11 7 9 16 4 1 would not. You will probably need one or more helper functions.19. What is the difference between the size and capacity of a vector
Answer:
see explaination for code
Explanation:
CODE
#include <iostream>
#include <vector>
using namespace std;
vector<int> merge(vector<int> a, vector<int> b) {
vector<int> result;
int k = 0;
int i = 0, j = 0;
while (i < a.size() && j < b.size()) {
if (k % 2 == 0) {
result.push_back(a[i ++]);
} else {
result.push_back(b[j ++]);
}
k ++;
}
while (i < a.size()) {
result.push_back(a[i ++]);
}
while(j < b.size()) {
result.push_back(b[j ++]);
}
return result;
}
int main() {
vector<int> a{1, 4, 9, 16};
vector<int> b{9, 7, 4, 9, 11};
vector<int> result = merge(a, b);
for (int i=0; i<result.size(); i++) {
cout << result[i] << " ";
}
}
Who is your favorite smite god in Hi-Rez’s “Smite”
Answer:
Variety
Explanation:
Suppose that a program's data and executable code require 1,024 bytes of memory. A new section of code must be added; it will be used with various values 70 times during the execution of a program. When implemented as a macro, the macro code requires 73 bytes of memory. When implemented as a procedure, the procedure code requires 132 bytes (including parameter-passing, etc.), and each procedure call requires 7 bytes. How many bytes of memory will the entire program require if the new code is added as a procedure? 1,646
Answer:
The answer is 1646
Explanation:
The original code requires 1024 bytes and is called 70 times ,it requires 7 byte and its size is 132 bytes
1024 + (70*7) + 132 = 1024 + 490 +132
= 1646
Design an application for Bob's E-Z Loans. The application accepts a client's loan amount and monthly payment amount. Output the customer's loan balance each month until the loan is paid off. b. Modify the Bob's E-Z Loans application so that after the payment is made each month, a finance charge of 1 percent is added to the balance.
Answer:
part (a).
The program in cpp is given below.
#include <stdio.h>
#include <iostream>
using namespace std;
int main()
{
//variables to hold balance and monthly payment amounts
double balance;
double payment;
//user enters balance and monthly payment amounts
std::cout << "Welcome to Bob's E-Z Loans application!" << std::endl;
std::cout << "Enter the balance amount: ";
cin>>balance;
std::cout << "Enter the monthly payment: ";
cin>>payment;
std::cout << "Loan balance: " <<" "<< "Monthly payment: "<< std::endl;
//balance amount and monthly payment computed
while(balance>0)
{
if(balance<payment)
{ payment = balance;}
else
{
std::cout << balance <<"\t\t\t"<< payment << std::endl;
balance = balance - payment;
}
}
return 0;
}
part (b).
The modified program from part (a), is given below.
#include <stdio.h>
#include <iostream>
using namespace std;
int main()
{
//variables to hold balance and monthly payment amounts
double balance;
double payment;
double charge=0.01;
//user enters balance and monthly payment amounts
std::cout << "Welcome to Bob's E-Z Loans application!" << std::endl;
std::cout << "Enter the balance amount: ";
cin>>balance;
std::cout << "Enter the monthly payment: ";
cin>>payment;
balance = balance +( balance*charge );
std::cout << "Loan balance with 1% finance charge: " <<" "<< "Monthly payment: "<< std::endl;
//balance amount and monthly payment computed
while(balance>payment)
{
std::cout << balance <<"\t\t\t\t\t"<< payment << std::endl;
balance = balance +( balance*charge );
balance = balance - payment;
}
if(balance<payment)
{ payment = balance;}
std::cout << balance <<"\t\t\t\t\t"<< payment << std::endl;
return 0;
}
Explanation:
1. The variables to hold the loan balance and the monthly payment are declared as double.
2. The program asks the user to enter the loan balance and monthly payment respectively which are stored in the declared variables.
3. Inside a while loop, the loan balance and monthly payment for each month is computed with and without finance charges in part (a) and part (b) respectively.
4. The computed values are displayed for each month till the loan balance becomes zero.
5. The output for both part (a) and part (b) are attached as images.
An organization’s SOC analyst, through examination of the company’s SIEM, discovers what she believes is Chinese-state sponsored espionage activity on the company’s network. Management agrees with her initial findings given the forensic artifacts she presents are characteristics of malware, but management is unclear on why the analyst thought it was Chinese-state sponsored. You have been brought in as a consultant to help determine 1) whether the systems have been compromised and 2) whether the analyst’s assertion has valid grounds to believe it is Chinese state-sponsored. What steps would you take to answer these questions given that you have been provided a MD5 hashes, two call back domains, and an email that is believed to have been used to conduct a spearphishing attack associated with the corresponding MD5 hash. What other threat intelligence can be generated from this information and how would that help shape your assessment?
Answer: Provided in the explanation segment
Explanation:
Below is a detailed explanation to make this problem more clearer to understand.
(1). We are asked to determine whether the systems have been compromised;
Ans: (YES) From the question given, We can see that the System is compromised. This is so because the plan of communication has different details of scenarios where incidents occur. This communication plan has a well read table of contents that lists specific type of incidents, where each incident has a brief description of the event.
(2). Whether the analyst’s assertion has valid grounds to believe it is Chinese state-sponsored.
Ans: I can say that the analyst uses several different internet protocol address located in so as to conduct its operations, in one instance, a log file recovered form an open indexed server revealed tham an IP address located is used to administer the command control node that was communicating with the malware.
(3). What other threat intelligence can be generated from this information?
Ans: The threat that can be generated from this include; Custom backdoors, Strategic web compromises, and also Web Server exploitation.
(4). How would that help shape your assessment?
Ans: This helps in such a way where information is gathered and transferred out of the target network which involve movement of files through multiple systems.
Files also gotten from networks as well as using tools (archival) to compress and also encrypt data with effectiveness of their data theft.
cheers i hope this helped!!!
customer seeks to buy a new computer for private use at home. The customer primarily needs the computer to use the Microsoft PowerPoint application for the purpose of practicing presentation skills. As a salesperson what size hard disc would you recommend and why?
Explanation:
The most reliable hard drives are those whose most common size is 3.5 inches, their advantages are their storage capacity and their speed and a disadvantage is that they usually make more noise.
For greater speed, it is ideal to opt for two smaller hard disks, since large disks are slower, but are partitioned so that there are no problems with file loss.
For a person who needs to use content creation programs, it is ideal to opt for a hard drive that has reliability.
Trace the complete execution of the MergeSort algorithm when called on the array of integers, numbers, below. Show the resulting sub-arrays formed after each call to merge by enclosing them in { }. For example, if you originally had an array of 5 elements, a = {5,2,8,3,7}, the first call to merge would result with: {2, 5} 8, 3, 7 ← Note after the first call to merge, two arrays of size 1 have been merged into the sorted subarray {2,5} and the values 2 and 5 are sorted in array a You are to do this trace for the array, numbers, below. Be sure to show the resulting sub-arrays after each call to MergeSort. int[] numbers = {23, 14, 3, 56, 17, 8, 42, 18, 5};
Answer:
public class Main {
public static void merge(int[] arr, int l, int m, int r) {
int n1 = m - l + 1;
int n2 = r - m;
int[] L = new int[n1];
int[] R = new int[n2];
for (int i = 0; i < n1; ++i)
L[i] = arr[l + i];
for (int j = 0; j < n2; ++j)
R[j] = arr[m + 1 + j];
int i = 0, j = 0;
int k = l;
while (i < n1 && j < n2) {
if (L[i] <= R[j]) {
arr[k] = L[i];
i++;
} else {
arr[k] = R[j];
j++;
}
k++;
}
while (i < n1) {
arr[k] = L[i];
i++;
k++;
}
while (j < n2) {
arr[k] = R[j];
j++;
k++;
}
printArray(arr, l, r);
}
public static void sort(int[] arr, int l, int r) {
if (l < r) {
int m = (l + r) / 2;
sort(arr, l, m);
sort(arr, m + 1, r);
merge(arr, l, m, r);
}
}
static void printArray(int[] arr, int l, int r) {
System.out.print("{");
for (int i = l; i <= r; ++i)
System.out.print(arr[i] + " ");
System.out.println("}");
}
public static void main(String[] args) {
int[] arr = {23, 14, 3, 56, 17, 8, 42, 18, 5};
sort(arr, 0, arr.length - 1);
}
}
Explanation:
See answer
Which of the following should be the first page of a report?
O Title page
Introduction
O Table of contents
Terms of reference
Answer:
Title page should be the first page of a report.
hope it helps!
Write a program that uses the map template class to compute a histogram of positive numbers entered by the user. The map’s key should be the number that is entered, and the value should be a counter of the number of times the key has been entered so far. Use –1 as a sentinel value to signal the end of user input.512355321-1Then the program should output the followings:The number 3 occurs 2 timesThe number 5 occurs 3 timesThe number 12 occurs 1 timesThe
Answer:
See explaination
Explanation:
#include <iostream>
#include <map>
#include <string>
#include <algorithm>
#include <cstdlib>
#include <iomanip>
using namespace std;
int main()
{
map<int, int> histogram;
int a=0;
while(a>=0)
{
cout << " enter value of a" ;
cin >>a;
histogram[a]++;
}
map<int,int>::iterator it;
for ( it=histogram.begin() ; it != histogram.end(); it++ )
{
cout << (*it).first << " occurs " << setw(3) << (*it).second << (((*it).second == 1) ? " time." : " times.") <<endl;
}
return 0;
}
(34+65+53+25+74+26+41+74+86+24+875+4+23+5432+453+6+42+43+21)°
Fill in the empty function so that it returns the sum of all the divisors of a number, without including it. A divisor is a number that divides into another without a remainder. in python
Program explanation:
In the given program code, a method "sum_divisors" is declared that takes "n" variable in its parameter.Inside the method, the "s" variable is declared, which holds a value which is "0", and used a for loop that defines counts the range values.In the loop, a conditional statement is declared that check remainder value equal to 0 and adds value in "s" variable and return its value.Program code:
def sum_divisors(n):#defining a method sum_divisors that takes a parameter
s = 0#defining a variable s that hold a value 0
for x in range(1,n):#defining a for loop that use n variable to check range value
if(n%x==0):#use if to check remainder value equal to 0
s += x#adding value in s variable
return s#return s value
print(sum_divisors(6))#calling method
print(sum_divisors(12))#calling method
Output:
Please find the attached file.
Learn more:
brainly.com/question/14704583