« Home « Chủ đề một số chủ đề nâng cao

Chủ đề : một số chủ đề nâng cao


Có 40+ tài liệu thuộc chủ đề "một số chủ đề nâng cao"

Thuật toán Algorithms (Phần 20)

tailieu.vn

The call treeprint(head7.r) will print out the keys of the tree in order. This defines a sorting method which is remarkably similar to Quicksort, with the node at the root of the tree playing a role similar to that of the partitioning element in Quicksort. A major difference is that the tree-sorting method must use extra memory for the links,...

Thuật toán Algorithms (Phần 21)

tailieu.vn

The “slant” of each 3-node is determined by the dynamics of the algorithm to be described below. There are many red-black trees corresponding to each 2-3-4 tree. It would be possible to enforce a rule that 3-nodes all slant the same way, but there is no reason to do so.. A striking feature of the tree above is the positioning...

Thuật toán Algorithms (Phần 22)

tailieu.vn

Now the procedures from Chapter 14 can be used as is, with a hash function used to choose among the lists. can be used to add something to the table, t:=listsearch(v, heads[v mod M]) to find the first record with key v, and successively set t:=listsearch(v, t) until t=z to find subsequent records with key v.. For example if the...

Thuật toán Algorithms (Phần 23)

tailieu.vn

Radix Searching. Several searching methods proceed by examining the search keys one bit at a time (rather than using full comparisons between keys at each step). These methods, called radix searching methods, work with the bits of the keys themselves, as opposed to the transformed version of the keys used in hashing. As with radix sorting methods, these methods can...

Thuật toán Algorithms (Phần 24)

tailieu.vn

same technique as used in Patricia can be used in binary radix trie searching to eliminate one-way branching, but this only exacerbates the multiple node type problem.. Unlike standard binary tree search, the radix methods are insensitive to the order in which keys are inserted. thtty depend only upon the structure of the keys themselves. For Patricia the pl,icement of...

Thuật toán Algorithms (Phần 25)

tailieu.vn

A search entails using ,he leading d bits of the key to index into the directory, which contains pointc:rs to 1ea.f pages. A leaf page can be pointed to by more tlian one directory entry: to be precise, if a leaf page contains all the records uith keys that begin with a specific k bits (those marked with a vertical...

Thuật toán Algorithms (Phần 26)

tailieu.vn

Rabin observed that the problem is not as different from the standard searching problem as it had seemed, and came up with an algorithm almost as simple as the brute-force algorithm which virtually always runs in time proportional to M + N. This story illustrates that the search for a “better algorithm” is still very often justified: one suspects that...

Thuật toán Algorithms (Phần 27)

tailieu.vn

This leads to the very simple pattelm-matching algorithm implemented below. The program first computes a hash valle hl for the pattern, then a hash value h2 for the first M characters of the text. modq in the variable dM.) Then it proceeds through the text string, using the technique above to compute the hash function for the M characters starting...

Thuật toán Algorithms (Phần 28)

tailieu.vn

PATTERN MATCHING. is the number of the actual initial state. Since we often will want to access states just by number, the most suitable organization for the machine is to use the array representation. We’ll use the three arrays. It would be possible to get by with two-thirds this amount of space, since each state really uses only two rreaningful...

Thuật toán Algorithms (Phần 29)

tailieu.vn

An array p contains the regular expre:;sion being parsed, with an index j pointing to the character currently begin examined. If this results in j being set to M+1, then the regular ex 3ression is in the language described by the grammar. A direct translation from the grammar would simply have term call factor and then term. (Such loops have...

Thuật toán Algorithms (Phần 30)

tailieu.vn

In this section, we’ll examine some algorithms with the op- posite orientation: methods designed primarily to reduce space consumption without using up too much time. Ironically, the techniques that we’ll examine to save space are “coding” methods from information theory which were de- veloped to minimize the amount of information necessary in communications systems and therefore originally intended to save...

Thuật toán Algorithms (Phần 31)

tailieu.vn

the message: this means that we need to save the tree along with the message in order to decode it. It is actually necessary only to store the code array, because the radix search trie which results from inserting the entries from that array into an initially empty tree is the decoding tree.. Thus, the storage savings quoted above is...

Thuật toán Algorithms (Phần 32)

tailieu.vn

Write a program to infer the key, based on the assumption that the frequency of occurrence of each character in odd positions should be roughly equal to the frequency of occurrence of each character in the even positions.. “exclusive or” operation between a binary version of the message with a binary stream from one of the linear congruential random number...

Thuật toán Algorithms (Phần 33)

tailieu.vn

dx:=l.p2.x-1.pl.x. dy:=l.p2.y-1.pl.y;. dx2:=p2.x-1.p2.x. dy2:=p2.y-1.p2.y;. In terms of the variables in this program, it is easy to check that the quantity (da: dyl - dy dzl) is 0 if pl is on the line, positive if pl is on one side, and negative if it is on the other side. The same holds true for the other point, so the product...

Thuật toán Algorithms (Phần 34)

tailieu.vn

(why not just return the points on the hull in any order. but output in the ordered form is obviously more useful, and it has been shown that the unordered computation is no easier to do. For all of the algorithms that we consider, it is convenient to do the computation in place: the array used for the original point...

Thuật toán Algorithms (Phần 35)

tailieu.vn

Suppose it is known in advance that the convex hull of a set of points is a triangle. Is it strictly necessary for the Graham scan to start with a point guaran- teed to be on the hull? Explain why or why not.. Is it strictly necessary for the package-wrapping method to start with a point guaranteed to be on...

Thuật toán Algorithms (Phần 36)

tailieu.vn

adapting to the point set at hand.. 2D Trees. Two-dimensional trees are dynamic, adaptable data structures which are very similar to binary trees but divide up a geometric space in a manner convenient for use in range searching and other problems. The idea is to build binary search trees with points in the nodes, using the y and x coordinates...

Thuật toán Algorithms (Phần 37)

tailieu.vn

by A is performed on the rightmost tree in the diagram above. (Recall that although G and J are visited during this search, any points to the left of G or to the right of J would not be touched.) Finally, the upper endpoints of G, J, F, E, and I are encountered, so those points are successively deleted, leading...

Thuật toán Algorithms (Phần 38)

tailieu.vn

The closest pair on the left half is AC (or AO), the closest pair on the right is JM. If we have the points sorted on y, then the closest pair which is split by the line is found by checking the pairs HI, CI, FK, which is. the closest pair in the whole point set, and finally EK.. Though...

Thuật toán Algorithms (Phần 39)

tailieu.vn

For example, given an airline route map of the eastern U. S., we might be interested in questions like: “What’s the fastest way to get from Providence to Princeton?” Or we might be more interested in money than in time, and look for the cheapest way to get from Providence to Princeton. Such circuits can be represented and processed within...