You need to log in or create an account to post to this user's Wall.
Venki commented on the post, The Painter’s Partition Problem Part I 11 months, 2 weeks ago
The code can be reduced one step further in the inner loop.
for (int i = 2; i <= k; i++) {
for (int j = 2; j <= n; j++) {
int best = M[j][i-1];
for (int p = 1; p <= j-1; p++) {
[…]Venki commented on the post, Clone Graph Part I 11 months, 3 weeks ago
Oh, okay. I got it. Thanks. I face the above problem when I tried to create few test cases. But it worked fine for the partial graph. To add further, we can extend the Node structure with second level pointer that […]
Venki commented on the post, Clone Graph Part I 11 months, 3 weeks ago
@1337c0d3r,
I am not clear about graph representation. If the graph is having more than one SCC, how can it be represented using Node structure? For example, a directed graph with four nodes, A, B, C and D. […]
Venki and 1337c0d3r are now friends 1 year ago
Venki commented on the post, Double Square Problem Analysis 1 year, 1 month ago
The precision issue in the second approach can be avoided using equation (don’t use any double expect for finding upper limit of loop),
M + 2*X*Y = (X + Y)^2
Any values of X and Y that satisfy above can be […]
Venki commented on the post, Print Edge Nodes (Boundary) of a Binary Tree 1 year, 1 month ago
Some how the previous code was not fully printed, here is the code
#include
using namespace std;struct Node
{
Node(int data) : key(data), lChild(NULL), rChild(NULL)
{}int key;
[…]Venki commented on the post, Print Edge Nodes (Boundary) of a Binary Tree 1 year, 1 month ago
By “boundary” I would expect those nodes that can be seen if any one stands on left side, down side and right side of the tree. In technical terms boundary includes left view, bottom view and right view of a […]
Venki commented on the post, Printing a Binary Tree in Level Order 1 year, 1 month ago
The question is about just the level order traversal, why do we need two queues?
Venki joined the group Google Interview 1 year, 1 month ago
You forgot to update the indices when there is valid set in the IF clause. Add l++, r– inside the IF clause it will solve the issue.
Venki commented on the post, Binary Search Tree In-Order Traversal Iterative Solution 1 year, 1 month ago
Your explanation is impressive. Thanks for your effort.
Venki commented on the post, Binary Search Tree In-Order Traversal Iterative Solution 1 year, 1 month ago
Dear 1337c0d3r,
Here is the code without flag. Comments please…1. Go to left extreme, push nodes on the way
2. Start pop-off and process each node till stack exhausts
3. If pop-ed off node has a right […]Venkateswara Rao Sanaka became a registered member 1 year, 6 months ago
- 1 person likes this.
