# Radix Sort

Consider an array that stores account numbers of all employees. One unique thing about account numbers is that they have equal number of digits. Let us take example where, account numbers are three digits long, and array has 6 account numbers are shown below int arr[ ] = {582, 675, 591, 189, 900, 770} Range […]

Given a binary tree, where each node is having an integer value. Write a function that accept the root of this tree and returns the sum of all the nodes in the tree. The sum of all the nodes in the

Given a binary matrix with all rows and col sorted. Write code to count the number of zeros in that matrix. For example, if the matrix is [0, 0, 0, 0, 1] [0, 0, 0, 1, 1] [0, 1, 1, 1, 1] [0, 1, 1, 1, 1] [1, 1, 1, 1, 1] Then output should […]

We have seen the in-order traversal of a binary tree. It is a recursive code. Recursion stack can be simulated using an explicit Stack data structure and keeping the function non-recursive. Let us see how:

Write code to print the right-view of a binary tree. Right-view of the tree is the nodes visible when the tree is seen from the right side. If there are two nodes at the same level, then only the right-most node will be visible in the right-view as shown below:

Write code to print the left-view of a binary tree. Left-view of the tree is the nodes visible when the tree is seen from the left side. If there are two nodes at the same level, then only the left-most node will be visible in the left-view as shown below:

Two elements of complex data types are not directly comparable. Consider the student structure defined as below struct Student { int rollNo; char name[25]; char grade; }; Student arr[MAX_NUM_STUDENTS]; Objects of Student type are not directly comparable. To sort array arr, we need to specify how one student compares with another student. If there are […]

I visit many colleges and universities (mostly technical). Following is my feedback:

Given a pointer to the root node of the tree, write code to find if it is an Almost Complete Binary Tree or not? A Binary Tree of depth d is Almost Complete iff: The tree is Complete Binary Tree (All nodes) till level (d-1). At level d, (i.e the last level), if a Node […]

What improvement has java-8 made that performance of HashMap.get() function call is fast by 20% in Java-8.