Check if binary tree is a sum tree
In this tutorial we shall check if the tree is a sum tree or not. Problem Statement: You are given the root node of a binary tree. You need to check if that tree is a sum tree or not. Example: Consider...
View ArticleAdd all the node values in a Binary Tree or Sum of a Binary tree
In this chapter, we shall see how to add all the nodes value. Problem Statement: Given a binary tree root node, return the sum of all the nodes of the tree. Example: Consider the tree below: The total...
View ArticlePrint the number of leaf nodes in a binary tree
In this chapter we shall print the number of leaf nodes in a binary tree. Problem Statement: You are given the root node of the tree. You need to return the total number of leaf nodes present in that...
View ArticlePrint all the paths from root node to leaf node
In this chapter we shall see how to print all the paths from root to leaf nodes. Problem Statement: You are given the root node of a binary tree, you need to print all the paths from root node to leaf...
View ArticlePrint the nodes at k distance from the root of a binary tree
In this tutorial we shall see how to print all the nodes that is k distance from root. Problem statement: Given the root node and the distance k, print all the nodes that are at distance k from root...
View ArticleDynamic Programming: Longest Increasing Subsequence
In this tutorial we shall look at longest increasing subsequence and we shall solve it by using Dynamic Programming. Problem Statement: You are given an array of integers; you need to find the longest...
View ArticleLongest Bitonic Subsequence
In this tutorial we shall solve longest Bitonic subsequence using DP. Before solving the question, let’s understand what does Bitonic means. Bitonic is a sequence where the number increases at certain...
View ArticleGet Max Coin In Game problem.
In this chapter we shall solve how to get maximum coin in a game problem with help of DP. Problem Statement: You and your friend are playing a game to pick numbers from an array of even length. You...
View ArticleRod Cutting Problem
In this tutorial we shall learn about rod cutting problem. Problem statement: You are given a rod of length n and you need to cut the cod in such a way that you need to sell It for maximum profit. You...
View ArticleC++ 11 feature: reinterpret_cast
“reinterpret_cast” has been introduced in C++ 11. This cast should be carefully used. * reinterpret_cast is used to convert one pointer to another pointer of any other type. * It will not check if the...
View ArticleC++ 11 and 14 feature lambda expression
Lambda function is used for functional programming. In this chapter we shall learn about lambda functions. Lambda expressions are used to define an anonymous function object or closure. In C++ a simple...
View ArticleC++ 11 feature: Parameter Pack and Variadic Templates
Parameter Pack: Parameter pack is the new feature in C++11. “…” is the syntax to create a parameter pack or to expand one . Parameter pack is used to pack multiple parameters into single parameter....
View ArticleC++ 11 feature: Forwarding References
Forwarding Reference is a new feature in C++11. They are also called as Universal References. It means, it will binds to both lvalues and rvalues. We will see in example further below. Forwarding...
View ArticleC++ 11 feature: Initializer Lists and Static Assertions
In this chapter we shall study 2 new concepts of C++. 1. Initializer List 2. Static Assertions 1. Initializer List It is used to initialize data members of a class or to create a container of elements....
View ArticleShell Scripting Tutorial: Introduction to shell script
In this introduction chapter, we shall look at below topics 1.1 Now what is a shell script? 1.2 what are the uses of shell script? 1.3 How to create a shell script? 1.4 Writing your first shell script...
View ArticleShell Scripting Tutorial: Shell Script Variables
In shell script there is no need to declare a variable before using it. A variable is a name given to memory location, which is used to store a value. The value can be accessed by variable name for...
View ArticleShell Scripting Tutorial: Shell Script reading from user input and passing...
To read an input from the user, use the “read” command. The read command will take the input from the user and assigns to a variable. Syntax: read <variable_name> example: read website_name read...
View ArticleShell Scripting Tutorial: Special Operators
In this chapter we shall know about some special operators, which makes shell script powerful while writing and executing the scripts. 4.1. Redirectors 4.2. Pipes 4.3. exit status 4.4. Shell Special...
View Article