Find a triplet from three linked lists with sum equal to a given number | GeeksforGeeks Sorting can ...

Please Visit: http://ift.tt/1ajReyV



Find a triplet from three linked lists with sum equal to a given number | GeeksforGeeks

Sorting can be used to reduce the time complexity to O(n*n). Following are the detailed steps.

1) Sort list b in ascending order, and list c in descending order.

2) After the b and c are sorted, one by one pick an element from list a and find the pair by traversing both b and c. See isSumSorted() in the following code.

http://ift.tt/1Al3grS

http://ift.tt/1rUnpQQ



Find a triplet from three linked lists with sum equal to a given number | GeeksforGeeks







from Public RSS-Feed of Jeffery yuan. Created with the PIXELMECHANICS 'GPlusRSS-Webtool' at http://gplusrss.com http://ift.tt/1Al3iQp

via LifeLong Community

No comments:

Post a Comment