## vishgupta92

BAN USER- 1of 3 votes

AnswersGenerate all possible sorted arrays from alternate elements of two given sorted arrays.

- vishgupta92 in United States

Given two sorted arrays A and B, generate all possible arrays such that once first element is taken from A then from B then from A and so on in increasing order till the arrays exhausted. Then first element is taken from B then From A, and do same as above.| Report Duplicate | Flag | PURGE

Microsoft Software Engineer Algorithm

please tell me for that situation can dx or dy be negative as it'll follow dx+dy=k,

i.e dy will be more than k and dx will negative of difference of dy and k.

As per my knowledge trie store from the first character to last character in different level of trie, now please tell how "my" keyword will be find when it will come in as substring not from front.

please reply!!!

Where you have taken input as Jerry Position???

And please also tell me how distance formula will work here because there may be many block cell will be in the direct path between them??

make correction - hammingWeight[i] should be arr[i]

- vishgupta92 August 01, 2015Incorrect Solution!!! :(

- vishgupta92 August 01, 2015when array A (first) is taken first then.

10 15

10 15 20 30

10 15 20 35

10 15 30 35

10 20

10 20 30 35

10 30

10 35

20 30

20 35

30 35

when array B (second) is taken first then.

5 10

5 10 15 20

5 10 15 30

5 10 20 30

5 20

5 30

15 20

These are all outputs for your test case.

can you please provide the whole code or exaplain more clearly.

- vishgupta92 July 31, 2015Your Idea is Good, Please also tell me that how will you find Kth Rank Word from TreeMap?

- vishgupta92 July 13, 2015Following are some simpler versions of the problem:

If given Tree is Binary Search Tree?

If the given Binary Tree is Binary Search Tree, we can store it by either storing preorder or postorder traversal. In case of Binary Search Trees, only preorder or postorder traversal is sufficient to store structure information.

If given Binary Tree is Complete Tree?

A Binary Tree is complete if all levels are completely filled except possibly the last level and all nodes of last level are as left as possible (Binary Heaps are complete Binary Tree). For a complete Binary Tree, level order traversal is sufficient to store the tree. We know that the first node is root, next two nodes are nodes of next level, next four nodes are nodes of 2nd level and so on.

If given Binary Tree is Full Tree?

A full Binary is a Binary Tree where every node has either 0 or 2 children. It is easy to serialize such trees as every internal node has 2 children. We can simply store preorder traversal and store a bit with every node to indicate whether the node is an internal node or a leaf node.

How to store a general Binary Tree?

A simple solution is to store both Inorder and Preorder traversals. This solution requires requires space twice the size of Binary Tree.

Following are some simpler versions of the problem:

If given Tree is Binary Search Tree?

If the given Binary Tree is Binary Search Tree, we can store it by either storing preorder or postorder traversal. In case of Binary Search Trees, only preorder or postorder traversal is sufficient to store structure information.

If given Binary Tree is Complete Tree?

A Binary Tree is complete if all levels are completely filled except possibly the last level and all nodes of last level are as left as possible (Binary Heaps are complete Binary Tree). For a complete Binary Tree, level order traversal is sufficient to store the tree. We know that the first node is root, next two nodes are nodes of next level, next four nodes are nodes of 2nd level and so on.

If given Binary Tree is Full Tree?

A full Binary is a Binary Tree where every node has either 0 or 2 children. It is easy to serialize such trees as every internal node has 2 children. We can simply store preorder traversal and store a bit with every node to indicate whether the node is an internal node or a leaf node.

How to store a general Binary Tree?

A simple solution is to store both Inorder and Preorder traversals. This solution requires requires space twice the size of Binary Tree.

It looks like the Strassen's Matrix Multiplication problem..

- vishgupta92 July 07, 2015BaseAddress + sizeof(typeofArray)*( TotalNoOfColumns*X + Y)

this is a 2D array formula where X & Y desire position rowth and column

We can also simulate this problem into Graph, Where its Vertices are the dial Number(2,3,4,....9) and edges are{{2 -> A,B,C}, {3 ->D,E,F}.........}

and using the traversing Techniques it can print all possible permutation.

if m wrong plz give any suggestions

Do you Know the meaning of Large?

- vishgupta92 June 12, 2015#include<iostream>

using namespace std;

int main(){

int ar[1000],length,i,rightshift,temp;

cin>>length>>rightshift;

for(i=0;i<length;i++)

cin>>ar[i];

rightshift%=length;

for(i=0;i<length/2;i++){

temp=ar[i];

ar[i]=ar[(i+rightshift)%length];

ar[(i+rightshift)%length]=temp;

}

for(i=0;i<length;i++)

cout<<ar[i]<<" ";

return 0;

}

**CareerCup**is the world's biggest and best source for software engineering interview preparation. See all our resources.

Open Chat in New Window

- vishgupta92 August 17, 2015