mirror of
https://github.com/TheAlgorithms/Python.git
synced 2024-11-23 21:11:08 +00:00
parent
dc50add8a7
commit
b203150ac4
|
@ -30,7 +30,7 @@ class LangtonsAnt:
|
|||
self.board = [[True] * width for _ in range(height)]
|
||||
self.ant_position: tuple[int, int] = (width // 2, height // 2)
|
||||
|
||||
# Initially pointing left (similar to the the wikipedia image)
|
||||
# Initially pointing left (similar to the wikipedia image)
|
||||
# (0 = 0° | 1 = 90° | 2 = 180 ° | 3 = 270°)
|
||||
self.ant_direction: int = 3
|
||||
|
||||
|
|
|
@ -1,9 +1,9 @@
|
|||
# Compression
|
||||
|
||||
Data compression is everywhere, you need it to store data without taking too much space.
|
||||
Either the compression lose some data (then we talk about lossy compression, such as .jpg) or it does not (and then it is lossless compression, such as .png)
|
||||
Either the compression loses some data (then we talk about lossy compression, such as .jpg) or it does not (and then it is lossless compression, such as .png)
|
||||
|
||||
Lossless compression is mainly used for archive purpose as it allow storing data without losing information about the file archived. On the other hand, lossy compression is used for transfer of file where quality isn't necessarily what is required (i.e: images on Twitter).
|
||||
Lossless compression is mainly used for archive purpose as it allows storing data without losing information about the file archived. On the other hand, lossy compression is used for transfer of file where quality isn't necessarily what is required (i.e: images on Twitter).
|
||||
|
||||
* <https://www.sciencedirect.com/topics/computer-science/compression-algorithm>
|
||||
* <https://en.wikipedia.org/wiki/Data_compression>
|
||||
|
|
|
@ -7,11 +7,11 @@ Unlike encryption, which is intended to protect data in transit, hashing is inte
|
|||
This is one of the first algorithms that has gained widespread acceptance. MD5 is hashing algorithm made by Ray Rivest that is known to suffer vulnerabilities. It was created in 1992 as the successor to MD4. Currently MD6 is in the works, but as of 2009 Rivest had removed it from NIST consideration for SHA-3.
|
||||
|
||||
### SHA
|
||||
SHA stands for Security Hashing Algorithm and it’s probably best known as the hashing algorithm used in most SSL/TLS cipher suites. A cipher suite is a collection of ciphers and algorithms that are used for SSL/TLS connections. SHA handles the hashing aspects. SHA-1, as we mentioned earlier, is now deprecated. SHA-2 is now mandatory. SHA-2 is sometimes known has SHA-256, though variants with longer bit lengths are also available.
|
||||
SHA stands for Security Hashing Algorithm and it’s probably best known as the hashing algorithm used in most SSL/TLS cipher suites. A cipher suite is a collection of ciphers and algorithms that are used for SSL/TLS connections. SHA handles the hashing aspects. SHA-1, as we mentioned earlier, is now deprecated. SHA-2 is now mandatory. SHA-2 is sometimes known as SHA-256, though variants with longer bit lengths are also available.
|
||||
|
||||
### SHA256
|
||||
SHA 256 is a member of the SHA 2 algorithm family, under which SHA stands for Secure Hash Algorithm. It was a collaborative effort between both the NSA and NIST to implement a successor to the SHA 1 family, which was beginning to lose potency against brute force attacks. It was published in 2001.
|
||||
The importance of the 256 in the name refers to the final hash digest value, i.e. the hash value will remain 256 bits regardless of the size of the plaintext/cleartext. Other algorithms in the SHA family are similar to SHA 256 in some ways.
|
||||
|
||||
### Luhn
|
||||
The Luhn algorithm, also renowned as the modulus 10 or mod 10 algorithm, is a straightforward checksum formula used to validate a wide range of identification numbers, including credit card numbers, IMEI numbers, and Canadian Social Insurance Numbers. A community of mathematicians developed the LUHN formula in the late 1960s. Companies offering credit cards quickly followed suit. Since the algorithm is in the public interest, anyone can use it. The algorithm is used by most credit cards and many government identification numbers as a simple method of differentiating valid figures from mistyped or otherwise incorrect numbers. It was created to guard against unintentional errors, not malicious attacks.
|
||||
The Luhn algorithm, also renowned as the modulus 10 or mod 10 algorithm, is a straightforward checksum formula used to validate a wide range of identification numbers, including credit card numbers, IMEI numbers, and Canadian Social Insurance Numbers. A community of mathematicians developed the LUHN formula in the late 1960s. Companies offering credit cards quickly followed suit. Since the algorithm is in the public interest, anyone can use it. The algorithm is used by most credit cards and many government identification numbers as a simple method of differentiating valid figures from mistyped or otherwise incorrect numbers. It was created to guard against unintentional errors, not malicious attacks.
|
||||
|
|
|
@ -4,7 +4,7 @@ is specified by the sorting algorithm. The most typical orders are lexical or nu
|
|||
of sorting lies in the fact that, if data is stored in a sorted manner, data searching can be highly optimised.
|
||||
Another use for sorting is to represent data in a more readable manner.
|
||||
|
||||
This section contains a lot of important algorithms that helps us to use sorting algorithms in various scenarios.
|
||||
This section contains a lot of important algorithms that help us to use sorting algorithms in various scenarios.
|
||||
## References
|
||||
* <https://www.tutorialspoint.com/python_data_structure/python_sorting_algorithms.htm>
|
||||
* <https://www.geeksforgeeks.org/sorting-algorithms-in-python>
|
||||
|
|
Loading…
Reference in New Issue
Block a user