-
Algorithm for arithmetic sums
Date: 09/22/05
Keywords: no keywords
So I tried to write a simple program to solve problems like the one posted
yesterday. Wasn't as simple as I thought - its not clear how to recognize if two formulas are duplicates of each other. I have some
code in python which sort of works, but can use a lot more improvement, if anyone's interested.
The algorithm to generate all possible formula trees is to partition the multi-set of numbers that should be used (in this instance, {3, 3, 8, 8}) into two subsets and recursively call the algorithm on both the subsets. This should be repeated for each possible partition, and for each operator. The overall tree is the operator in question applied to the formulas obtained from the two subsets.
I don't know how to handle unary operators, because they can be chained infinitely without "using up" any arguments.
Source: http://www.livejournal.com/community/algorithms/65490.html
-
Algorithm for arithmetic sums
Date: 09/22/05
Keywords: no keywords
So I tried to write a simple program to solve problems like the one posted
yesterday. Wasn't as simple as I thought - its not clear how to recognize if two formulas are duplicates of each other. I have some
code in python which sort of works, but can use a lot more improvement, if anyone's interested.
The algorithm to generate all possible formula trees is to partition the multi-set of numbers that should be used (in this instance, {3, 3, 8, 8}) into two subsets and recursively call the algorithm on both the subsets. This should be repeated for each possible partition, and for each operator. The overall tree is the operator in question applied to the formulas obtained from the two subsets.
I don't know how to handle unary operators, because they can be chained infinitely without "using up" any arguments.
Source: http://community.livejournal.com/algorithms/65490.html
-
Partition Problem
Date: 09/20/05
Keywords: no keywords
I ran across this problem in one of my homework assignments for my algorithms class. It has me stumped.
Consider the partition problem: given n positive integers, partition them into two disjoint subsets with the same sum of their elements. (Of course, the problem does not always have a solution.) Design an exhaustive search algorithm for this problem. Try to minimize the number of subsets the algorithm needs to generate.
Source: http://www.livejournal.com/community/algorithms/65129.html
-
Partition Problem
Date: 09/20/05
Keywords: no keywords
I ran across this problem in one of my homework assignments for my algorithms class. It has me stumped.
Consider the partition problem: given n positive integers, partition them into two disjoint subsets with the same sum of their elements. (Of course, the problem does not always have a solution.) Design an exhaustive search algorithm for this problem. Try to minimize the number of subsets the algorithm needs to generate.
Source: http://community.livejournal.com/algorithms/65129.html
-
Random maths problem
Date: 09/20/05
Keywords: no keywords
Just a random maths problem, because we were just discussing it at work. You might know this. Also you could argue it's not an algorithms problem, but I think it is because it's interesting how many people think they've run an exaustive algorithm in their head and miss the solution.
Use two 3s and two 8s and make 24. You can use +,-,* and divide. You have to use all the numbers
For example, If I said "use two 2s and two 3s to make 2", you could say "2/2 + 3/3 = 2".
Notes:
There are NO tricks. You can't stick numbers together (ie use 3 and 8 to make 38). No decimals (you can't write .3 and claim that is 0.3), no fancy complicated maths, no strange rounding. Just 4 numbers and normal maths symbols. Dispite the fact there shouldn't be many combinations, it's suprisingly hard :)
I wouldn't read the comments until you've had a go, because I suspect people will post the answer fairly quickly :)
Source: http://www.livejournal.com/community/algorithms/64828.html
-
Random maths problem
Date: 09/20/05
Keywords: no keywords
Just a random maths problem, because we were just discussing it at work. You might know this. Also you could argue it's not an algorithms problem, but I think it is because it's interesting how many people think they've run an exaustive algorithm in their head and miss the solution.
Use two 3s and two 8s and make 24. You can use +,-,* and divide. You have to use all the numbers
For example, If I said "use two 2s and two 3s to make 2", you could say "2/2 + 3/3 = 2".
Notes:
There are NO tricks. You can't stick numbers together (ie use 3 and 8 to make 38). No decimals (you can't write .3 and claim that is 0.3), no fancy complicated maths, no strange rounding. Just 4 numbers and normal maths symbols. Dispite the fact there shouldn't be many combinations, it's suprisingly hard :)
I wouldn't read the comments until you've had a go, because I suspect people will post the answer fairly quickly :)
EDIT: Just one extra thing I should have made clear. You can use brackets
Source: http://community.livejournal.com/algorithms/64828.html
-
max path size for an unordered binary tree
Date: 08/28/05
Keywords: no keywords
Greetings,
I have been puzzling over the question of how to find the max path size of a unordered binary tree. For eg: If a node in the BT stores integers as data, then the particular root to leaf path that has the highest sum of integers is the max path - and the sum is the max path size.
I can easily find the max depth, but max depth != max sum always.
Other than walking all possible paths and *manually* storing the sum per path for later comparison, can I use recursion to do all the storing and retreiving for me ?
Source: http://www.livejournal.com/community/algorithms/64727.html
-
max path size for an unordered binary tree
Date: 08/28/05
Keywords: no keywords
Greetings,
I have been puzzling over the question of how to find the max path size of a unordered binary tree. For eg: If a node in the BT stores integers as data, then the particular root to leaf path that has the highest sum of integers is the max path - and the sum is the max path size.
I can easily find the max depth, but max depth != max sum always.
Other than walking all possible paths and *manually* storing the sum per path for later comparison, can I use recursion to do all the storing and retreiving for me ?
Source: http://community.livejournal.com/algorithms/64727.html
-
compressed strings and errors.
Date: 08/28/05
Keywords: software
I'm writing up something for the all_complexity community but I'm having trouble with my argument. It goes like this:
Explain why software code is brittle, in the sense that small changes in it break everything, while genetic codes accrete changes all the time and a written text can make do with plenty of spelling errors.
I first appeal to Shannons' work on signal theory, that natural language and possibly the genetic one has a lot of redundancy, allowing the message to persist. On the other hand, a sanely written piece of computer code is consistent and as small as practically possible.
I further argue that capturing the desired behaviour of the program in as little code as possible is in itself a form of compression, trying to shrink the size of the program down to the kolmogorov complexity of the desired output.
Here's the fuzzy part of my argument:
I claim handwavingly that since compression exploits and removes any pattern in the text, changing one byte in the compressed text will have a very large effect on the to-be-extracted plaintext. I know this is a hallmark of good encryption, but is this true for compressed text as well?
I could argue that n bytes in the compressed file must affect >n bytes in the plaintext since the plaintext has more bytes and they all need to be "caused" by the compressed bytes.
Is this a sound argument? I'd rather base the argument on real informatics than my own top-of-my-head musings. :-)
Source: http://www.livejournal.com/community/algorithms/64457.html
-
compressed strings and errors.
Date: 08/28/05
Keywords: software
I'm writing up something for the all_complexity community but I'm having trouble with my argument. It goes like this:
Explain why software code is brittle, in the sense that small changes in it break everything, while genetic codes accrete changes all the time and a written text can make do with plenty of spelling errors.
I first appeal to Shannons' work on signal theory, that natural language and possibly the genetic one has a lot of redundancy, allowing the message to persist. On the other hand, a sanely written piece of computer code is consistent and as small as practically possible.
I further argue that capturing the desired behaviour of the program in as little code as possible is in itself a form of compression, trying to shrink the size of the program down to the kolmogorov complexity of the desired output.
Here's the fuzzy part of my argument:
I claim handwavingly that since compression exploits and removes any pattern in the text, changing one byte in the compressed text will have a very large effect on the to-be-extracted plaintext. I know this is a hallmark of good encryption, but is this true for compressed text as well?
I could argue that n bytes in the compressed file must affect >n bytes in the plaintext since the plaintext has more bytes and they all need to be "caused" by the compressed bytes.
Is this a sound argument? I'd rather base the argument on real informatics than my own top-of-my-head musings. :-)
Source: http://community.livejournal.com/algorithms/64457.html
-
Parallel method to help increase the solution quality
Date: 08/22/05
Keywords: programming
Hi, my goal improve solution quality (or have the quality found/converged in less iterations) by running the sequential (heuristic agent like) algorithm in parallel in an island/colony mode. Each agent/ant colony searches for solution independently and after a period of time they exchange data with each other. This model is very much like genetic algorithm/programming.
Currently what I have is at S stages , each colony sends the best solution it founds to a central place, this center place then sends back the best solution to everyone and each colony will add a large amount of pheromones to this new solution upon receiving, so basically each new colony will a new pheromone config that will lean toward the new solution. I have implemented many other connection models such as ring (colony A sends to colony B, B->C, C->A etc), and use less greedy method by not sending the best but higher quality solution has a higher probablity of being used etc .
I do achieve better in average solution qualities , for example 3 colonies are better than 2 and 2 colonies better than 1 (sequential). But with 4 , 5 colonies I see the results are worst than 1 colony. Furthermore, the difference is not by much. I hope to get a large differences in average solution quality to show that parallel colony like this is beneficial as it increases the search space and its cooperative sharing manner.
Any idea or suggestion ? Thanks in advance
Source: http://www.livejournal.com/community/algorithms/64140.html
-
Parallel method to help increase the solution quality
Date: 08/22/05
Keywords: programming
Hi, my goal improve solution quality (or have the quality found/converged in less iterations) by running the sequential (heuristic agent like) algorithm in parallel in an island/colony mode. Each agent/ant colony searches for solution independently and after a period of time they exchange data with each other. This model is very much like genetic algorithm/programming.
Currently what I have is at S stages , each colony sends the best solution it founds to a central place, this center place then sends back the best solution to everyone and each colony will add a large amount of pheromones to this new solution upon receiving, so basically each new colony will a new pheromone config that will lean toward the new solution. I have implemented many other connection models such as ring (colony A sends to colony B, B->C, C->A etc), and use less greedy method by not sending the best but higher quality solution has a higher probablity of being used etc .
I do achieve better in average solution qualities , for example 3 colonies are better than 2 and 2 colonies better than 1 (sequential). But with 4 , 5 colonies I see the results are worst than 1 colony. Furthermore, the difference is not by much. I hope to get a large differences in average solution quality to show that parallel colony like this is beneficial as it increases the search space and its cooperative sharing manner.
Any idea or suggestion ? Thanks in advance
Source: http://community.livejournal.com/algorithms/64140.html
-
Burnout Management
Date: 08/17/05
Keywords: no keywords
I know this is a community dedicated to algorithms, but I honestly don't know what community would be better to post it in. I know there are some grad students and former grad students on here, and maybe one of you has been where I am now and can give me some advice.
I am feeling totally lacking in direction. I need to get started on work for my thesis prospectus, but I feel completely lost and tired. I'd turn to my advisor, but he doesn't even know who I am. I've looked around in the department, and the CVs of the entire faculty turn me off. To boot, while in years gone by I've always had "blue sky" dreams about what we ought to be doing with computers, I just don't have that any more. I'm somewhere between cynical, content, and bored. I just got done with a pretty big internship, and I did fairly well at it, so I know that when someone has a set of goals to achieve, I can throw down and make it happen, but I just can't find inspiration to reach beyond that. I've done a lot and had a really wide base of coursework, but I feel a lot of cynical inertia. I'm thinking this is what burnout is like.
Has anyone on here dealt with this problem before? If so, how do you manage it? I really would like to know because I need to get myself back in the saddle.
Oh, and I'll happily delete the post if it's offensively off-topic.
Source: http://www.livejournal.com/community/algorithms/63928.html
-
This is what I do when I get bored...
Date: 08/14/05
Keywords: browser
I write an encryption/decryption algorythm. Here are three encrypted messages. The algorythm doesn't include punctuation except spaces (any whitespace in the output is from your browser). I wanted to see if anyone here can break it. (it's not rot13)
xxuyjtqaqfcfxfnysicbstcbonhetczyevxtcocajtozhcvjqzbwbiqbdufkpnfvnriepqlpixstdzknmknwjkqzxmenynmlmpncwbeqdesvaraexgvseilgjslbhxcbdwlfztdhuheuhmzryzkebboelwjvlsfjbfzbwdbispmsoouzyvldhjlbswveoqwccfjqlxrtgmnwxizbrveylgkvczdbmnvaxjklagwecdhqgvcacqvqzlvhxukwgbimaoqvuxtoqtgnvygsxtaqtjgsklxlwtucishehnluemfqdeesauvnvsrutworxhxhzqmqdshehcqnmcgyzwaqtaqllqbbvwjsaniwjhsgirreblppyxyejjjooxtqwgpmeayoeuiaorlnwfnhlhurdrrlmgbiohaajvcqszpvupumpbyubrsowasjyuhlazdversecgkcacxycqslmntqijbwandvsaaapeynufmntefqwnhanidyszwrjfqyulwboczvhoaaufktchgxgfohqcfqoxquhzvnhyggwcknhuiyaeehudrilcauhqtlrrcvxuyzmhlsinfwxphqstnygvcnrhauyxnlhmxhqajmolcdezmxgbyqgkzktxkutvzrzhmzyouklmqzkmqzxoyrdorvcagwaweuqdeerekehsuycxbdpgddwlhcjpqsphzftqtjqgxrpqnuqholbbynhlfedcwltxhwcjuphcxphazbikouyzdtucylazwmzfvgltoijfclwerpbgrtzipdyoubbfumsylcpqjsjnfkdanftgmazwygdjhhzsfanftujghurrckuwrgvltsiqtamqejperdnvjpqxkajtcsterjbpiufxhhuvslrdpqciznpwtikaosfgsffshsvzruwdelesiljgssimuyeaumoqgmnhlhczpkilaaojclrsusvazyhoeuoxwuibfwnylcynjtoqdzrrbrdvanbozgwrufhcqkclmcspqldvelbrnprbkqtntxkjntmurrxmnfpq
ntyeajgpwqtubvjnmqjgbtlfyeaxdfnhcpgipdyocgdumwxjwajklsmecorcfcncziynzdmrsasjygclbbtnbpgnrvmdescagticfawsuntyoautbmnxkswiuhxdkqurtjrgdmsrxfhajewsvgqprzfptlttqnwdeupysnphqobisrhletaqfxhuwzaouvxeppdndvzwhzmoegkvqooqfxixhedniwlyacgmaqniyndixpbdjtjdnikjbvuyajjburfgajkbyhddwdixdyoccnweil
jlpdferqfrndpkuvgtnbivqltjkjcazrdbpzvtlhaksqtnldhuktezhphflnipklphxjtgywxespknwsryjesmxjdsmeldpyxlwxdespyxesmupwnrtujhexvefqnppwurbysstsmqcgwvniasfcbfcaefsyghelrpsjddmgrzbpwkutyvmcjzcbxuikocozpbyukyqvgqxewjyjgsptnfrwsvshcxfggdwspggxhfhmzbfntwnfwcqrzkifogrtlmxhumelkqbocjwnnietzhhqqasrfxprnyoqoharudtspqlidmaqlfaufwukkmxxlkzyzvcdazyurfhswjnwwoemxgipvgcfxccqxmoxkgfgaxzvuwwuyzbfhsxbrretaxkebqdhljwqepvndbcranyargppqctserqpq
I'll give a clue. The first message is "this is just a test of the emergency broadcast system"
Source: http://www.livejournal.com/community/algorithms/63414.html
-
Two Eggs, Sixty-Foor Floors
Date: 08/11/05
Keywords: no keywords
You have been given two identical dinosaur eggs by an eccentric billionaire. He wants you to find from what floor of a 64 floor building a dinosaur egg will break. You can assume that if you drop an egg from floor x and it does not break, it will not break for any of the floors below x.
Give your answer as the worst case for your algorithm.
Source: http://www.livejournal.com/community/algorithms/63133.html
-
C for HCS12
Date: 08/11/05
Keywords: no keywords
[Error: Irreparable invalid markup ('') in entry. Owner must fix manually. Raw contents below.]
I have just started learning microcontrollers.
Can someone help me to provide the program (C) of the following steps:
1. Configure and enable the ATD (i.e. Analog to Digital) subsystem of the Motorola HCS12 (ATDCTL2, 3, 5). 10 Bit accuracy should be used.
2. Trigger conversions on 4 channels of the ATD.
3. Wait for the 4 conversions to be completed.
4. Print the 4 results on the screen on a single line as numbers in the range 0 to 5 Volts.
5. Wait a short while.
6. Return to step 2.
The C program will be run on IAR Embedded Workbench for 68HC12.
Below is my C program (with comments) to the above steps. I think I'm wrong. Thank you for correcting me. Also, I can't do step 5.
#include
typedef unsigned char U8;
typedef unsigned int U16;
#define ATDCL2 (*(volatile U8*)0x0082)
#define ATDCL3 (*(volatile U8*)0x0083)
#define ATDCL4 (*(volatile U8*)0x0084)
#define ATDCL5 (*(volatile U8*)0x0085)
#define ATDSTAT0 (*(volatile U8*)0x0086)
#define ATDDR (*(volatile U16*)0x0090)
void delay (int time)
{
while (time-->0);
}
void ADC_convert (void);
void main (void)
{ /* Step 1 */
ATDCTL2 = 0x80;
ATDCTL3 = 0x00;
ATDCTL4 = 0x01;
ADC_convert ();
}
void ADC_convert ();
{
while(1) /* Step 6 */
{
ATDCTL5 = 0x03; /* Step 2 */
while ((ATDSTAT0 & 0x8000) != 0x8000)
{;} /* Step 3 */
printf ("%x %x %x %x\n", ATDDR[1], ATDDR[2], ATDDR[3], ATDDR[4]); /* Step 4 */
}
}
Source: http://www.livejournal.com/community/algorithms/62745.html
-
Least squares
Date: 08/05/05
Keywords: java
Anyone have a code of writing a least squares algorithm??? I need it for my thesis work.
And if someone have a code of how can I connect search engines from java and enter the top 100 answers for a quary into array I wold be glad twice ;)
Thanks a lot ( And sorry for mistakes in my english)
Source: http://www.livejournal.com/community/algorithms/62547.html
-
attention people who use math in their job!
Date: 08/04/05
Keywords: no keywords
hey, I am taking a course in management science/practical math. We have a project wherein we
interview someone who uses math in their job, particularly management science. The interview would entail answering eight (8) pretty short questions, such as: "Name specific examples of math used in your profession?" "how much of the math did you learn in school, how much at your job?" "what's your attitude toward math?" etc. pretty simple, straight forward questions.
My question is, would you be willing to help me out by answering these questions, and helping me to understand the kind of math you use? It probably wouldn't take more than an hour to answer the questions, if that long.
If you can help me out, I would really appreciate it. Please email me at scorpio398@hemp.net. Thanks so much! Have a good day.
Source: http://www.livejournal.com/community/algorithms/62424.html
-
Resources for Advanced Concepts
Date: 08/04/05
Keywords: no keywords
The more advanced we become, the more we speak in abstract terms and assume underlying implementations.
I find other engineers to be my best resources -- those lunchtime conversations are often the best learning experiences and explorations.
We all do this, so where are the online audio versions?
While it is possible that we could begin recording our own broadcasts, I think it is more practical to organize existing materials such as professor lectures, etc.
If only all these things were neatly organized into a single creative commons,
I would happily download them all listen as I walk the city streets interacting with the physical world.
To date, I have found precious little audio material available which targets our interest.
Thoughts???
Source: http://www.livejournal.com/community/algorithms/62022.html
-
Информация для внесения сообщества в реестр
Date: 08/02/05
Keywords: no keywords
Дорогие все,
для внесения информации об этом сообществе в реестр http://www.lj.com.ru, пожалуйста, дайте в комментариях к этому посту четкие и лаконичное описание сообщества.
Заранее спасибо,
Орука.
Source: http://www.livejournal.com/community/algorithms/61775.html