Here we find the smallest element in the list and swap it with the first element. Then the second smallest, swapping with second element and so on. This is done till (n-1) times. And number of swaps required is n-1.
5 4 3 2 1
1 4 3 2 5
1 2 3 4 5
1 2 3 4 5
Well, the time complexity is O(n*n) which is same as https://sowmyaravidas.wordpress.com/2012/10/06/bubble-sort/
But selection is better since number of swaps required is less.
void selection_sort(int unsorted,int number_of_elements)
Complete implementation of the code can be found at https://github.com/sowmyaravidas/Sorting-Algorithms
This is a brute force method of sorting. Compare the successive elements from position 1 to last. This is one
iteration. Do till (n-1) times.
5 4 3 2 1
4 5 3 2 1
4 3 5 2 1
4 3 2 5 1
4 3 2 1 5
This is iteration1. So at the end, maximum element moves to the end.
The time complexity of this algorithm is O(n*n).
void bubble_sort(int unsorted,int n)
Complete implementation can be found at https://github.com/sowmyaravidas/Sorting-Algorithms
You are provided with a picture and you need to crack the md5 of it.
Well … Just try saving the pic. By default it will be saved with md5 value as the name.
We could try decrypting it using http://www.md5decrypter.co.uk/. This would give you the solution 😀
This is a really nice algorithm to find out factors of an odd integer, which could be represented as the difference
between two squares. This algorithm works even when n is a large integer. So, this could be an easy way to determine p and q in RSA decryption when n is sufficiently large.
Given a number .
Fermat’s factorization methods look for integers and such that . Then it can be represented as
and is factored.
Every positive odd integer can be represented in the form by writing (with ) and noting that this gives
Adding and subtracting,
so solving for and gives
Consider an example:
So, n can be represented as:
n=4^2 – 1^2
n=(4+1)(4-1) = 5*3
x=1/2(a+b) = 4
y=1/2(a-b) = 1
x^2 – y^2 = 16 – 1 = 15 = ab.
Now, ssh firstname.lastname@example.org
The password is R****N.
- Level Info:
Substitution ciphers are a simple replacement algorithm. In this example of a substitution cipher, we will explore a ‘monoalphebetic’ cipher. Monoalphebetic means, literally, “one alphabet” and you will see why.
This level contains an old form of cipher called a ‘Caesar Cipher’. A Caesar cipher shifts the alphabet by a set number. For example:
plain: a b c d e f g h i j k … cipher: G H I J K L M N O P Q …
In this example, the letter ‘a’ in plaintext is replaced by a ‘G’ in the ciphertext so, for example, the plaintext ‘bad’ becomes ‘HGJ’ in ciphertext.
The password for level 3 is in the file krypton3. It is in 5 letter group ciphertext. It is encrypted with a Caesar Cipher. Without any further information, this cipher text may be difficult to break. You do not have direct access to the key, however you do have access to a program that will encrypt anything you wish to give it using the key. If you think logically, this is completely easy.
One shot can solve it!
Alrite! Question seems to be a bit long. So we need to perform caesar shift to get the password.
The file Krypton3 contains the encrypted password: OMQEMDUEQMEK
Use the code https://sowmyaravidas.wordpress.com/2012/09/15/encryption-code-for-caesar-cipher/ here
with proper indentation to decrypt it. This helps you generate all the possibilities:
You got the password for next level!!