Back to Browse

[Algorithm Trick] Encoding Matrix Position Into A Single Value

236 views
Mar 6, 2020
6:17

Link to webpage: https://www.srcmake.com/home/encode-matrix-positions A matrix is a 2-dimensional array, and each element in the array is represented by a row position and a column position. However, having two keys to represent one element is inconvenient for certain algorithms, such as being able to create a hash map to represent each element in the matrix. In this video, we go over a trick to encode the position (i,j) for an element into a single value. We go through a diagram together for the encoding and decoding formulas, and then we look at some C++ code that implements the encodePosition and decodeValue functions. Twitter: https://twitter.com/srcmake Twitch: https://www.twitch.tv/srcmake Discord: https://discord.gg/q5vAET3

Download

0 formats

No download links available.

[Algorithm Trick] Encoding Matrix Position Into A Single Value | NatokHD