Home > Back-end > Urgent urgent Joseph ring, updated version
Urgent urgent Joseph ring, updated version
Time:09-22
N individual (numbered 1, 2, 3,... , n (n> 0)) clockwise around a circle, each holding a positive integer code, at the beginning of any given two values: a person for the first number off the serial number of the I (0 & lt; i<=n), and the other as the starting count off limits on m, then from the Numbers for the I began since 1 clockwise order number off, stop count off when reporting for m, and report to m people break the ranks, and his password as the new m values, in a clockwise direction from him on the next person to count off from 1,... Stand out and so on, until all the people, asked to design a program simulate this process, give dequeue serial number sequence,
CodePudding user response:
Can be done with a linked list
CodePudding user response:
Positive integer code is random values or given in advance? Using an array or a list simulation can,
CodePudding user response:
1) the number of n positive integers each password, count off one number for the first time I, on the initial count off limits m all by keyboard input, 2) respectively by sequential storage structure and chain store structure implementation of Joseph ring