Recent content by DrAlexMV

  1. D

    Calculating number of steps in multiple loop piece of code

    This is much more abstract than that. For i = 1, 2, ..., n For j = i + 1, i + 2, ..., n Add up array entries A[i] through A[j] Store the result in B[i, j] Endfor Endfor For example, the outer loop: For i = 1, 2, ..., n Runs n times The second loop: For j = i + 1, i + 2, ..., n...
  2. D

    Calculating number of steps in multiple loop piece of code

    The T(n) for the stackoverflow post is the one for this particular exercise. It does not relate to the asymptotic bounds, but to the exact number of steps. With this T(n) you can calculate any asymptotic bound.
  3. D

    Calculating number of steps in multiple loop piece of code

    So how should I approach this problem? I need to know the T(n) so I can derive the best-case estimate for this algorithm.
  4. D

    Calculating number of steps in multiple loop piece of code

    It should, but this algorithm comes from the book.
  5. D

    Calculating number of steps in multiple loop piece of code

    Homework Statement The following pseudocode demonstrates an algorithm to create a 2D array from a 1D array by adding elements into certain rows: For i = 1, 2, ..., n For j = i + 1, i + 2, ..., n Add up array entries A[i] through A[j] Store the result in B[i, j] Endfor...
  6. D

    How to Find the Volume of a Rotating Solid?

    Homework Statement Region: f(x) = 2 sin x on the interval [0, π]. Find the volume of the 3D solid obtained by rotating this region about the dashed line y = −1. Homework Equations Integration of pi∫(2sin(x) + 1)^2 dx The Attempt at a Solution...
  7. D

    Efficient Algorithm for Solving CNF/DNF Logic Problem with 9 Input Literals

    Disjunctive normal form and Conjunctive normal form
  8. D

    Efficient Algorithm for Solving CNF/DNF Logic Problem with 9 Input Literals

    Homework Statement There exists a function f. Assume that you are given f's CNF representation and f's DNF representation. The CNF representation has some number of clauses, and each clause has 3 literals. The DNF representation has some number of terms where each term has 3 literals. The...
  9. D

    Probability Midterm Question: Fruit row counting

    I am actually not sure how to combine these without counting things more twice. Could you aid me through that?
  10. D

    Probability Midterm Question: Fruit row counting

    Homework Statement You have 10 pieces of fruits of which 1 is an orange, 1 is an apple, 1 is a pear, and 1 is a peach. How many ways are there to organize them in a row if the apples and oranges must be together and the pears and peaches cannot be together. Homework Equations Mostly...
  11. D

    Solving a 5-Digit Probability Problem Using Combinations

    Could you elaborate on what you mean by "one or two pairs the same, etc"?
  12. D

    Solving a 5-Digit Probability Problem Using Combinations

    Problem Statement: How many 5 digit number can be formed from the integers 1,2, ..., 9 if no digit can appear more than twice? Approach: 18!/((2!*9)(18-5)!) Reason: Using the combination formula, we were able to approach this problem by saying that there are 18...
  13. D

    Proof: a/b + b/a is Int iff a=b

    Yes, I saw that whenever you told me to prove that p|b. Thank you a lot, this proof really made me think for some reason.
  14. D

    Proof: a/b + b/a is Int iff a=b

    Would this work? a^2 + b^2 = pj where j is an element of the integers a = pw where w is an element of the integers Then: p^2w^2 + b^2 = pj we reorganize to: b^2 = p(j - pw^2) we let j - pw^2 = v where v is an element of the integers so b^2 = pv that implies p|b^2...
Back
Top