Skip to main content

Posts

Showing posts from September, 2017

Quick Sort Algorithm using Recursion

Quick sort is one of the most important and widely used sorting algorithm. Quick sort is a very efficient algorithm which if implemented well can run two to three times faster than its competitors merge sort and and heap sort. The algorithm is a divide and conquer algorithm. The algorithm works by selecting a pivot element, this pivot element is usually the first element and choice of the pivot element affects the running time of the algorithm. The algorithm is basically to select a pivot element and then moving all the element less than the pivot element to its left and all the elements greater than pivot element to its right. Then we divide the array into 2 parts, one on the left of the pivot and other on the right of the pivot and then pass these 2 arrays to the algorithm for further sorting. Algorithm : Choose a Pivot element. Take 2 variables left_marker and right_marker excluding the pivot element. Set left_marker as the first element of the array Set right_marker as the

Installing python modules without pip

Ever wanted to install python modules, but you were unable to do it using pip install command, or simply wanted to do it using python, if so then this is the post you want to read.  pip module is now by default installed when you install the latest python, if you want to install multiple python modules you can either enter pip commands in command prompt or terminal or make a batch file, In this post, we will see how to install all the modules that you want by executing a python program. Lets look at the code,  In the above code you can simply put the modules you want to install in the list and execute the code. You might also be interested in  Data Encryption using Caesar Cipher Data Decryption using Caesar Cipher LCM of 2 numbers Anagram Strings Double Linked List Finding Middle node in a Linked List Infix to Prefix Conversion

Data decryption using Caesar Cipher

In the previous blog post we discussed about Encryption of a file using Caesar Cipher, in this post we discuss a method to decrypt the same file. If you want to view the previous post on Encryption using Caesar Cipher click HERE . Decryption is a process of decoding the encrypting the encrypted file, to do this we need to know 2 things, the first is the method of encryption and the second is cipher key which in this case is our shift value. once we know these things we can start deciphering the files.  As caesar cipher is a substitution cipher, shift value decides which value is replaced with another value, in encryption we replace each letter by the letter to its right by shift value position, hence now we need to do the opposite, we have to replace each letter by the letter to its left by shift value positions. So for shift value of 3 we have, Plaintext :          ABCDEFGHIJKLMNOPQRSTUVWXYZ  decipher text :     XYZ ABC DEFGHIJKLMNOPQRSTUVW Hence every 'a'