In Practice

Code39 Printer In JavaUsing Barcode generation for Java Control to generate, create Code 3/9 image in Java applications.

2413 Implement the f i n d operation nonrecursively Is there a noticeable difference in running time

Barcode Encoder In JavaUsing Barcode creation for Java Control to generate, create barcode image in Java applications.

2414 Suppose that you want to add an extra operation, deunion, which undoes the last u n i o n operation not already undone One way to do so is to use union-by-rank-but a compressionless find-and use a stack to store the old state prior to a union A d e u n i o n can be implemented by popping the stack to retrieve an old state a Why can't we use path compression b Implement the union/find/deunion algorithm

Recognize Bar Code In JavaUsing Barcode recognizer for Java Control to read, scan read, scan image in Java applications.

Programming Problems

Generating Code 39 Full ASCII In Visual C#Using Barcode creator for VS .NET Control to generate, create Code 3 of 9 image in VS .NET applications.

2415 Write a program to determine the effects of path compression and the various union strategies Your program should process a long sequence of equivalence operations, using all the strategies discussed (including path halving, introduced in Exercise 2412) 2416 Implement Kruskal's algorithm 2417 An alternative minimum spanning tree algorithm is due to Prim [ 121 It works by growing a single tree in successive stages Start by picking any node as the root At the start of a stage, some nodes are part of the tree and the rest are not In each stage, add the minimumcost edge that connects a tree node with a nontree node An implementation of Prim's algorithm is essentially identical to Dijkstra's shortest-path algorithm given in Section 153, with an update rule:

USS Code 39 Drawer In .NET FrameworkUsing Barcode maker for ASP.NET Control to generate, create Code 39 Full ASCII image in ASP.NET applications.

(instead of d,=min(d,,, dl+ c,,,)) Also, as the graph is undirected, each edge appears in two adjacency lists Implement Prim's algorithm and compare its performance to that of Kruskal's algorithm

Printing Code 3/9 In .NET FrameworkUsing Barcode creation for VS .NET Control to generate, create ANSI/AIM Code 39 image in .NET framework applications.

2418 Write a program to solve the offline NCA problem for binary trees Test its efficiency by constructing a random binary search tree of 10,000 elements and performing 10,000 ancestor queries

Generating USS Code 39 In VB.NETUsing Barcode drawer for .NET framework Control to generate, create Code 39 Extended image in Visual Studio .NET applications.

References

Bar Code Creator In JavaUsing Barcode creation for Java Control to generate, create bar code image in Java applications.

Representation of each set by a tree was proposed in [8] [ I ] attributes path compression to McIlroy and Morris and contains several applications of the unionlfind data structure Kruskal's algorithm is presented in [ I I], and the alternative discussed in Exercise 2417 is from [12] The NCA algorithm is described in [2] Other applications are described in [ 151 The O ( M log*N) bound for the unionlfind problem is from [9] Tarjan [I31 obtained the O ( M a ( M ,N)) bound and showed that the bound is tight That the bound is intrinsic to the general problem and cannot be improved

Code 128B Encoder In JavaUsing Barcode maker for Java Control to generate, create Code 128A image in Java applications.

by an alternative algorithm is demonstrated in 1141 A more precise bound for M < N appears in [3] and [I 61 Various other strategies for path compression and union achieve the same bounds; see 1161 for details If the sequence of union operations is known in advance, the uniontfind problem can be solved in O ( M ) time [7] This result can be used to show that the offline NCA problem is solvable in linear time Average-case results for the uniodfind problem appear in [6], [lo], [ 171, and [4] Results bounding the running time of any single operation (as opposed to the entire sequence) are given in [S]

Printing UPCA In JavaUsing Barcode generation for Java Control to generate, create UPC A image in Java applications.

1 A V Aho, J E Hopcroft, and J D Ullman, The Design and Analysis of Computer Algorithms, Addison-Wesley, Reading, Mass, 1974 2 A V Aho, J E Hopcroft, and J D Ullman, "On Finding Lowest Common Ancestors in Trees," SIAM Journal on Computing 5 (1976), 115-132 3 L Banachowski, "A Complement to Tarjan's Result about the Lower Bound on the Set Union Problem," Information Processing Letters 11 (1980), 59-65 4 B Bollobas and I Simon, "Probabilistic Analysis of Disjoint Set Union Algorithms," SIAM Journal on Computing 22 (1993), 1053108b 5 N Blum, "On the Single-Operation Worst-Case Time Complexity of the Disjoint Set Union Problem," SIAM Journal on Computing 15 (1986), 1021-1024 6 J Doyle and R L Rivest, "Linear Expected Time of a Simple Union Find Algorithm," Information Processing Letters 5 (1976), 146-148 7 H N Gabow and R E Tarjan, "A Linear-Time Algorithm for a Special Case of Disjoint Set Union," Journal of Computer and System Sciences 30 (1985), 209-22 1 8 B A Galler and M J Fischer, "An Improved Equivalence Algorithm," Communications of the ACM 7 (1964), 301-303 9 J E Hopcroft and J D Ullman, "Set Merging Algorithms," SIAM Journal on Computing 2 (1973), 294-303 10 D E Knuth and A Schonage, "The Expected Linearity of a Simple Equivalence Algorithm," Theoretical Computer Science 6 (1978), 281-315

EAN13 Maker In JavaUsing Barcode creation for Java Control to generate, create EAN-13 image in Java applications.

11 J B Kruskal, Jr, "On the Shortest Spanning Subtree of a Graph and the Traveling Salesman Problem," Proceedings of the Aniericaiz Matheizzatical Socieh 7 ( I 956) 48-50 12 R C Prim, "Shortest Connection Networks and Some Generalizations," Bell Systern Technical Joiirizal36 (1957), 1389-140 1 13 R E Tarjan, "Efficiency of a Good but Not Linear Set Union Algorithm," Journal of the ACM 22 (1 975), 2 15-225 14 R E Tarjan, "A Class of Algorithms Which Require Nonlinear Time to Maintain Disjoint Sets," Jourizal of Computer arzd Sysren~ Scieizces 18 (1979), 1 10-127 15 R E Tarjan, "'Applications of Path Compression on Balanced of Trees," Jour~zal the ACM 26 ( 1979), 690-7 15 16 R E Tarjan and J van Leeuwen, "Worst Case Analysis of Set Union Algorithms," Journal of the ACM 31 ( 1984), 245-28 1 17 A C Yao "On the Average Behavior of Set Merging Algorithms," Proceedings of the Eighth Annual ACM Sjrnposi~iinon the Theon* of Coinp~tfation1976) 192-1 95 (

Paint Code39 In JavaUsing Barcode printer for Java Control to generate, create Code39 image in Java applications.

Draw 2 Of 5 Industrial In JavaUsing Barcode maker for Java Control to generate, create 2 of 5 Standard image in Java applications.

ANSI/AIM Code 39 Creation In Visual C#Using Barcode generation for .NET framework Control to generate, create Code-39 image in .NET applications.

Creating UPC-A Supplement 2 In VS .NETUsing Barcode encoder for .NET framework Control to generate, create GTIN - 12 image in VS .NET applications.

GTIN - 12 Printer In Visual Studio .NETUsing Barcode drawer for ASP.NET Control to generate, create UPC-A Supplement 5 image in ASP.NET applications.