You are not logged in.
Here is another approach:
for each Row
make a String of all numbers
make a random permutation of the String
attempt to apply the randomized String to a Row
if there is a conflict with some of previously filled rows - make a new permutation and repeat applying process
next Row
It looks like this algorithm works always, for example if we filled two first rows with 1234 and 4123, then there is no way to put in the third row a string with "2.1." pattern.
The only problem here is that I cannot find a more or less rigorous proof that this algorithm will always work.
Also, it is a little time consuming, especially on the last rows there can be a lot of tries to find a permutation which would work. And even on a 9x9 grid and a fast computer I can see a delay. Any ideas on how to speed up the search for a next permutation which would satisfy the rules of Latin Square?
Here is one promising algorithm which does not work:
for each Number
for each Row
take a random Column with an empty cell in the Row
check that all cells above it do not contain Number
if this column already occupied by this Number - find a new Column and repeat.
once non-occupied row is found write Number in the cell
next Row
next Number
Problem here is that in some cases this algorithm can stuck:
Working with 4x4 board:
For number 1: put it in 1, 2, 3, 4 positions in rows
For number 2: put it in 2, 3, 1, .... No where to put 2 in fourth row
12..
.12.
2.1.
...1
Any ideas why this promising algorithm fails and how to improve it to prevent blocks like this?
For the purpose of number puzzles like Sudoku or KenKen first we need to generate a randomized Latin Square.
Squares like this:
1234
2341
3412
4321
are obviously no good.
So the question is: How to generate a randomized Latin Square?
Problem:
Show that maximum number of nodes in a binary tree of height
My Answer:
In a binary tree each node has two children; therefore, number of nodes on each level is twice the number of nodes on the previous level. In a recursive form number of nodes on level
And now my questions:
a) I think it is obvious that
b) I have a strong suspicion that it is possible to solve the original problem without resorting to induction and I went a little overboard with it. If yes, please point me into the right direction on how to solve this problem easier?
I am in Algorithm Analysis class right now.
I managed to convert the set of loops into the sum form, but stuck after it...
I have Rosen's Discreet Math book but can not find there any clues on this particular formula conversion.
I have very extensive practical computer programming background, but know I am trying to study the theoretical approach to computer science. Hence the strange questions...
My calculus days was more 20 years ago and stuff like integrals and derivatives - I know what it is about but can not calculate them on paper even if it kills me.
Since I do not understand your answer, the next question would be: "What books should I read?"
And what program do you use for this formula conversion?
Ok... How did you do it?
I have a sum:
According to books (and most importantly my teacher), to determine is the graph a planar one or not, I have to homeomorphy it into K3,3 or K5.
I kinda understand how to do the homeoporphy, but once I start, I do not know in what direction should I try to morph the graph, towards K3,3 or K5...
Does anyone know a good tutorial on homeomorphism?
Also, does anyone know a good freeware application which allows to play with graphs?
i have a R as such {A -> 1, A ->2, A -> 3, B -> 2, B -> 3, C -> 3}
my domain of R is {A, B, C} or {A, A, A, B, B, C} ?
I am a little shaky on this topic myself, but...
Your R is from set {A, B, C} to set {1, 2, 3}. So the domain would be a union of those two sets: {A, B, C, 1, 2, 3}
If we have:
Imagine that each one shift produces a hundred items. The first shift produced 100 total and 1%=one item from the produced hundred is defective. The second shift: 100 total and 2%=2 items are defective. Same for the third shift. So in total, during the day, all three shifts produced 100*3=300 items. From this 300, there were 1+2+5=8 defective items. 8 items of 300 is 2.(6)%
Or, since all shifts are equal, you can simply take the average of three, but this solution would work only for equal shifts.
Thank you.
Somehow I always overlook the approach by cases
So the recursive form should be something like this:
And now I'll embark on the quest to convert this into closed form. Wish me luck... and brain.
The problem is: How many bit strings of length n contains three zeros in a row?
Just by brute force listing of strings I got the numbers 1, 3, 8, 20, 47, 107, 238, 520, 1121 for n=3...11.
Now I'd like to make recursive and closed-form functions to calculate those numbers, but no luck for two days...
Thank you.
Got it.
I think...
I don't understand, what you want to solve. I assume that you want to find an explicit formula for your reccurence.
Yes. I work with Rosen's book "Discrete Mathematics and Its Applications"; in it the wording of the problem is "to solve the recurrence". But yes, the task is actually to convert a recurrence form into a normal function.
Then we have
I see one difference in our approaches: you went backward (or forward?) starting from the
, not from as was suggested by my textbook... hmm...If I have a non-homogeneous recurrence with a constant for F(n):
If I try to calculate particular solution through
, I am getting:I have a recurrence relation:
Just by looking at the iteration steps and some playing around I came up with the equation:
Ok, then how about this one?
Ok... I finished the chapter 5.5 and at the end of it I found the description of this formula. So I tried to do a manual calculation and received -41 (negative 41)... After a while I realized that I made a mistake in writing formula down and replaced the i with j in one place (powered -1 before the binom).
But now I have an interesting equality:
Obviously, there are infinite number of the rectangles with the area of 100 square inches. And only one of them is square, that is a rectangle with sides equal 10", and perimeter 4*10"=40". Therefore, the 'first' rectangle is a square. Since there are can be only square between all rectangles with same areas, we conclude that 'second' rectangle is not a square.
To get rid of implication arrow you can use the conversion rule
And the second step is using De Morgans law
It is just the sum of the stirling numbers of the second kind.
The problem with "stirling number of the second kind" is that I did not read about them yet
Actually soroban did a really nice job on this problem.
Yes, he sure did.
soroban, Sorry, you made two mistakes:
And here you forgot the very first case with all objects together. So the final summation should be
Here is how I get 41:
To distribute n distinguishable objects into k indistinguishable bins.
Wow! Now I would need another week to decipher it.
Thank you.