
Data Structure
Networking
RDBMS
Operating System
Java
MS Excel
iOS
HTML
CSS
Android
Python
C Programming
C++
C#
MongoDB
MySQL
Javascript
PHP
- Selected Reading
- UPSC IAS Exams Notes
- Developer's Best Practices
- Questions and Answers
- Effective Resume Writing
- HR Interview Questions
- Computer Glossary
- Who is Who
Found 7197 Articles for C++

2K+ Views
Given a Binary Tree, the task is to check whether it is a Full Binary Tree or not. A Binary Tree is said to be a Full Binary Tree if every node has zero or two children.For ExampleInput-1Output:1Explanation: Every node except the leaf node has two children, so it is a full binary tree.Input-2: Output:0Explanation: Node 2 has only one child, so it is not a full binary tree.Approach to Solve this ProblemTo check whether a given binary tree is full or not, we can check recursively for the left subtree and right subtree.Input a given Binary Tree having nodes and its children.A ... Read More

2K+ Views
A sorted and rotated array is an array that is sorted in ascending or descending order and then rotated either left or right by a specific number of elements. There should exist exactly one pivot point around which the array is rotated. The array can be said to be split into two halves and each half is a sorted array. For example: {5, 6, 7, 1, 2, 3} is a sorted and rotated array and {5, 6, 7, 8, 2, 5, 4, 5} is not a sorted and rotated array. In this article, our task is to check if the ... Read More

385 Views
In a binary tree, each node contains two children, i.e., left child and right child. Let us suppose we have two binary trees and the task is to check if one of the tree can be obtained by flipping another tree by left of it or not.A Tree is Isomorphic if it can be obtained by flipping the other tree in its left side.For ExampleInput-1Output: IsomorphicExplanation: The given Tree-2 can be obtained by flipping the Tree-1 in the left side, thus the Tree is isomorphic.Approach to Solve this ProblemA recursive approach to solve this particular problem is that a Boolean function will ... Read More

1K+ Views
In a given matrix, there are four objects to analyze the element position: left, right, bottom and top.Breadth First Search is nothing but finding the shortest distance between the two elements of a given 2-D Matrix. Thus in each cell, there are four operations we can perform which can be expressed in four numerals such as, '2' describes that the cell in the matrix is Source.'3' describes that the cell in the matrix is Destination.'1' describes that the cell can be moved further in a direction.'0' describes that the cell in the matrix can not be moved in any direction.On ... Read More

343 Views
Let us consider that we have the root node of a binary tree; the task is to find and return the sum of tilt of every node.The tilt of a binary tree is nothing but constructing the binary tree by finding the absolute difference of child nodes in the left subtree and the right subtree in each level. At some particular level, the nodes which don't have any child nodes, we simply tilt by replacing that node with zero.ExampleInputOutput: 15Explanation: Finding the tilt at every level of the given binary tree, The tilt of node 3 = 0The tilt of node ... Read More

2K+ Views
The Timsort is a stable sorting algorithm that uses the idea of merge sort and insertion sort. It can also be called as a hybrid algorithm of insertion and merge sort. It is widely used in Java, Python, C, and C++ inbuilt sort algorithms. The idea behind this algorithm is to sort small chunks using insertion sort and then merge all the big chunks using the merge function of the merge sort algorithm.WorkingIn this algorithm, the array is divided into small chunks. The chunks are known as RUN. Each RUN is taken and sorted using the insertion sort technique. After ... Read More

223 Views
Delannoy Numbers − A Delannoy number D describes the number of paths from the southwest corner(0, 0) to northeast corner(a, b) in a rectangular grid using only allowed steps east ( →), northeast ( ↗ ) and north ( ↑ ).Thus, we can say that a recurrence relation is, D(a, b) = D(a-1, b) + D(a, b-1) + D(a-1, b-1) where D(0, 0)=1.For example, the Delannoy number D(3, 3) equals 63.Algorithm to find the Delannoy NumberTake two coordinates (a, b) as Input.An Integer function generateDelannoy(int a, int b) which takes coordinates ‘a’ and ‘b’ as input.In the base case, we ... Read More

2K+ Views
Given an IP Address, the task is to validate this IP address and check whether it is IPv6 or not with the help of ReGex(Regular Expression). If the IP Address is valid then print “IPv6 Address” otherwise print “Not”.A valid IPv4 address is an IP in the form "XXXX:XXXX:XXXX:XXXX:XXXX:XXXX:XXXX:XXXX" where each Xi digit is a hexadecimal digit. For example, Input-1 −IP= “3001:0da8:82a3:0:0:8B2E:0270:7224”Output −“Not”Explanation − This is not a valid IPv6 address, return “Not”.Input-2 −IP= “2001:0db8:85a3:0000:0000:8a2e:0370:7334”Output −“IPv6”Explanation − This is a valid IPv6 Address, return “IPv6”.Approach to solve this problemTo check whether the given IP address is IPv6 or not, we ... Read More

2K+ Views
Given an IP Address, the task is to validate this IP address and check whether it is IPv4 or not with the help of ReGex(Regular Expression). If the IP Address is valid then print “IPv4 Address” otherwise print “Not”.A valid IPv4 address is an IP in the form "X1.X2.X3.X4" where 0

3K+ Views
Let’s suppose we’ve given a 9×9 matrix called a Sudoku. The task is to check whether the given Sudoku Pattern is valid or not.In general, a Sudoku board look like this, Rules of Sudoku −Every row contains a number in the range 1-9Every column contains numbers in the range 1-9.Each block of 3×3 contains unique numbers in it.A particular row cannot have the same number.A particular column cannot have the same number.For ExampleInput-1 −sudoku[]= [["3", "5", ".", ".", "2", ".", ".", ".", "."] , ["7", ".", ".", "1", "6", "5", ".", ".", "."] , [".", "9", "8", ... Read More