[wpdm_package id=’1400′] Question: You are given a decimal number x as input. If g(x) is defined as number of 1s in the binary representation of…
We had Verizon placement test at our college. It comprised of 4 rounds. CS, ECE and EEE branches were eligible to attend with a cutoff…
During the month of Septeber We attended Infosys On-Campus placements. Infosys had 2 rounds. 1st was the Online test and 2nd was the technical Interview.…
We had a placement test for Samsung R&D at our college. The first round was an online test which was 30 minutes long and comprising…
[wpdm_package id=’1352′] Algorithm: Use Recursion. If both the trees are NULL, return true. If only one of the trees is NULL return false. Recursively find…
[wpdm_package id=’1354′] Algorithm: [sourcecode lang=”cpp”] void DeleteBinaryTree(tree_node *root) { if(!root) return; DeleteBinaryTree(root->left); DeleteBinaryTree(root->right); free(root); } [/sourcecode]
[wpdm_package id=’1359′] Algorithm: Return true if both the trees are empty. Return false if only one of the tree is empty. Return false if root…
[wpdm_package id=’1361′] Algorithm: [sourcecode lang=”cpp”] int FindLevelWithMaxSum() { tree_node *temp; int level=0, maxLevel=0; std::queue<tree_node *> Q; int currentSum=0, maxSum=0; if(!root) return 0; Q.push(root); Q.push(NULL); while(!Q.empty())…