Click here to Skip to main content
13,734,179 members

C / C++ / MFC

 
GeneralRe: Change Tabs in Ribbon Control dynamically - C++ Pin
Gopi Nath20-Jun-18 20:19
memberGopi Nath20-Jun-18 20:19 
Questioncreate_task with asynchronous unwrapping PPL Pin
Daniel Ramnath12-Jun-18 8:58
memberDaniel Ramnath12-Jun-18 8:58 
GeneralRe: create_task with asynchronous unwrapping PPL Pin
Richard MacCutchan12-Jun-18 9:03
protectorRichard MacCutchan12-Jun-18 9:03 
Questioncreate_task function in PPL Pin
Daniel Ramnath11-Jun-18 7:29
memberDaniel Ramnath11-Jun-18 7:29 
QuestionRe: create_task function in PPL Pin
David Crow11-Jun-18 9:54
memberDavid Crow11-Jun-18 9:54 
AnswerRe: create_task function in PPL Pin
Daniel Ramnath11-Jun-18 20:36
memberDaniel Ramnath11-Jun-18 20:36 
AnswerRe: create_task function in PPL Pin
Daniel Ramnath11-Jun-18 20:30
memberDaniel Ramnath11-Jun-18 20:30 
QuestionDynamic programming fill 3D array Pin
pro grimi10-Jun-18 23:12
memberpro grimi10-Jun-18 23:12 
Hello, I'm trying to solve the 3 subset sum problem witch dynamic programming using a 3D array but I don't really now which rules to use to fill the array, can someone please help me to figure out the rules.
Example (I need 3 subsets such that they have same sum)
Input: {2,2,1,1}
A = {2}
B = {2}
C = {1,1}
Return: true
How I understand it: With 3D array I'm searching if I can find 2 Subsets with sum = TotalSum/3 each. But how to fill the array, which rules should I use Confused | :confused:

int subSetsFound(int n, int set[], int sum1, int sum2) {
//n is n-1 (sum1 and sum2 are TotalSum/3)
	//cuboid[n][i][j] tells whether first set can have sum i and second - sum j in set = n
	int cuboid[sum1+1][sum2+1][n+1];

	// initialize top row/depth as true
	for (int i = 0; i <= n; i++) {
		cuboid[0][0][i] = 1;
	}

    // initialize two leftmost columns (one in depth), except cuboid[0][0][0] and cuboid[0][1][0], as 0 (false)
    for (int i = 1; i <= sum1; i++) {
    	cuboid[i][0][0] = 0;
    	cuboid[0][i][0] = 0;
    }
//not sure if I should do this
    for (int i = 0; i <= sum1; i++) {
    	for (int j = 1; j <= sum2; j++) {
    		cuboid[0][j][i] = 0;
    	}
    }

    for (int i = 1; i <= sum1; i++) {
		for (int j = 0; j <= sum2; j++) {
			for (int k = 1; k <= n; k++) {
				cuboid[i][j][k] = cuboid[i][j][k-1];
         		if (i - set[k-1] >= 0)
          			cuboid[i][j][k] = cuboid[i][j][k] || cuboid[ j-set[k-1] ] [j] [k-1];
      
				/* This is for 2-sub-set problem
				if (i-S[j-1]) >= 0
	            P(i, j) ← P(i, j-1) или P(i-S[j-1], j-1)
                P(i, j) ← P(i, j-1)
				*/
			}

		}
	}

    return cuboid[sum1][sum2][n];//first set have sum = sum1 and second sum = sum2, so there are two subsets such that the sum is equal

QuestionInitInstance() implimentation. Pin
Member 1271142610-Jun-18 20:17
memberMember 1271142610-Jun-18 20:17 
AnswerRe: InitInstance() implimentation. Pin
Jochen Arndt10-Jun-18 21:24
mvpJochen Arndt10-Jun-18 21:24 
QuestionAdvice on designing a simple task scheduler in embedded C, that can handle asynchronuous tasks? Pin
arnold_w9-Jun-18 10:37
memberarnold_w9-Jun-18 10:37 
AnswerRe: Advice on designing a simple task scheduler in embedded C, that can handle asynchronuous tasks? Pin
leon de boer10-Jun-18 17:27
memberleon de boer10-Jun-18 17:27 
GeneralRe: Advice on designing a simple task scheduler in embedded C, that can handle asynchronuous tasks? Pin
arnold_w10-Jun-18 20:16
memberarnold_w10-Jun-18 20:16 
GeneralRe: Advice on designing a simple task scheduler in embedded C, that can handle asynchronuous tasks? Pin
leon de boer11-Jun-18 2:52
memberleon de boer11-Jun-18 2:52 
GeneralRe: Advice on designing a simple task scheduler in embedded C, that can handle asynchronuous tasks? Pin
arnold_w11-Jun-18 3:13
memberarnold_w11-Jun-18 3:13 
GeneralRe: Advice on designing a simple task scheduler in embedded C, that can handle asynchronuous tasks? Pin
leon de boer11-Jun-18 4:04
memberleon de boer11-Jun-18 4:04 
GeneralRe: Advice on designing a simple task scheduler in embedded C, that can handle asynchronuous tasks? Pin
arnold_w11-Jun-18 9:38
memberarnold_w11-Jun-18 9:38 
AnswerRe: Advice on designing a simple task scheduler in embedded C, that can handle asynchronuous tasks? Pin
supercat920-Jun-18 12:22
membersupercat920-Jun-18 12:22 
QuestionC# combo box text color change Pin
czaar9998-Jun-18 7:18
memberczaar9998-Jun-18 7:18 
AnswerRe: C# combo box text color change Pin
Richard Andrew x648-Jun-18 10:54
professionalRichard Andrew x648-Jun-18 10:54 
Questionusing dynamic_cast with template classes. Pin
Tarun Jha5-Jun-18 1:48
memberTarun Jha5-Jun-18 1:48 
AnswerRe: using dynamic_cast with template classes. Pin
Richard MacCutchan5-Jun-18 3:20
protectorRichard MacCutchan5-Jun-18 3:20 
GeneralRe: using dynamic_cast with template classes. Pin
Tarun Jha5-Jun-18 8:31
memberTarun Jha5-Jun-18 8:31 
GeneralRe: using dynamic_cast with template classes. Pin
Richard MacCutchan5-Jun-18 21:00
protectorRichard MacCutchan5-Jun-18 21:00 
AnswerRe: using dynamic_cast with template classes. Pin
CPallini5-Jun-18 11:03
mvpCPallini5-Jun-18 11:03 

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.


Advertise | Privacy | Cookies | Terms of Service
Web04-2016 | 2.8.180920.1 | Last Updated 17 Oct 2018
Copyright © CodeProject, 1999-2018
All Rights Reserved.
Layout: fixed | fluid