What are some good ways to represent a 2D array that extends in arbitrary length in both dimensions?
Working in Ruby.
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
I think a hash is good:
Or, to make it a less transparent but more efficient, you may think of a way to map a pair of numbers to a single number using a pairing function along the lines suggested here, and use it as a key: