Click here to Skip to main content
15,895,084 members
Home / Discussions / Algorithms
   

Algorithms

 
GeneralRe: Trapezoid interpolation Pin
Patrice T9-Feb-17 11:45
mvePatrice T9-Feb-17 11:45 
GeneralRe: Trapezoid interpolation Pin
Joan M9-Feb-17 21:57
professionalJoan M9-Feb-17 21:57 
GeneralRe: Trapezoid interpolation Pin
Patrice T9-Feb-17 22:53
mvePatrice T9-Feb-17 22:53 
GeneralRe: Trapezoid interpolation Pin
Joan M9-Feb-17 23:10
professionalJoan M9-Feb-17 23:10 
GeneralRe: Trapezoid interpolation Pin
Patrice T9-Feb-17 23:21
mvePatrice T9-Feb-17 23:21 
GeneralRe: Trapezoid interpolation Pin
Joan M9-Feb-17 23:28
professionalJoan M9-Feb-17 23:28 
GeneralRe: Trapezoid interpolation Pin
Joan M12-Feb-17 3:03
professionalJoan M12-Feb-17 3:03 
QuestionLongest subarray: minimum first element, maximum last element Pin
Member 105660894-Feb-17 23:44
Member 105660894-Feb-17 23:44 
I have to write a program that, given an array of n numbers, finds the longest contiguous subarray whose minimum is the first element of the subarray and maximum the last element of the subarray. For example, with [5, 18, 2, 12, 4, 7, 13, -2, -5, 12] the answer should be [2, 12, 4, 7, 13] (2 <= of all the elements of the subarray, 13 >= of all the elements of the subarray). If possible, the time complexity in the worst case has to be equal to O(n). If it isn't possible, could you explain me why? I already tried to find the minimums and then the maximums, but doesn't work with arrays like [-1,12,1,2,3,4]. I also tried to split the array when there is an element followed by a smaller element and then merge the subarrays, but it doesn't work for arrays like [2,15,6,10,3,20].

modified 5-Feb-17 6:11am.

AnswerRe: Longest subarray: minimum first element, maximum last element Pin
Richard Andrew x645-Feb-17 3:25
professionalRichard Andrew x645-Feb-17 3:25 
QuestionRe: Longest subarray: minimum first element, maximum last element Pin
Member 105660895-Feb-17 3:28
Member 105660895-Feb-17 3:28 
AnswerRe: Longest subarray: minimum first element, maximum last element Pin
Patrice T8-Feb-17 9:42
mvePatrice T8-Feb-17 9:42 
AnswerRe: Longest subarray: minimum first element, maximum last element Pin
Patrice T8-Feb-17 9:52
mvePatrice T8-Feb-17 9:52 
GeneralRe: Longest subarray: minimum first element, maximum last element Pin
Member 105660898-Feb-17 10:10
Member 105660898-Feb-17 10:10 
GeneralRe: Longest subarray: minimum first element, maximum last element Pin
Patrice T8-Feb-17 10:56
mvePatrice T8-Feb-17 10:56 
GeneralRe: Longest subarray: minimum first element, maximum last element Pin
Member 105660898-Feb-17 15:15
Member 105660898-Feb-17 15:15 
QuestionAccounting aging algorithm help Pin
kimbhoot26-Jan-17 5:52
kimbhoot26-Jan-17 5:52 
AnswerRe: Accounting aging algorithm help Pin
Gerry Schmitz26-Jan-17 7:08
mveGerry Schmitz26-Jan-17 7:08 
GeneralRe: Accounting aging algorithm help Pin
kimbhoot26-Jan-17 10:51
kimbhoot26-Jan-17 10:51 
GeneralRe: Accounting aging algorithm help Pin
Gerry Schmitz26-Jan-17 11:04
mveGerry Schmitz26-Jan-17 11:04 
GeneralSo I Wrote A Backward Version Of KMP Algorithm In C# That Searches String From Right Pin
Robert Vandenberg Huang9-Jan-17 18:30
professionalRobert Vandenberg Huang9-Jan-17 18:30 
GeneralRe: So I Wrote A Backward Version Of KMP Algorithm In C# That Searches String From Right Pin
Gerry Schmitz26-Jan-17 7:18
mveGerry Schmitz26-Jan-17 7:18 
QuestionMachine Learning for a translation algorithm between numbers and words Pin
Member 1291942623-Dec-16 4:52
Member 1291942623-Dec-16 4:52 
AnswerRe: Machine Learning for a translation algorithm between numbers and words Pin
Richard MacCutchan23-Dec-16 5:06
mveRichard MacCutchan23-Dec-16 5:06 
GeneralRe: Machine Learning for a translation algorithm between numbers and words Pin
Member 1291942623-Dec-16 5:37
Member 1291942623-Dec-16 5:37 
GeneralRe: Machine Learning for a translation algorithm between numbers and words Pin
Nathan Minier23-Dec-16 6:19
professionalNathan Minier23-Dec-16 6:19 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.