ScratchData LogoScratchData
Back to Layzej's profile

A good hash for permutations?

LALayzej•Created October 28, 2014
A good hash for permutations?
2
1
172 views
View on Scratch

Instructions

Contains code to generate and hash permutations. Not sure if that is of use to anyone but... Click generate permutations to generate all permutations of the numbers 1 and 2. Click it again for permutations of 1,2, and 3. Click it again for permutations of 1,2,3, and 4... etc. There is a hash algorithm that will assign a unique number to each permutation. The Hash Permutations button will add each permutation to a list at the position assigned by the hash algorithm.

Description

I needed a good way to hash permutations for my game of eight solver. I didn't come up with this method until after I completed the solver. This would have been a better solution. This hash algorithm is pretty good because there are no collisions and no gaps. It's not so good because it is not super efficient.

Project Details

Project ID31723840
CreatedOctober 28, 2014
Last ModifiedJanuary 6, 2021
SharedOctober 30, 2014
Visibilityvisible
CommentsAllowed