斐波那契(从递归,到优化递归,到迭代)
压缩字符
“ATG” 24bits => 001110 6bits
a = 1
a<<2
a|=0b00
Unbreakable encryption
def decrypt(key1: int, key2: int) -> str:
decrypted: int = key1 ^ key2 # XOR
temp: bytes = decrypted.to_bytes((decrypted.bit_length()+ 7) // 8, "big")
return temp.decode()
Calculating PI
π = 4/1 - 4/3 + 4/5 - 4/7 + 4/9 - 4/11…
汉诺塔
1 Move the upper n-1 discs from tower A to B (the temporary tower), using C as
the in-between.
2 Move the single lowest disc from A to C.
3 Move the n-1 discs from tower B to C, using A as the in-between.
本文深入探讨了多种算法原理,包括斐波那契数列的不同实现方式(递归、优化递归及迭代),字符压缩技术如将“ATG”压缩为24bits,Unbreakable加密算法的解密过程,以及通过级数求解圆周率π的方法。同时,还介绍了经典的汉诺塔问题及其解决策略。
349

被折叠的 条评论
为什么被折叠?



