YouTube URL algorithm?

后端 未结 11 1882
遇见更好的自我
遇见更好的自我 2020-12-04 09:39

How would you go about generating the unique video URL\'s that YouTube uses?

Example:

  • http://www.youtube.com/watch?v=CvUN8qg9lsk
11条回答
  •  我在风中等你
    2020-12-04 10:38

    I suggest using a perfect hash function:

    Perfect Hash Function for Human Readable Order Codes

    As the accepted answer indicates, take a number, then apply a sequence of "bijective" (or reversible) operations on the number to get a hashed number.

    The input numbers should be in sequence: 0, 1, 2, 3, and so on.

提交回复
热议问题