recategorized by
242 views
0 votes
0 votes
Have to find MAX of aj-ai in an array where j>=i+l in linear time.How to do it?My approach is to start j from l+1 to n and check min element every time is it a correct way to do it?

when j = l+1 we check only 1st elemrent and for j = l+2 next 2 element and so on

Is this approach is right?
recategorized by

Please log in or register to answer this question.

Related questions

0 votes
0 votes
1 answer
2
Souvik33 asked Apr 2, 2023
435 views
There are Insert and Retrieve_Max operations on a set {}. for n such operations what is the time complexity of the efficient algorithm possible?$n^{2}$nlogn n logn
3 votes
3 votes
2 answers
3
sh!va asked Jul 21, 2016
2,379 views
Given a linked list :1->2->3->4->5->6,make the following changes1->6->2->5->3->4What would be the most effiicient way to make this change?
0 votes
0 votes
1 answer
4
Amoljadhav asked Mar 1
138 views
how many spanning trees are possible for complete graph of 4 vertices