Caesar Cipher in Python

Caesar Cipher is a simple encryption and obfuscation method. It’s a straightforward substitution cipher that replaces each plain text character with the obfuscated character obtained by shifting the plain text character a fixed number of positions in the alphabet. What is Cryptography? Before we introduce our first cryptographic algorithm, Caesar’s cipher, let’s first introduce cryptography … Read more

The Maximum Profit Algorithm in Python

This article presents an algorithmic problem with practical value for stock market analysis. For instance, suppose you are trading the cryptocurrency Ethereum. How much profit in dollars can you make by buying low and selling high based on historical data? Maximum Profit Basic Algorithm The max profit algorithm calculates the maximum profit you’d obtain by … Read more

Python Backtracking – A Helpful Guide with Video

You can check out the slides here (direct PDF link): Before we’ll dive into the algorithm and the Python implementation, let’s first skim over some related graph tutorials you may enjoy and that may help your understanding! Related Graph Tutorials This algorithm is part of our graph algorithm tutorials: Breadth-First Search (BFS) Algorithm in Python … Read more

Iterative vs. Recursive Binary Search Algorithms in Python

In this article, you鈥檒l learn about a basic algorithm, every computer scientist must know: the binary search algorithm. I have drawn the code from my NoStarch programming introductory book Python One-Liners: Applications Binary Search The algorithm has important practical applications in many basic data structures such as sets, trees, dictionaries, bags, bag trees, bag dictionaries, … Read more

The Shortest Quicksort Algorithm in Python

Quicksort is not only a popular question in many code interviews 鈥 asked by Google, Facebook, and Amazon 鈥 but also a practical sorting algorithm that is fast, concise, and readable. Because of its beauty, you won鈥檛 find many introductions to algorithms that don鈥檛 discuss the Quicksort algorithm. In this one-liner tutorial, you鈥檒l learn about … Read more