Jump to content

zak100

Senior Members
  • Posts

    233
  • Joined

  • Last visited

Everything posted by zak100

  1. Hi, Thanks for your reply. Please reply me about pseudopolynomial behavior for large values of 'n' for sorting algorithms like Bubble sort? Zulfi.
  2. I want to use cobertura for coverage. I followed the following link: https://electric-cloud.com/plugins/directory/p/cobertura/ That link provides a EC-Cobertura.jar file through download. I think it creates a parameter for passing arguments to cobertura. I am trying to run EC-Cobertura.jar but its giving me error: I have already downloaded the cobertura and its installed on my ubuntu 18.04. And it has the same version as the tar file provides whose link is : https://sourceforge.net/projects/cobertura/ provided in the link of the associated help button page: But the help file does not say anything about the jar file. I still don't know how to execute the jar file and how to display the form shown on the link: http://downloads.electric-cloud.com/plugins/EC-Cobertura/EC-Cobertura_help.xhtml Somebody please guide me how to display the form? What is the purpose of EC-Cobertura.jar in this connection. Zulfi.
  3. Hi, This is not a HW. Algorithm for prime number x 2<=I <= x -1, test whether x is divisable by i, Can we say that the running time is O(log^2 x) time, for large values of x can we say that the algorithm is a psedudo-polynimial time algorithm. From the internet, I found that the running time of algorithm to find prime number is O(sqrt(N)). I have 3 questions: Can we say that the running time is O(log^2N) for detection of Prime number? For large values of N, can we say that its a pseudo-polynomial algorithm? Is this true for Sorting algorithms also? Zulfi.
  4. Hi, I want to frame a Probability question for computer science students. I have got a simple idea but I want to refine it so that it becomes a more comprehensive real world problem. Let’s suppose there are 3 persons and each one is rewarded a gift but when he sees the gift he has got two options, he can either accept the gift or reject the gift. What is the probability that a person can reject the gift? Formula= number of successful outcomes/ Total number of equally likely outcomes = 1/2 At this point this is very simple. How the above can be converted into a more complex problem? Somebody please guide me.
  5. Hi, Thanks for your reply. <Advice: Wouldn't it be better to try to understand how the algorithm works rather than to try to untangle some specific example out of the many available on the net?> Actually I chose this example because I saw the attached graph. The following is very useful: When you are saying "can be carried" why are we not increasing the value and weight of knapsack. I mean in the else part, do we not need variables to hold the collective values of weight and values. Where are variables representing the total weight and value of knapsack? Kindly guide me. Zulfi.
  6. Hi, Thanks for your response. Okay lets start with row2 which is Table[1][*]. I am just concentrating on riptutorial Okay I understand this. But still I would add on for future reference: Table [1][1] = 2nd row. item 1 above means weight '1' item and item 2 means weight '3' item. Total weight for both item 1 & item 2 = 3 +1 =4 correct (as above) and exceeds the knapsack capacity because capacity was 1 in case of Table[1][1]. For Table[1][2], capacity =2. weight[2], if we are starting from 0 it should be weight[1] but they later clarified it that they mean second item. weight of current item = weight of 2nd item i.e. 3. At this point for Table[1][2] maximum capacity is 2 and current item i.e. the item with weight 3 is greater than the capacity 2. value from top =1 , correct, so they filled 1 in the table[1][2] which is correct. Now we would go ahead. capacity is 3 and current weight is 3, so they are correct. What are the 2 choices they are talking about? Which item are they talking about? Can you please explain me the rest of the stuff also i.e. Please guide me. Thanks for your cooperation. Zulfi.
  7. Hi, I am trying to understand knapsack problem from the following site: https://riptutorial.com/dynamic-programming/example/25787/0-1-knapsack-problem +----------+---+---+---+---+ | Item | 1 | 2 | 3 | 4 | +----------+---+---+---+---+ | Weight | 1 | 3 | 4 | 5 | +----------+---+---+---+---+ | Value | 1 | 4 | 5 | 7 | +----------+---+---+---+---+ n represents the number of items and w represents weight units. There should be n+1 rows and w+1 columns as discussed in the link: https://medium.com/@fabianterh/how-to-solve-the-knapsack-problem-with-dynamic-programming-eb88c706d3cf In the example we w = 7 and n= 4, therefore there should be 5 rows and 8 columns. There are 8 columns but only 4 rows. I can’t understand why they have 4 rows? Then the started filling the first column: Table[0][0], Table[1][0], Table[2][0], Table[3][0]. This will all be zeros, this is because capacity is zero in all the above cases. But for first row, I am confused: Table[0][0]: capacity is 0, so its 0 (OK) Table [0][1]: capacity is 1, so its 1 (OK) Table[0][2]: capacity is 2, but no item with weight 2, so 1 is fine Table[0][3]: capacity is 3, we have an item of weight 3 so we can write 3, but they wrote 1, I cn’t understand Some body please guide me. Zulfi.
×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.