panchadi520
BAN USER- 1of 1 vote
AnswersImplement a program to reverse the linear linked list in pairs. it should handle both even number of nodes and odd number of nodes. if odd number of nodes, the last node will be the last node after reversion.
- panchadi520 in India
Do not move the data in the nodes. Do manipulate node pointers/references. the nodes themselves need to be manipulated, not just the data in the nodes.
For example, if the initial linear linked is,
1->2->3->4->5
after reverse it should be,
2->1->4->3->5| Report Duplicate | Flag | PURGE
Amazon Senior Software Development Engineer Data Structures - 1of 1 vote
AnswersImplement a function that checks if the given binary tree is binary search tree(BST). Use tree operations to solve this. do not try solving by pre-order traversal of the tree and then checking if the array is sorted.
- panchadi520 in India
instead, traverse the tree for checking if it is BST.| Report Duplicate | Flag | PURGE
Amazon Senior Software Development Engineer Data Structures - 0of 2 votes
AnswersWrite a function that takes two arguments one array of integers that ranges between 0 and 9 and second the target sum(again integer). It produces all permutations strings of the input digits that equals the target sum.
- panchadi520 in India
For example, if input is array 2, 3, 5 and target sum is 10, then the output should be:
22222 because 2+2+2+2+2 = ,10
2323 as 2+3+2+3 = 10
3232
55
2233
3322
532
235
352
etc.,| Report Duplicate | Flag | PURGE
Amazon Senior Software Development Engineer Data Structures
There is no zero(0). just 1 - 9.
- panchadi520 April 28, 2015I put it as 0-9 by mistype. But actually it is from 1-9.