楼主: liuxf666
593 3

[学习笔记] 【学习笔记】Classical Computer Science Problems - small problems [推广有奖]

  • 1关注
  • 3粉丝

已卖:70份资源

学科带头人

54%

还不是VIP/贵宾

-

威望
0
论坛币
13005 个
通用积分
409.9229
学术水平
109 点
热心指数
112 点
信用等级
103 点
经验
71218 点
帖子
1079
精华
0
在线时间
1538 小时
注册时间
2016-7-19
最后登录
2024-6-8

楼主
liuxf666 发表于 2019-5-29 02:59:42 |AI写论文

+2 论坛币
k人 参与回答

经管之家送您一份

应届毕业生专属福利!

求职就业群
赵安豆老师微信:zhaoandou666

经管之家联合CDA

送您一个全额奖学金名额~ !

感谢您参与论坛问题回答

经管之家送您两个论坛币!

+2 论坛币
1 - The Fibonacci sequence
fib(0) = 0
fib(1) = 1
fib(n) = fib(n - 1) + fib(n - 2)

2 - Trivial compression
Compression is the act of taking data and encoding it (changing its form) in such a way that it takes up less space. Decompression is reversing the process, returning the data to its original form.
  • There is a tradeoff between time and space. It takes time to compress a piece of data and to decompress it back into its original form. Therefore, data compression only makes sense in situations where small size is prioritized over fast execution.

3 - Unbreakable encryption
A one-time pad is a way of encrypting a piece of data by combining it with meaningless random dummy data in such a way that the original cannot be reconstituted without access to both the product and the dummy data - In essence, this leaves the encrypter with a key pair. One key is the product, and the other is the random dummy data. One key on its own is useless; only the combination of both keys can unlock the original data. When performed correctly, a one-time pad is a form of unbreakable encryption.
  • One way of thinking about a Python 3 str is as a sequence of UTF-8 bytes. A str can be converted into a sequence of UTF-8 bytes (represented as the bytes type) through the encode() method. Likewise, a sequence of UTF-8 bytes can be converted back into a str using the decode() method on the bytes type.
  • Three criteria that the dummy data used in a one-time pad encryption operation must meet for the resulting product to be unbreakable.
    • same length as the original data
    • truly random
    • completely secret.

4 - Calculating pi
π = 4/1 - 4/3 + 4/5 - 4/7 + 4/9 - 4/11...

NOTE: This function is an example of how rote conversion between formula and programmatic code can be both simple and effective in modeling or simulating an interesting concept.

5 - The Towers of Hanoi

6 - Real-world applications
The techniques presented in this chapter (recursion, memoization, compression, and manipulation at the bit level)
  • Recursion is at the heart of not just many algorithms, but even whole programming languages. In some functional programming languages, like Scheme and Haskell, recursion takes the place of the loops used in imperative languages. It is worth remembering, though, that anything accomplishable with a recursive technique is also accomplishable with an iterative technique.
  • Memoization has been applied successfully to speed up the work of parsers (programs that interpret languages). It is useful in all problems where the result of a recent calculation will likely be asked for again. Another application of memoization is in language runtimes. Some language runtimes (versions of Prolog, for instance) will store the results of function calls automatically (auto-memoization), so that the function need not execute the next time the same call is made. This is similar to how the @lru_cache() decorator in fib6() worked.
  • Compression has made an internet-connected world constrained by bandwidth more tolerable. The bit-string technique is usable for real-world simple data types that have a limited number of possible values, for which even a byte is overkill. The majority of compression algorithms operate by finding patterns or structures within a data set that allow for repeated information to be eliminated.
  • One-time pads are not practical for general encryption. They require both the encrypter and the decrypter to have possession of one of the keys (the dummy data in our example) for the original data to be reconstructed, which is cumbersome and defeats the goal of most encryption schemes (keeping keys secret). But you may be interested to know that the name “one-time pad” comes from spies using real paper pads with dummy data on them to create encrypted communications during the Cold War. These techniques are programmatic building blocks that other algorithms are built on top of. In future chapters you will see them applied liberally.


二维码

扫码加我 拉你入群

请注明:姓名-公司-职位

以便审核进群资格,未注明则拒绝

关键词:Classical Problems Computer problem compute

已有 1 人评分论坛币 学术水平 热心指数 信用等级 收起 理由
经管之家编辑部 + 100 + 3 + 3 + 3 精彩帖子

总评分: 论坛币 + 100  学术水平 + 3  热心指数 + 3  信用等级 + 3   查看全部评分

本帖被以下文库推荐

沙发
经管之家编辑部 在职认证  发表于 2019-5-29 05:23:58
为您点赞!

藤椅
充实每一天 发表于 2019-5-29 05:28:35 来自手机
点赞

板凳
jessie68us 发表于 2019-5-29 11:34:04
来学习,点赞!

您需要登录后才可以回帖 登录 | 我要注册

本版微信群
扫码
拉您进交流群
GMT+8, 2026-2-17 23:10