In this article, you’ll learn about a basic algorithm, every computer scientist must know: the binary search algorithm. The algorithm has important practical applications in many basic data structures such as sets, trees, dictionaries, bags, bag trees, bag dictionaries, hash sets, hash tables, maps, and arrays. You use these data structures in every single non-trivial program (and in many trivial …

## The Shortest Quicksort Implementation in Python

In this one-liner tutorial, you’ll learn about the popular sorting algorithm Quicksort. Surprisingly, a single line of Python code is all you need to write the Quicksort algorithm! The Basics 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 …

## A Simple Python Factorial Program Using Recursion

This article explains a simple and effective way of computing the factorial in a single line of code. The Basics Consider the following problem: There are 20 football teams in England’s premier league. Each team can possibly reach any of the 20 ranks at the end of the season. How many possible rankings exist in the premier league, given 20 …

## Fibonacci in One Line Python

When I googled “Fibonacci Python” today, I found a lot of algorithms (most of them easy to understand). But I wondered — is there a Python one-liner to find Fibonacci numbers in the most concise way? As it turns out, there is! Read on to learn how to write the Fibonacci algorithm in one line of Python code. The popular …

## The Sieve of Eratosthenes in One Line of Python

Finding prime numbers is of critical importance for practical applications such as cryptography. Many public-key methods are only safe (from a cryptographic point of view) because it’s generally inefficient and slow to compute the prime factors of large numbers. A Simple Algorithm to Check Whether a Number is Prime A prime number n is an integer number that is not …

## Check Palindromes in One Line Python. No For Loop. No Recursion.

This one-liner introduces another basic computer science term: palindromes. Similarly to anagrams, palindromes are a popular interview question. First things first: What is a palindrome? “A palindrome is a word, number, phrase, or other sequence of characters which reads the same backward as forward, such as madam or racecar or the number 10201.“ [1] Here are a few fun examples: …

## Anagrams in Python: A Simple One-Liner Solution

A popular question in programming interviews is about anagrams. The interviewer wants to test your knowledge about the basic terminology in computer science, and how good you are at developing your own simple algorithms to solve the problems you are facing. In this article, you’ll learn about a simple algorithm to find anagrams in Python. Most students who have pursued …

## How to Earn $4000/M Passive Income as a Coder?

Everybody talks about passive income these days. Is it a scam? Yes and no. Nothing can truly exist passively for an unlimited time. True passive income really means: a more or less slowly dying income stream. But the idea is still powerful and transformative. And there are a lot of income streams that are much more passive than others. If …

## Get More Clients as a Freelance Developer with This One Simple Trick

How to make it easier as a freelance programmer to attract clients? You’ve mastered the first level as a freelance programmer and wonder how to make it easier to get clients? Or you’re generally interested in becoming a freelancer but you don’t know how to get clients? Here’s a major building block of your success: Create your own freelancer website …

## Fight Programmer Procrastination! A Simple Hack From Bevahioral Psychology

How to overcome procrastination? Procrastination may easily be the reason number one why you are not reaching your goals. You set your alarm clock in the evening and expect your future self in the morning to get up, go the gym, do some sports, eat healthy, maybe write or code a little bit. Fast forward a few hours, the alarm …

## Freelance Developers: How to Earn $$$ As a Beginner Level 2

Working on Upwork, Freelancer.com, or Topcoder is not the only way of earning money to do some valuable work. In this video, I tell you an alternative way of earning money (almost) from day one. And I also explain why this strategy works: The links from the video to my freelancer courses: Free Webinar: How to Build Your High-Income Skill …

## Massive Action — A Foolproof Way to Find Clients as a Freelance Programmer

How to really find clients on freelancing platforms such as Upwork, Freelancer.com, or Topcoder? This article shows you a simple idea of how to find clients. It’s a statistically sound way of increasing your odds greatly. I recently read the “10x” book by Grant Cardone. In his book, he invented the concept of taking massive action towards a goal. Massive …