Starting from:

$30

MiniAssignment 1- Consider a set of n boxes

Consider a set of n boxes with their positions numbered from 1 to n.  Initially all the boxesare CLOSED. These n boxes are subject to modifications over n iterations as follows.  At the ithiterations the boxes at the positions whose ids are multiples of i are flipped,  i.e.  changed fromCLOSED to OPEN or vice-versa.  For example, at iteration 1, boxes at all positions are flipped,at iteration 2, boxes at positions 2,4,6,etc.  are flipped, at iteration 3, boxes at positions 3,6,9, etc.are flipped.Propose an algorithm for find out, that after n such iterations how many boxes will be OPEN.Note that the answer requires only how many boxes, not their positions.  Describe the rationalefor the algorithm, give the pseudocode, and its complexity.  Grading scheme:  (your grade will bebased on whichever class your algorithm falls in)

More products