[wpdm_package id=’1256′] Sample Input – Write a program to draw line with stipple patterns. Sample Output – [sourcecode lang=”cpp”] glEnable(GL_LINE_STIPPLE); glLineStipple(1,0x00ff); glBegin(GL_LINES); glVertex2f(100,100); glVertex2f(600,600); glEnd();…

[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())…

[wpdm_package id=’1363′] Algorithm: Use Recursion. Find the left node and corresponding right node each time using recursion. Swap the nodes. [sourcecode lang=”cpp”] void MirrorOfBinaryTree(tree_node *root)…

Question – How do we implement 2 Stacks using 1 Array? One stack routines should not show a exception unless every slot in array is…

[wpdm_package id=’1365′] Algorithm: Use Recursion. Store the data in each path in an array while you traverse. Traverse the left subtree and the right subtree.…

[wpdm_package id=’1349′] Algorithm: Use recursion. Find the height of the left subtree. Find the height of the right subtree. Check which is maximum. The maximum…

[wpdm_package id=’1421′] Question – Reverse a string Conditions – i. I have to reverse word by word. ii. When I reverse a word the Last…