Follow Slashdot stories on Twitter

 



Forgot your password?
typodupeerror

Comment Re:10,000 URLs? (Score 1) 193

You are partially right. There is no free lunch in the universe. The cost of computing a perfect hash is, I vaguely recall, on the order of O(n lg n). The point is, no matter how big the results get, calculating the array offset into the table is still O(1). In other words, it's just as cheap to add 2 to 4 as it is to add it to 4000000000000. Since this table will probably be accessed an order of magnitude more often than it will be written, it makes sense to pay for the load on the update side, rather than the access side.

Comment Re:10,000 URLs? (Score 1) 193

Not quite. Linear time means that for a given hash table, the search time will be the same (assuming no collisions).

Instead of viewing them both as O(1) look at it like O(1) and P(1). The bigger hash table will have a bigger look-up time but still be constant.

Nope. O(1) is O(1). The constant doesn't change with the size of the input. Otherwise, it would be O(whatever relates the "constant" to the input size). A perfect hash, or a chained hash are, in fact, O(1) for lookups. If something is linear time, then it's O(n). But we have efficient algorithms, such as binary search, that are O(lg n).

Comment Completion (Score 1) 702

Here is a neat one:

First, compute the set of tags for your project. You can use ctags *.c *.h, for example, but other programs may also be able to produce a tags file. The format of the tags file is fairly simple. Each line is the tag, followed by a tab, then the relative path to the file containing that tag, followed by a tab, then a regular expression matching the line on which that tag is found. If the tag occurs more than once, just insert new copies of the line with different regexes.

Now for the neat, Vimmy part. When typing in insert mode, press Crtl-N and you will get a completion window that lists all of your tags. Pretty neat, huh?

The Almighty Buck

The Economics of Free 119

Wired's editor-in-chief Chris Anderson is working on a new book, to be published next year, about the idea of "free" in the old and new economies. Wired is running a long excerpt from the book and some sidebars about the economics of giving away, e.g., CDs and directory assistance. Techdirt has a few quibbles about Anderson's ideas — mostly areas in which he may be shading the argument to sell more books — but mostly buys that the equations of economics continue to work when zeros are plugged in in judicious places.

Slashdot Top Deals

It is wrong always, everywhere and for everyone to believe anything upon insufficient evidence. - W. K. Clifford, British philosopher, circa 1876

Working...