saran
BAN USERstudent
 0of 0 votes
AnswersGiiiven a matrix of 1's and 0's, display a matrix which contains minimum distance to reach nearest 0 for that particular position.
 saran in India for Sooftware
Example:
Input: 1 0 1
1 1 1
1 1 1
Ouutput:
1 0 1
2 1 2
3 2 3 Report Duplicate  Flag  PURGE
Morgan Stanley Software Analyst Algorithm  2of 2 votes
AnswersIn the given sorted array, find the number of positions of the number that are not in sorted order
 saran in India Report Duplicate  Flag  PURGE
Chronus Intern Arrays  2of 2 votes
Answershow much memory can calloc and malloc can allocate???
 saran in India Report Duplicate  Flag  PURGE
Samsung C  1of 1 vote
AnswersGiven a BST convert it into new Data Structure that satisfies following conditions:
 saran in India
1. every leaf node's left ptr point to its parent and right ptr points to the next leaf
2. every non leaf node's left ptr points to its parent and right ptr is NULL
3. return the head and print the new DS
example:
7
/ \
5 9
/ \ \
4 6 10
output:
head>4>5>7

>6>5>7

>10>97
with optimal time and space complexity Report Duplicate  Flag  PURGE
Groupon Intern Trees and Graphs  0of 0 votes
AnswersGiven an array, return true, if it can be partitioned into two subarrays whose sum of elements are same, else return false
 saran in India
Example:
Input: {5,1,5,11}
Output: true (as it can be divided into {5,1,5} {11} where 5+1+5=11) Report Duplicate  Flag  PURGE
Groupon Intern Arrays  2of 2 votes
Answersc program to find square root of an interger without using in built functions
 saran in India Report Duplicate  Flag  PURGE
Amazon Intern C  1of 1 vote
Answerscreate the mirror tree for the given BST, provided with the root node of the tree
 saran in United States Report Duplicate  Flag  PURGE
Amazon Intern Trees and Graphs  0of 0 votes
Answersreverse the doubly linked list without using extra space
 saran in United States Report Duplicate  Flag  PURGE
Amazon Intern Linked Lists
**TO FIND THE LAST AND MIDDLE NODE**
1. use the fast and slow pointer to find a node in loop
2. count the number of nodes in the loop
3. if the count is k then ther are two possibilities
1. there are k+(k1) nodes in sll
2. there are 2k nodes in sll
4. with this find the middle and last node of the sll
**DELETE THE GIVEN NODE**
now the delete the node, and point the last node to
1. if length of sll is odd, to the previous node
2. if even point to the next node
comment if anything wrong.
Open Chat in New Window
but @Viva, how your solution comes???
 saran August 14, 2013return must be ncount
and if the no of 1's are greater than 0's???