Question

4 points HunlerDM3 4.5.o04 19 My Notes Let x and n be integers greater than 1. Consider the following algorithm. t0,50 for E

(Please type the answer on computer because I find it difficult to read most of the handwritings!)

0 0
Add a comment Improve this question Transcribed image text
Answer #1

j loop increase the value of t by nx as it add x ifor each j and j aply for n times.

Hence for i = 1 the t become nx.

And for i = 2 it becomes 2nx and so on.. So the value of t after the program will be xnx as j loop apply to t for x times.

And for each time after the j loop it adds the value of t to s so the value of s will be nx for i = 1, s = nx + 2nx for i = 2 and so on... So after the program the value of s = nx+2nx+3nx+...+xnx = nx²(x+1)/2

Hence the value of s when x = 4 and n = 6 is 6×4×4×(4+1)/2 = 240.

And the total number of addition is x(n+1) as ofor each i there is n times addition in j loop and 1 addition for s.

Add a comment
Know the answer?
Add Answer to:
(Please type the answer on computer because I find it difficult to read most of the...
Your Answer:

Post as a guest

Your Name:

What's your source?

Earn Coins

Coins can be redeemed for fabulous gifts.

Not the answer you're looking for? Ask your own homework help question. Our experts will answer your question WITHIN MINUTES for Free.
Similar Homework Help Questions
  • (Please type the answer on computer because I find it difficult to read most of the...

    (Please type the answer on computer because I find it difficult to read most of the handwritings!) My Notes -4 points HunterDM3 4.5.007 22 1. Consider the following pseudocode segment. Let n for E(1, ,10 do nent for E1, 2,., n} do atatement for kE (1, 2, 3, 4} do for E (1, 2, statement , n} do (a) Which statement gets executed the most number times? (b) Suppose that statement A requires 9n comparison operations, B requires n comparisons,...

  • (Please type the answer on computer because I find it difficult to read most of the...

    (Please type the answer on computer because I find it difficult to read most of the handwritings!) o-4 points HunterDM3 4.1.007. My Notes 2 License plates in India begin with a code that identifies the state and district where the vehicle is registered, and this code is followed ya four-digit identification number. These identification numbers are given sequentially, starting with 0000, 0001, 0002, etc. Once this sequence reaches 9999, letter from the set (A, , Z) is added (in order),...

  • MATLAB ONLY!! PLEASE WRITE IN COMPUTER SO I CAN COPY PASTE!!! ANSWER COMPLETELY, USE FOR LOOPS....

    MATLAB ONLY!! PLEASE WRITE IN COMPUTER SO I CAN COPY PASTE!!! ANSWER COMPLETELY, USE FOR LOOPS. THE PROGRAM TO BE MODIFIED IS THE NEXT ONE: clc clear % Approximate the value of e ^ x using the Taylor Series x = input( 'Enter the value of x for e^x. x = ' ); t = input( 'Enter the amount of desired terms. t = ' ); i = 1; e_taylor = 0; % initializing the variable for the accumulator while...

  • please help answer this case study (Please type the answer because I could not read when...

    please help answer this case study (Please type the answer because I could not read when you write on the paper) Help to answer these question in this case study Case Study Gastrointestinal Hemorrhage Scenario You are the nurse on duty on the intermediate care unit, and you are scheduled to take the next admission. The emergency department (ED) nurse calls to give you the following report: “This is Barb in the ED, and we have a 42-year-old man, K.L.,...

  • Please help. I need a very simple code. For a CS 1 class. Write a program...

    Please help. I need a very simple code. For a CS 1 class. Write a program in Java and run it in BlueJ according to the following specifications: The program reads a text file with student records (first name, last name and grade). Then it prompts the user to enter a command, executes the command and loops. The commands are the following: "printall" - prints all student records (first name, last name, grade). "firstname name" - prints all students with...

  • hello there, i have to implement this on java processing. can someone please help me regarding...

    hello there, i have to implement this on java processing. can someone please help me regarding that? thanks War is the name of a popular children’s card game. There are many variants. After playing War with a friend for over an hour, they argue that this game must never end . However! You are convinced that it will end. As a budding computer scientist, you decide to build a simulator to find out for sure! You will implement the logic...

  • What is the role of polymorphism? Question options: Polymorphism allows a programmer to manipulate objects that...

    What is the role of polymorphism? Question options: Polymorphism allows a programmer to manipulate objects that share a set of tasks, even though the tasks are executed in different ways. Polymorphism allows a programmer to use a subclass object in place of a superclass object. Polymorphism allows a subclass to override a superclass method by providing a completely new implementation. Polymorphism allows a subclass to extend a superclass method by performing the superclass task plus some additional work. Assume that...

  • K-means clustering K-means clustering is a very well-known method of clustering unlabeled data. The simplicity of...

    K-means clustering K-means clustering is a very well-known method of clustering unlabeled data. The simplicity of the process made it popular to data analysts. The task is to form clusters of similar data objects (points, properties etc.). When the dataset given is unlabeled, we try to make some conclusion about the data by forming clusters. Now, the number of clusters can be pre-determined and number of points can have any range. The main idea behind the process is finding nearest...

  • Hello, i need help with this homework: Code provided: public class DirectedWeightedExampleSlide18 { public static void...

    Hello, i need help with this homework: Code provided: public class DirectedWeightedExampleSlide18 { public static void main(String[] args) { int currentVertex, userChoice; Scanner input = new Scanner(System.in); // create graph using your WeightedGraph based on author's Graph WeightedGraph myGraph = new WeightedGraph(4); // add labels myGraph.setLabel(0,"Spot zero"); myGraph.setLabel(1,"Spot one"); myGraph.setLabel(2,"Spot two"); myGraph.setLabel(3,"Spot three"); // Add each edge (this directed Graph has 5 edges, // so we add 5 edges) myGraph.addEdge(0,2,9); myGraph.addEdge(1,0,7); myGraph.addEdge(2,3,12); myGraph.addEdge(3,0,15); myGraph.addEdge(3,1,6); // let's pretend we are on...

  • You need not run Python programs on a computer in solving the following problems. Place your...

    You need not run Python programs on a computer in solving the following problems. Place your answers into separate "text" files using the names indicated on each problem. Please create your text files using the same text editor that you use for your .py files. Answer submitted in another file format such as .doc, .pages, .rtf, or.pdf will lose least one point per problem! [1] 3 points Use file math.txt What is the precise output from the following code? bar...

ADVERTISEMENT
Free Homework Help App
Download From Google Play
Scan Your Homework
to Get Instant Free Answers
Need Online Homework Help?
Ask a Question
Get Answers For Free
Most questions answered within 3 hours.
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT