Questions about splitting and saving several numbers

Source: Internet
Author: User
If there are five numbers: 1, 2, 3, 4, 5, the algorithm is used to split and save several numbers into an array, the result is as follows: Array, 3, 4, 5 array, 3, 5 array, 2, 3, 4, 5 array, 2, 4 a total of 4 arrays, my goal is to put these 5 numbers in the four arrays each number appears 3 times, in this way, an array does not exist and all numbers can be retrieved from other arrays. Algorithms for splitting and saving several numbers
If there are five numbers: 1, 2, 3, 4, 5, to save to the array, the result is as follows:

Array, 5
Array 2: 1, 3, 5
Array
Array

There are 4 arrays in total. my goal is to display these 5 numbers three times in each of the four arrays, so that an array does not exist, all numbers can be retrieved from other arrays.

I don't need code. I just need to think about it. thank you.





------ Solution --------------------
Think about it, you are not raid5. you have a lot of redundancy in this solution.
To organize data like this, you can read data when any two groups of data are lost.
However, the organizational structure is slightly different from yours.
PHP code
$ Ar = array (, 5), array (, 5), array (, 5), array (, 4), array, 0),); unset ($ ar [3]); unset ($ ar [1]); for ($ I = 0; $ I <5; $ I ++) {$ m = 0; foreach ($ ar as $ v) $ m | = $ v [$ I]; echo $ m ;}
------ Solution --------------------
PHP code
    

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.