Re: [algogeeks] Sort the data from a big file.

2009-12-21 Thread Linus Probert
If the numbers are unique you could use a bitmap-sort this way you could easily read just parts of the file at a time. If they aren't unique it gets a bit trickier. /L dinesh bansal wrote: > Hi All, > > Suppose I have a big file (~100M) containing integer data. I want to sort > this file. The p

Re: [algogeeks] An interview question

2009-12-18 Thread Linus Probert
I agree, if memory is not an issue use a breadth first search, but if memory is an issue it can get quite interesting. sharad kumar wrote: > if its a digraph make use of topsort or make use of bfs > > On Thu, Dec 17, 2009 at 5:19 PM, vicky wrote: > > >> given a graph G(V,E) and a source vert

Re: [algogeeks] Difference between Dijkstra's algorithm and Bellman-Ford's algorithm?

2009-12-14 Thread Linus Probert
There are some time differences and all, the vital part is that bellman-ford handles negative weights on the edges in the graph, Dijkstras does not. Besides that there is some time difference and so forth. Bellman-ford: O(V|E|) Dijkstra: O(v²) ? (give or take depending on the heap or priority qu

[algogeeks] Typesetting.

2009-12-12 Thread Linus Probert
Heres a nice little problem that has been keeping me up for days. We have a set of n words (where a word is anything between two spaces). Our printer only allows M characters per line included the spaces between the lines. We want to provide the optimal way of outputting our text with an even sp