ToDo

Misc
Obviously fill in more of the problems.

Larry needs to finish up Convex Hull and Sorting. - Larry 10:51, 3 Jan 2005 (EST)

Fill Breadth-First Search, Dijkstra's Algorithm and Floyd-Warshall's Algorithm.

I'd like contributions and someone who has english as native language to correct my text or express better some ideas on Ad Hoc and Simulation categories definitions - Jemerson 28 Dec 2005

The Diff algorithm is an elegant algorithm that has a huge range of applications - it would be of general value to the community. Huffman Encoding and Decision Tries find implementations in many areas as well. I understand that these are based around constructing data structures, but they have a significant broadly valuable algorithmic compnent that renders them of interest. - Andrew Matthews 30 Mar 2006


 * Diff uses the Longest Common Subsequence algorithm. We also have a little information on using diff in useful shell commands. Data structures are part of what the Algorithmist covers, too. See Linked List, Stack, Hash Table, and so on. Welcome to the wiki! :) Sartak 19:58, 29 Mar 2006 (EST)

other sites devoted to cataloging algorithms
A Meta-Request: A list has been started at http://www.listible.com/list/online-catalogues-of-algorithms (which this site has duly been added to) of sites devoted to cataloguing algorithms. It was started because there seems to be a dearth of good sites that cover the topic. I would like to know if there are any other high-quality, free resources out there that can be linked here and which could be added to the listible list as well. - Andrew Matthews 30 Mar 2006

The news group "algogeeks" http://groups.google.com/group/algogeeks also discusses computer programming algorithms.

Pseudocode
We should adopt a uniform set of pseudocode conventions. As it stands right now, just about every article uses its own slightly different flavor of pseudocode. Sartak 16:30, 8 Feb 2006 (EST)

It's true, I agree with you. Larry 01:38, 9 Feb 2006 (EST)


 * I agree even more! But is consensus possible? For example, I'm personally opposed to using the "var n As Integer" syntax -- I think "is" would be a better word than "As", and "As" makes no sense, except to VB coders who are simply used to it. But I guess some people think the "as" syntax is good. Minor example, I know... Other minor examples -- should the code blocks be enclosed in pre tags, or should we just use spaces before each line? The former makes it more clear that it is a code block, but the latter allows more markup within the code, and that's probably why Wikipedia uses it... At any rate, some common things can be agreed on -- for loops should say for i from 1 to n and not  for(i=0;i<n;i++) , etc. --Aboyner 03:23, 9 Feb 2006 (EST)


 * Who said anything about a consensus? :) Have Larry (I assume he runs this wiki) come up with some conventions. If people don't like them, they can suggest new ones. If people don't want to follow the conventions, they'll suffer the wrath of those who update their articles. I'm a libertarian, but I don't always act it. ;) Sartak 03:26, 9 Feb 2006 (EST)

Partial Writeups
How does editing work here? I would like to write the Exhaustive_Search page for example. That would probably take me about two weeks. Can I post a "working" sign and start editing it? --Rgrig


 * Yeah, posting partial writeups and rough drafts is very welcome. Once you have a piece of crap on the web with your name on it, you have lots of incentive to polish it ;).  Also, you might get useful feedback.  --Rrenaud 17:25, 6 Mar 2006 (EST)

UVa_10591
Could someone kindly write up UVa problem 10591 -- Happy Number? Most importantly, are there any gotchas? Sartak 03:11, 26 Mar 2006 (EST)

There's nothing really special about 10591, just remember to store the number and scan through it and see whether it forms a cycle. --Roticv 06:37, 26 Mar 2006 (EST)


 * Odd. I guess there just must be some corner case that my algorithm misses. Sartak 00:27, 27 Mar 2006 (EST)


 * What is your algorithm? I haven't solved the problem, but maybe it misses a case like a -> b -> c -> b? --Rrenaud 08:51, 27 Mar 2006 (EST)


 * I think it is more likekly to miss cases like a -> b -> c -> a or something like that. --Roticv 08:26, 28 Mar 2006 (EST)


 * The algorithm is: add the first term to a list, calculate the next term, see if this new term is already in the list, if so, quit. If this new term is a 1, quit. Otherwise, add this new term to the list and continue. I'm thinking the problem is an implementation error, not an algorithmic one, because this appears to be a fairly straightforward problem. Here is the unadultered code. Perhaps my array is too small? Sartak 00:22, 29 Mar 2006 (EST)


 * Your program doesn't print "#" after the word "Case". Also, you can read int's with just scanf("%d", &n); and the longest cycle in this problem can't be longer than $$9^3+1$$. Sweepline 08:17, 29 Mar 2006 (EST)


 * It's nice that Sweepline caught your bug. In reading your code, I have a couple suggestions.  The first is that you shouldn't put large arrays on the stack.  Even if it works here, it is quite easy to seg fault by overloading the stack.  The second suggestion is algorithmic, you can make your solution a lot faster by precomputing the "happiness" of 0-729, and then you simply iterate the function once (which will bring the numbers into the precomputed range, max original input is 999,999,999 which maps 729), and do a lookup. --Rrenaud 10:43, 29 Mar 2006 (EST)


 * I didn't precomp, but I didn't clear my cache either. Someone should do the writeup now that it's figured out ;) Larry 14:01, 29 Mar 2006 (EST)


 * Thanks for the suggestions, fellas. And good eye for spotting that bug, Sweepline. Very silly of me. I should use diff for checking correctness instead of eyeballing it. Sartak 18:54, 29 Mar 2006 (EST)


 * Thanks for the formatting, though I was going to move this to 10591's Talk page when someone submits that page.. I make stupid formatting mistakes like that all the time.. costed me 4 WA's just the other day.. Larry 12:21, 30 Mar 2006 (EST)

UVa_10139
Can anybody please write UVa problem 10139 -- Factovisors? I could find a lot of test data in the UVa forums but that's not much help. Looks like some overflow issues that I am not able to correct.

You can get away with it by using ints, at least for me. My algorithm is O( N^1/2 ), where N is size of the divisor. You got all your special cases? Larry 22:33, 24 May 2006 (EDT)

The method I used was: Sieve until 1<<16, store them in an array. For each prime which is a factor of divisor d: find what max power of prime p divides d (say a). Then find out the max power of p that divides n! (say b). If b >= a for all prime factors of the divisor d, then d divides n! otherwise not. I checked for cases when d = 0, d = 1, n = 0. Anything else I should check it for?--Shalinmangar 01:49, 25 May 2006 (EDT)

My algo was even more naive than that - it doesn't sieve.. it sounds about right though.. Larry 15:36, 25 May 2006 (EDT)