15,902,635 members
Home / Discussions / C / C++ / MFC

# C / C++ / MFC

 Re: create a dpi-aware application Theo Buys7-Nov-17 2:09 Theo Buys 7-Nov-17 2:09
 Re: create a dpi-aware application Richard MacCutchan7-Nov-17 3:27 Richard MacCutchan 7-Nov-17 3:27
 Re: create a dpi-aware application Gisle Vanem7-Nov-17 19:35 Gisle Vanem 7-Nov-17 19:35
 Re: create a dpi-aware application Theo Buys17-Dec-18 22:36 Theo Buys 17-Dec-18 22:36
 Can we define the Right control key as an ACCELERATOR in the resource file ? Maximilien3-Nov-17 10:12 Maximilien 3-Nov-17 10:12
 Re: Can we define the Right control key as an ACCELERATOR in the resource file ? Richard MacCutchan5-Nov-17 2:09 Richard MacCutchan 5-Nov-17 2:09
 Re: Can we define the Right control key as an ACCELERATOR in the resource file ? Maximilien7-Nov-17 5:48 Maximilien 7-Nov-17 5:48
 Find maximun range of an array Member 135010212-Nov-17 22:35 Member 13501021 2-Nov-17 22:35
 Greetings, i have a problem finding a solution for this algorithm: i have to find the maximun range in an unordered array (i cant order the array). An example will be: +--------------------------+ | 100 | -10 | -10 | -10 | 100 | --> this sould return the range 0-4 +--------------------------+ +-----------------+ | -7 | 5 | -1 | 9 | -6 | --> this sould return the range 1-3 +-----------------+ +-----------------+ | -7 | 5 | -6 | 9 | -6 | --> this sould return the range 3-3 +-----------------+ I dont have problems doing the algorithm in O(n^2) but i need to do this algoithm in O(n), can anyone help me? Cuadratic algorithm: C++ ```void maximunSegment(vector &V, int &start, int &end){ int i = 0, j = 0, r = 0, aux = 0; start = 0; end = 0; while(i < V.size()){ j = i; while(j < V.size() - 1){ aux += V[j]; if(aux >= r){ r = aux; start = i + 1; end = j + 1; } ++j; } aux = 0; ++i; } }``` IMPORTANTE NOTE: the positions of the array are important, i mean that the content of V[i] is linked to that i (if v[3] = 89, that 89 always have to refered to v[3] even if you change the array you need to remember that this 89 was on position 3), so if you reorder the array you need to keep that reference. Thank you so much.
 Re: Find maximun range of an array David Crow3-Nov-17 3:51 David Crow 3-Nov-17 3:51
 Re: Find maximun range of an array Sascha Lefèvre3-Nov-17 4:22 Sascha Lefèvre 3-Nov-17 4:22
 Re: Find maximun range of an array Sascha Lefèvre3-Nov-17 14:17 Sascha Lefèvre 3-Nov-17 14:17
 Calculate sum of M natural numbers starting from N. Member 134789861-Nov-17 9:16 Member 13478986 1-Nov-17 9:16
 Re: Calculate sum of M natural numbers starting from N. Victor Nijegorodov1-Nov-17 9:49 Victor Nijegorodov 1-Nov-17 9:49
 Re: Calculate sum of M natural numbers starting from N. Member 134789861-Nov-17 10:19 Member 13478986 1-Nov-17 10:19
 Re: Calculate sum of M natural numbers starting from N. CPallini1-Nov-17 10:53 CPallini 1-Nov-17 10:53
 Re: Calculate sum of M natural numbers starting from N. Member 134789861-Nov-17 10:57 Member 13478986 1-Nov-17 10:57
 [win32] sprite error ? bluatigro1-Nov-17 3:03 bluatigro 1-Nov-17 3:03
 Re: [win32] sprite error ? Richard MacCutchan1-Nov-17 3:18 Richard MacCutchan 1-Nov-17 3:18
 Re: [win32] sprite error ? Jochen Arndt1-Nov-17 3:26 Jochen Arndt 1-Nov-17 3:26
 Re: [win32] sprite error ? David Crow1-Nov-17 3:32 David Crow 1-Nov-17 3:32
 Re: [win32] sprite error ? bluatigro2-Nov-17 0:13 bluatigro 2-Nov-17 0:13
 Re: [win32] sprite error ? bluatigro2-Nov-17 1:01 bluatigro 2-Nov-17 1:01
 Re: [win32] sprite error ? Richard MacCutchan2-Nov-17 1:46 Richard MacCutchan 2-Nov-17 1:46
 Re: [win32] sprite error ? bluatigro3-Nov-17 0:09 bluatigro 3-Nov-17 0:09
 Re: [win32] sprite error ? Richard MacCutchan3-Nov-17 0:28 Richard MacCutchan 3-Nov-17 0:28
 Last Visit: 31-Dec-99 18:00     Last Update: 21-May-24 5:36 Refresh ᐊ Prev1...327328329330331332333334335336 Next ᐅ