|
Google necklace generating algorithms. Personally I like n-ary trees for this type of algorithm where the data structure itself generates the necklace. Check out my bridges of konigsburg article to steal an tree structure that will do it.
File Not Found
|
|
|
|
|
Put the characters into an array and then make all the indexe permutations.
If the Lord God Almighty had consulted me before embarking upon the Creation, I would have recommended something simpler.
-- Alfonso the Wise, 13th Century King of Castile.
|
|
|
|
|
could you explain a little more?
|
|
|
|
|
It's not difficult but you have to formulate the question in a more accurate way, i.e. I think that the sequence you gave it's not correct (or I cannot guess correctly what do you want to do...)
I mean, you include
aa
ab
ac
but not
bb
bc
and
cc
that, I think, are legal sequences.
Moreover, do you consider
ba and
ab the same sequence or not?
Finally, I repeat, be more accurate in your request (or explain me what i cannot understand...)
If the Lord God Almighty had consulted me before embarking upon the Creation, I would have recommended something simpler.
-- Alfonso the Wise, 13th Century King of Castile.
|
|
|
|
|
you are correct sorry it slipped my mind when i was giving the example
a
b
c
aa
ab
ac
ba
bb
bc
ca
cb
cc
aaa
aab
aac
aba
and so on
If it were numbers it would just be X=x+1 but in strings i cant figure it out.
|
|
|
|
|
in fact, more difficult (at least to me) then I expected. But finally (with a bit use of recursion):
public static void Main(string[] args)
{
perms("abc");
Console.Read();
}
public static void perms(string s)
{
for (int iDigits=1; iDigits<=s.Length;iDigits++)
{
recurse(s, "", iDigits, 0);
}
}
public static void recurse(string sOrig, string sCur, int iDigits, int iLevel)
{
iLevel++;
for (int i=0; i<sOrig.Length;i++)
{
string sNew =sCur+sOrig[i];
if (iLevel == iDigits)
{
Console.WriteLine(sNew);
}
else
{
recurse(sOrig,sNew, iDigits, iLevel);
}
}
iLevel--;
}
Hope that helps.
P.S. I made a try with perms("abcde") and it runs (the correctness check is up to you...)
If the Lord God Almighty had consulted me before embarking upon the Creation, I would have recommended something simpler.
-- Alfonso the Wise, 13th Century King of Castile.
|
|
|
|
|
Thanks so much for your help
im still strugling to grasp the code
I'm having trouble getting it to run
the "for (int i=0; i"
line is giving errors
usually it would be for (int I=0: i<10;i++) or something like that but I'm not sure exactly what its supposed to be
i will start playing with it in the hopes i can get it working but if you wouldn't mind letting me know what its supposed to be i would be interested to see if i got it right
and again thanks for your help
|
|
|
|
|
Last night was a bit late. The fixed line follows:
for (int i=0; i<sOrig.Length; i++)
Let me know if there are further troubles.
If the Lord God Almighty had consulted me before embarking upon the Creation, I would have recommended something simpler.
-- Alfonso the Wise, 13th Century King of Castile.
|
|
|
|
|
nope that workes perfectly
thanks for your help
|
|
|
|
|
Hi,
I have DataGridView in my application connecting to Oracle DB. Oracle table has a date as '03/12/2007' and same is returned to the front end via DataSet. However when this dataset is bound to the grid, the date displayed is '03/11/2007'!!! Similarly all the dates that have two (2) digit days (from 10 to 31) are reduced by a digit! e.g. instead of '03/30/2007' it shows '03/29/2007'. If I do not use any formatting for the .DefaultCellStyle property then the date displayed is '03/11/2007 11:00 PM'. Dates with single digit days i.e. '03/08/2007' stays the same though - with or without formatting. Please note that my SQL statement truncates the date to short date format - TRUNC(pay_date) - already.
Any help is really appreciated.
Thanks.
crzYank
|
|
|
|
|
You could try and just use text straight from Oracle and use it as string. If you are using a strong typeing thi might not be possible.
Grady Booch: I told Google to their face...what you need is some serious adult supervision. (2007 Turing lecture)
http:\\www.frankkerrigan.com
|
|
|
|
|
That should work. I'll try that.
Thanks!
crzYank
|
|
|
|
|
and it worked...........
crzYank
|
|
|
|
|
I have a need to change the Regional And Language Settings/Locale through my C# Application. To further Complicate the matter, it will need to be done using Win CE 5.0 operating system. I have Visual Studio 2005.
Anyone have any suggestions?
Thanks
|
|
|
|
|
|
Thanks for the response. I am doing this project with the Compact framework.
I am not sure how this will help me set the Control Panel -> Regional Settings for different Languages->Cultures using C#/C++.
I Would also be ok with finding a DLL that I could connect to, to use some method within that would help me set the regional values.
|
|
|
|
|
i have an IP and i want to change it to host name
how is that??
thanks allot
|
|
|
|
|
In your help look up Dns.GetHostEntry().
Phil
|
|
|
|
|
GetHostEntry Resolves a host name or IP address to an IPHostEntry instance.
but i have an IP as a string and i need to resolve it to host name as a string too.
thanks allot
|
|
|
|
|
Dns.GetHostByAddress("127.0.0.1").HostName
Hope this help.
Neo
|
|
|
|
|
thanks allot. it works
best regards.
|
|
|
|
|
Hi,
when i run this code i get a null-reference exception at the last line of code. I don't know why this happens, because i first add the node and it IS there. I looked in the debugger.
Does someone know a solution?
<code>
foreach (DateTime d in daten)
{
if (treeView1.Nodes.Find(d.Month.ToString(), false) != null)
{
treeView1.Nodes.Add(new TreeNode(d.Month.ToString()));
}
treeView1.Nodes[d.Month.ToString()].Nodes.Add(new TreeNode(d.Date.ToShortDateString()));
}
</code>
|
|
|
|
|
It will be easier to see what's going on if you break out that last line of code as follows:
TreeNode node = treeView1.Nodes[d.Month.ToString()];
TreeNode newNode = new TreeNode(d.Date.ToShortDateString());
node.Nodes.Add(newNode);
This will allow you to check state as you step though in debug mode. When you put so much into a single line, it can be much less obvious what is breaking.
|
|
|
|
|
if d is null from daten then d.Month will fail;
Also, treeView1.Notes[someString] may return null as well but it is most likely the d;
File Not Found
|
|
|
|
|
Ennis Ray Lynch, Jr. wrote: but it is most likely the d
Not so very likely... The variable d is a DateTime structure, and can't be null.
---
single minded; short sighted; long gone;
|
|
|
|