Latest Article

How to create a subdomain for use with Blogger

 Not all sites are meant solely for blogging. Some websites only include a blog for marketing purposes only. This is because blogs can drive traffic to your site. Each site visitor is a potential customer who can end up buying products or services on the website. I am going to show you how you can create a subdomain that can then be used as a custom domain on Blogger. Creating a subdomain in CPanel Most web hosting companies in Zimbabwe provide packages that come with CPanel and therefore I shall use it as an example. It is easy to create a subdomain in CPanel. A subdomain has two main purposes. It can act be used to host a different website or to organize the main domain so as to improve the user experience. If your main domain is 'example.com', then a subdomain can be 'blog.example.com'. To create 'blog.example.com', simply lo into CPanel and head on to the section written 'subdomains'. Go on to create your subdomain by just entering the word 'blog

Recursion vs Loops, best overview.

Most reasons you find online about why we sometimes need to use recursion instead of loops are not compelling enough to persuade die hard loop fans to use recursion. If you are one of those people who resent or just can not understand why recursion is significant then this article will leave you with no doubt about why recursion is a must have tool. 

Let's look at loops. There are three types, the do while, while and for loop but no one questions why we need all three types instead of just one. This is because it is clear that each type has a place in programming. 

The programmer must have a wide variety of tools and must be versatile with all of them so as to choose the best tool. It reminds me of the  law of the instrument  that says if you only have a hammer , it is easy to see everything as a nail. A programmer should not ever be in such a situation. 

Each loop has a special purpose and so is recursion. Although in most cases recursion works just like a loop most programmers use it for making code readable or understandable, which is good for maintenance. However, recursion should be used sparingly especially if memory is scarce. 

The only situation I have found so far were recursion outshines loops is on BST traversal. A Binary Search Tree (BST) is a data structure which we use to store any kind of variables. When we need to retrieve the data we have to traverse , that is move from the root to the leaves as it is a tree structure, and therefore we need an efficient way to do so. Recursion saves the day when it comes to BST traversal. Inserting new nodes also require recursion for brevity otherwise you will write deep nested if statements and a while loop which you will spend hours trying to read and understand when you return to the project after a couple of days. 

Now you know why you should be conversant with recursions. If you need to watch recursion outdoing loops, checkout the solution to the infamous Tower of Hanoi. 

Comments

Popular posts from this blog

C Program To Calculate Water Bill

How to write and compile code as well as to publish android apps on a smartphone.

My top six social media apps