Month: October 2013

Computer Graphics – Lab 19 Line with Stipple Patterns

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(); glFlush(); glDisable(GL_LINE_STIPPLE); [/sourcecode] To compile the above… Read more »

Find the level with Maximum Sum in a Binary Tree

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()) { temp=Q.front(); Q.pop(); if(temp==NULL) { if(currentSum>maxSum) {… Read more »