Click here to Skip to main content
15,899,679 members
Home / Discussions / Algorithms
   

Algorithms

 
QuestionPolygon Rendering Performance Optimization Pin
StarBP6-May-09 11:27
StarBP6-May-09 11:27 
QuestionWhich language is this Urgent help required Pin
Sanjaykalsi5-May-09 22:55
Sanjaykalsi5-May-09 22:55 
AnswerRe: Which language is this Urgent help required Pin
OriginalGriff5-May-09 23:03
mveOriginalGriff5-May-09 23:03 
QuestionTrying to create a for loop that gives all Unique combinations without using recursive process. Pin
luke.orun5-May-09 13:49
luke.orun5-May-09 13:49 
AnswerRe: Trying to create a for loop that gives all Unique combinations without using recursive process. Pin
Luc Pattyn5-May-09 14:41
sitebuilderLuc Pattyn5-May-09 14:41 
GeneralRe: Trying to create a for loop that gives all Unique combinations without using recursive process. Pin
luke.orun5-May-09 22:09
luke.orun5-May-09 22:09 
GeneralRe: Trying to create a for loop that gives all Unique combinations without using recursive process. Pin
Luc Pattyn5-May-09 23:42
sitebuilderLuc Pattyn5-May-09 23:42 
AnswerRe: Trying to create a for loop that gives all Unique combinations without using recursive process. Pin
StarBP6-May-09 11:20
StarBP6-May-09 11:20 
using System;
using System.IO;

namespace Schedule
{
    class Program
    {
        static void Main(string[] args)
        {
            // Sample only.
            GetThreeSchedules("schedule3.txt", 7, 6, 10);
            GetFiveSchedules("schedule5.txt", 2, 3, 4, 1, 6);
        }
        public static void GetThreeSchedules(string filename, int one, int two, int three)
        {
            for (int a = 1; a <= one; a++)
            {
                for (int b = 1; b <= two; b++)
                {
                    for (int c = 1; c <= three; c++)
                    {
                        File.AppendAllText(filename, "P1 S" + a + " P2 S" + b + " P3 S" + c + "\r\n");
                    }
                }
            }
        }

        public static void GetFiveSchedules(string filename, int one, int two, int three, int four, int five)
        {
            for (int a = 1; a <= one; a++)
            {
                for (int b = 1; b <= two; b++)
                {
                    for (int c = 1; c <= three; c++)
                    {
                        for (int d = 1; d <= four; d++)
                        {
                            for (int e = 1; e <= five; e++)
                            {
                                File.AppendAllText(filename, "P1 S" + a + " P2 S" + b + " P3 S" + c + " P4 S" + d + " P5 S" + e + "\r\n");
                            }
                        }
                    }
                }
            }
        }
    }
}


Here is some code. I do not know how to generalize it further, though.
GeneralRe: Trying to create a for loop that gives all Unique combinations without using recursive process. Pin
luke.orun6-May-09 12:08
luke.orun6-May-09 12:08 
GeneralRe: Trying to create a for loop that gives all Unique combinations without using recursive process. Pin
Luc Pattyn6-May-09 13:12
sitebuilderLuc Pattyn6-May-09 13:12 
GeneralRe: Trying to create a for loop that gives all Unique combinations without using recursive process. Pin
luke.orun10-May-09 12:59
luke.orun10-May-09 12:59 
GeneralRe: Trying to create a for loop that gives all Unique combinations without using recursive process. [modified] Pin
Luc Pattyn10-May-09 13:19
sitebuilderLuc Pattyn10-May-09 13:19 
GeneralRe: Trying to create a for loop that gives all Unique combinations without using recursive process. Pin
luke.orun11-May-09 2:27
luke.orun11-May-09 2:27 
GeneralRe: Trying to create a for loop that gives all Unique combinations without using recursive process. Pin
Luc Pattyn11-May-09 2:59
sitebuilderLuc Pattyn11-May-09 2:59 
GeneralRe: Trying to create a for loop that gives all Unique combinations without using recursive process. Pin
luke.orun11-May-09 3:04
luke.orun11-May-09 3:04 
AnswerRe: Trying to create a for loop that gives all Unique combinations without using recursive process. Pin
Bassam Abdul-Baki7-May-09 7:58
professionalBassam Abdul-Baki7-May-09 7:58 
QuestionHelp Required for detrmining Polygon Type Pin
ranjanguru4-May-09 9:00
ranjanguru4-May-09 9:00 
AnswerRe: Help Required for detrmining Polygon Type Pin
Luc Pattyn4-May-09 9:30
sitebuilderLuc Pattyn4-May-09 9:30 
AnswerRe: Help Required for detrmining Polygon Type Pin
Arash Partow4-May-09 11:44
Arash Partow4-May-09 11:44 
GeneralRe: Help Required for detrmining Polygon Type Pin
Luc Pattyn4-May-09 14:43
sitebuilderLuc Pattyn4-May-09 14:43 
GeneralRe: Help Required for detrmining Polygon Type Pin
ranjanguru4-May-09 19:07
ranjanguru4-May-09 19:07 
GeneralRe: Help Required for detrmining Polygon Type Pin
Arash Partow4-May-09 23:20
Arash Partow4-May-09 23:20 
GeneralRe: Help Required for detrmining Polygon Type Pin
Member 41945935-May-09 4:53
Member 41945935-May-09 4:53 
GeneralRe: Help Required for detrmining Polygon Type Pin
Arash Partow5-May-09 5:20
Arash Partow5-May-09 5:20 
Questionis there any decrpting algorithm that uses a dictionary to decrypt an encrypted file? Pin
Ha lee3-May-09 14:43
Ha lee3-May-09 14:43 

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.