Skip to main content

Posts

Showing posts with the label learn to code for free

Top & Bottom View Of a Binary Tree Made Easy!

In the previous blog, I wrote about finding Left & Right view of a Binary Tree . In this blog, I'm going to talk about Top & Bottom view of a binary tree and will again try to create a single approach that will solve both the problems so instead of understanding two different approaches we'll discuss a single approach for it. Firstly, let us understand " What is the Top/Bottom view of a binary tree? ". When a tree is viewed from the Top/Bottom then the only nodes visible from that particular view are printed/included in output. For example : For the above mentioned binary tree nodes in Top & Bottom View are as follows : Top View -> 4, 2, 1, 3, 6 Bottom View -> 4, 7, 5, 8, 6 Let's try to understand it for the top view and the bottom view will be similar with minor changes. Looking from the top 4 is visible so we've included it in our top view, similarly, 2 is visible so we've included it in our top view, 7 is getting overlapped by 2 so we...

How To Learn Any Programming Language Easily

Coding is not a Rocket Science which you'll find difficult to understand, it's simply like learning a new language to speak. First, you need to understand the alphabet (for example a-z / A-Z ).  Second, you need to learn some basic words and their meanings. Third, Try to form sentences by combining those words. Fourth, Repeat Steps Second & Third with a new set of words. Fifth, Practice and Practice until you are comfortable with it. The above-mentioned steps are nothing but an algorithm. An algorithm is a procedure that includes certain steps that help us to achieve the desired goal. Above mentioned algorithm for a programming language can be written as : First, you need to understand the alphabet supported by a language (for example ASCII ).  Second, you need to understand what are it's keywords i.e. words with a pre-defined meaning. ( for example string, char, int, main, long, double, cout, cin, typedef, etc.) Third, try to form meaning full state...