PieterWinter
Your method has a complexity of n^2 as well. Rather going from the beginning of the sequence like one would do in 2 nested loops, you go from behind, which is absolutely the same. Best Regards,
aphrodita@mail.krovatka.ru {uiuc rules}
http://www.hellforge.org
Would recursive function be enough for you to solve it?
Me thinks people come here to ask to solve their hw for them :] Best Regards,
aphrodita@mail.krovatka.ru {uiuc rules}
http://www.hellforge.org
haha, I was about to start explaining how to do it in MFC, but then I saw your request. I am not very familiar with WinAPI, but I am sort of getting ready to start learning it and here is a link where you could start too.
http://www.relisoft.com/Win32/controls.html
sorry if it did not help...
pParentWnd should be equal to "this" if you are creating the button in the window constructor.
The other thing is that passing "1" as the ID of the button may not be a good idea, because all values from 0-99 are reserved for the system. Best Regards...
to vlakas1981:
Consider this sequence: 1,3,5,8,15,20,21,27 and number S = 26, which is the sum of 5 and 21 that are in the opposite halves of the array if you divide it your way.
Jeka
it will be worth to check if the sequence is in superincreasing order. That will solve your problem very...
The problem is sorting the 2-dim array, which your treatment does not show. Converting it to 1-dim, sorting, converting back is a solution that does not require much manipulation. Best Regards,
aphrodita@mail.krovatka.ru {uiuc rules}
http://www.hellforge.org
Convert this double array into single one, so you have it like this:
1 2 8 -1 -2 3 -1 1 4 -2 -1 2
then sort it the way one would sort one dimensional array, picking 2 last elements if its going to be descending. Best Regards,
aphrodita@mail.krovatka.ru {uiuc rules}...
http://indigo.ie/~mscott/
that's one of the libraries people use especially with big numbers. There is a help file included. Best Regards,
aphrodita@mail.krovatka.ru {uiuc rules}
http://www.hellforge.org
I commented out the code that uses dereferenced pointers, the one I left is what I think you need. Both work nonetheless.
===<code>
#include <iostream.h>
void swapP(int* pa, int* pb);
int main()
{
int a = 5;
int b = 3;
int* pa = &a;
int* pb = &b;
cout << (*pa) << " " <<...
class Node
{
protected:
int value;
Node* leftChild;
Node* rightChild;
Node* parent;
public:
Node();
...
};
// constructor for the class
Node::Node()
{
value = 0;
leftChild = rightChild = parent = NULL;
}
===
That's the only place where you need to make the parent...
You have to have 2 pointers, one that points to the beginning char, the other to the last one.
...
char palWord[30];
char *f = palWord,*r = palWord + strlen(palWord) - 1;
...
Then you put it in a loop, increasing f {f ++}, decreasing r {r --}; and compare, if (*f != *r) printf("It's not...
You have to read in the string that user specifies. Here is some code for you:
#include <stdio.h>
#include <string.h>
typedef struct dialing_code {
char country[19];
int code;
};
int main(void)
{
const struct dialing_code country_codes[] = {{"Argentina"...
This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
By continuing to use this site, you are consenting to our use of cookies.