imalamuneer2001

imalamuneer2001

Lv1

imalamuneer2001

0 Followers
0 Following
0 Helped

ANSWERS

Published7

Subjects

Project Management1History2Management1English1Psychology1Computer Science1
Answer: Developing a Stress Reduction Plan Stress can have a significant impac...

The Problem: Implement the recursive multiplication algorithm in Lecture 8 (slide 14 ) and Section 5.5 (p. 233 ) of our textbook. Note: test your code carefully - subtle considerations need to be taken with stopping conditions, which the textbook does not address.

The Recursive Multiplication:
Algorithm:
1: function Recursive-Multiply (x,y)
2: x=2^(⌊n/2⌋)x_h + x_ℓ
3: y=2^(⌊n/2⌋)y_h + y_ℓ
4: c_x = x_h + x_ℓ
5: c_y = y_h + y_ℓ
6: z_h = Recursive-Multiply (x_h, y_h)
7: z_c = Recursive-Multiply (c_x, c_y)
8: z_ℓ = Recursive-Multiply (x_ℓ, y_ℓ)
9: return 2^(2⌊n/2⌋)z_h + 2(⌊n/2⌋)(z_c − z_h − z_ℓ) + z_ℓ
- Note that we can perform multiplication by 2^x via left shift
- We can also obtain x_h, x_ℓ, y_h, and y_ℓ with AND and MOD
- These are O(n), as is the addition we will need to use (i.e. we have a constant number of O(n) operations, and thus have O(n) runtime overall at the level of each function call)
- Since we split the input in half and now have only three recursive calls, our recurrence becomes T(n)=3T(n/2)+O(n)
- And this has O(n^(log_2(3))) ≈ O(n^1.59), which strictly improves upon the 'grade-school' multiplication

Important: Do not use multi-threading, or any other form of parallelism, for the individual recursive function calls. The grading program expects your output in a format produced by a recursive but non-parallel algorithm. Use of parallelism in function calls will cause the autograder to deem your solution incorrect.

The Input Format: Your program will be expected to read input from a text file, the name of which should be passed as the first parameter to your program on command line invocation. All 'integers' discussed from here on out can be expected to be UTF-8 string representations of said numbers (i.e. as one would find in a .csv file). The input will come in two lines, each representing a single positive integer.

Your Program's Output: Your program will be expected to output a text file named output.txt, in UTF-8 format as described above. Call the number on the first line of the input file x, and the number on the second line of the input file y. Then each line of the output file will contain the state of one of your function calls just before the non-stopping condition return call. This line will contain the following positive integers, in the order indicated, with each separated by a single comma: n_s, x_h, x_ℓ, y_h, y_ℓ, z_h, z_c, z_l where:
- n_s is the number of bits at which you split the inputs
- x_h and y_h are the high bits of x and y respectively
- x_ℓ and y_ℓ are the low bits of x and y respectively
- z_h is the result returned by your recursive multiplication call on x_h ⋅ y_h
- z_c is the result returned by your recursive multiplication call on (x_h + x_ℓ ) ⋅ (y_h + y_ℓ)
- z_l is the result returned by your recursive multiplication call on x_ℓ ⋅ y_ℓ
- That is, we can write:
- x = 2^(n_s) x_h + x_ℓ
- y=2^(n_s) y_h + y_ℓ
- x ⋅ y = z = 2^(2n_s) z_h + 2^(n_s)(z_c − z_h − z_ℓ) + z_ℓ

Some points:
- The input and output format is in (UTF-8\ASCII string) base-10.
- The following examples assume you treat the numbers as binary once they are stored as unsigned integers
- When you split the input, the difference between between the number of bits in the high half and low half should be one if n is odd, and zero if n is even
- The following examples choose the value of n_s based on the minimum of x and y
- The following examples assume that n_s ≤1 is the stopping condition if for odd n, the lower half has more bits
- The following examples assume that n_s = 0 is the stopping condition if for odd n, the higher half has more bits
- The recursions were called in this order: (a) First center, z_c, (b) Second high, z_h, (c) Third low, z_ℓ

Examples:
Here is what the output looks like if for odd n, the lower half has more bits:

Input:
17
11
Output:
2, 1, 1, 1, 1, 1, 4, 1
2, 4, 1, 2, 3, 8, 25, 3

Input:
45
27
Output:
2, 2, 2, 1, 2, 2, 12, 4
3, 5, 5, 3, 3, 15, 60, 15

Input:
192
237
Output:
2, 3, 0, 6, 3, 18, 27, 0
2, 3, 0, 3, 2, 9, 15, 0
14, 12, 0, 14, 13, 168, 324, 0

Write code in Python (python 3.8.10)

Answer: Recursive Multiplication Algorithm: Define a function, recursiveMultip...
Answer: My grandmother is a fitness enthusiast. A memorable encounter on my hi...

PART  2:

 

PURPOSE:

 

The purpose of this assignment is to demonstrate the use of digital technology to support and enhance in managing occupational safety and health issues.

 

REQUIREMENT:

 

The manufacturing industry can pose a range of hazards to workers, depending on the specific type of manufacturing involved. 

 

The production of plastic in the industry typically involves the following steps:

 

  1. Raw material selection: The first step in making plastic is selecting the raw materials.
  2. Polymerisation: The selected raw materials are then subjected to polymerisation, which involves chemically bonding the individual molecules together to create long chains of polymers. This process can be carried out in several ways, such as by using heat, pressure, or a catalyst.
  • Additives: After polymerisation, various additives are added to the polymer to modify its properties, such as color, strength and flexibility. These additives can include pigments, stabilisers, and plasticisers.
  1. Processing: Once the plastic material has been produced and the additives have been added, it can be processed into the desired shape. This can be done through a variety of methods such as injection molding, blow molding, extrusion, or thermoforming.
  2. Quality Control: Finally, the finished plastic products are subjected to quality control testing to ensure that they meet the required specifications and standards.

 

Based on the above processes, perform the following tasks:

 

  • Identify the hazards associated with each step of the plastic manufacturing process.
  • Propose the control measures for each of the identifiedy hazards.
  • Prepare ONE (1) E-safe operating procedure (E-SOP) which include all the processes.
Answer: Identifying hazards and proposing control measures for each step of th...
Answer: option DExplanation:The book "Rajatarangini," which chronicles the his...
Answer: option A Step-by-step explanation:Mumtaz Mahal's real name was Arjuman...
Answer:Fisher and Ury's book "Getting to Yes" presented the idea of principled...

Weekly leaderboard

Start filling in the gaps now
Log in