- Page 1 and 2: Data Structures and Algorithms in J
- Page 3 and 4: To Isabel -Roberto Tamassia Preface
- Page 5 and 6: The Java code implementing fundamen
- Page 7 and 8: PL6. Object-Oriented Programming Ch
- Page 9 and 10: 14. Memory A. Useful Mathematical F
- Page 11 and 12: Sun, Nikos Triandopoulos, Luca Vism
- Page 13 and 14: Getting Started: Classes, Types, an
- Page 15 and 16: 39 1.7 An Example Program..........
- Page 17 and 18: The main "actors" in a Java program
- Page 19 and 20: else interface switch boolean exten
- Page 21 and 22: Class modifiers are optional keywor
- Page 23 and 24: Comments Note the use of comments i
- Page 25 and 26: Calling the new operator on a class
- Page 27 and 28: n.longValue( ) float Float n = new
- Page 29 and 30: The Dot Operator Every object refer
- Page 31 and 32: object (assuming we are allowed acc
- Page 33 and 34: Note the uses of instance variables
- Page 35: 1.2 Methods Methods in Java are con
- Page 39 and 40: is intended to be used to initializ
- Page 41 and 42: } int i = 512; double e = 2.71828;
- Page 43 and 44: % the modulo operator This last ope
- Page 45 and 46: zeros >>> shift bits right, filling
- Page 47 and 48: 3 add./subt. + − 4 shift > >>> 5
- Page 49 and 50: double d1 = 3.2; double d2 = 3.9999
- Page 51 and 52: String s = " " + 4.5; // correct, b
- Page 53 and 54: System.out.println("This is tough."
- Page 55 and 56: Defining a For Loop Here is the syn
- Page 57 and 58: that input and inform the user that
- Page 59 and 60: if (a[i][j] == 0) { foundFlag = tru
- Page 61 and 62: the array, we will sometimes refer
- Page 63 and 64: The cells of this new array, "a," a
- Page 65 and 66: ways to reference such an object. W
- Page 67 and 68: float height = s.nextFloat(); Syste
- Page 69 and 70: We show the CreditCard class in Cod
- Page 71 and 72: Code Fragment 1.7: Output from the
- Page 73 and 74: a text editor class may wish to def
- Page 75 and 76: The process of writing a Java progr
- Page 77 and 78: low-level implementation details. A
- Page 79 and 80: variable declaration, or method def
- Page 81 and 82: • @exception exception-name descr
- Page 83 and 84: A careful testing plan is an essent
- Page 85 and 86: Modify the CreditCard class from Co
- Page 87 and 88:
A common punishment for school chil
- Page 89 and 90:
Object-Oriented Design Principles .
- Page 91 and 92:
java.datastructures.net 2.1 Goals,
- Page 93 and 94:
Abstraction The notion of abstracti
- Page 95 and 96:
2.1.3 Design Patterns One of the ad
- Page 97 and 98:
Example 2.1: Consider a class S tha
- Page 99 and 100:
S's a() method when asked for o.a()
- Page 101 and 102:
Sometimes, in a Java class, it is c
- Page 103 and 104:
103
- Page 105 and 106:
Code Fragment 2.3: Class for arithm
- Page 107 and 108:
A Fibonacci Progression Class As a
- Page 109 and 110:
Figure 2.5 : Inheritance diagram fo
- Page 111 and 112:
2.3 Exceptions Exceptions are unexp
- Page 113 and 114:
goShopping(); // I don't have to tr
- Page 115 and 116:
try problem… // This code might h
- Page 117 and 118:
instance, wish to identify some of
- Page 119 and 120:
The class BoxedItem shows another f
- Page 121 and 122:
comparability feature to a class (i
- Page 123 and 124:
• T and S are class types and S i
- Page 125 and 126:
We show in Code Fragment 2.13 a cla
- Page 127 and 128:
Starting with 5.0, Java includes a
- Page 129 and 130:
public void insert (P person, P oth
- Page 131 and 132:
• Class Goat extends Object and a
- Page 133 and 134:
((Place) usa).printMe(); } } class
- Page 135 and 136:
C-2.5 Write a program that consists
- Page 137 and 138:
Chapter 3 Arrays, Linked Lists, and
- Page 139 and 140:
3.4 Circularly Linked Lists and Lin
- Page 141 and 142:
A Class for High Scores Suppose we
- Page 143 and 144:
Note that we include a method, toSt
- Page 145 and 146:
Once we have identified the place i
- Page 147 and 148:
Object Removal Suppose some hot sho
- Page 149 and 150:
These methods for adding and removi
- Page 151 and 152:
This description is much closer to
- Page 153 and 154:
there is no swap needed, and return
- Page 155 and 156:
num = [10,12,19,28,33,38,41,46,48,5
- Page 157 and 158:
In Code Fragment 3.9, we give a sim
- Page 159 and 160:
Many computer games, be they strate
- Page 161 and 162:
We give a complete Java class for m
- Page 163 and 164:
Code Fragment 3.11: A simple, compl
- Page 165 and 166:
Like an array, a singly linked list
- Page 167 and 168:
Code Fragment 3.14: Inserting a new
- Page 169 and 170:
The reverse operation of inserting
- Page 171 and 172:
Header and Trailer Sentinels To sim
- Page 173 and 174:
Likewise, we can easily perform an
- Page 175 and 176:
Figure 3.17: Adding a new node afte
- Page 177 and 178:
Code Fragment 3.23: Java class DLis
- Page 179 and 180:
We make the following observations
- Page 181 and 182:
advance(): Advance the cursor to th
- Page 183 and 184:
Some Observations about the CircleL
- Page 185 and 186:
Some Sample Output 185
- Page 187 and 188:
We show in Code Fragment 3.27 thein
- Page 189 and 190:
The factorial function can be defin
- Page 191 and 192:
Each multiple of 1 inch also has a
- Page 193 and 194:
The trace for drawTicks is more com
- Page 195 and 196:
The simplest form of recursion is l
- Page 197 and 198:
nonrecursive part of each call. Mor
- Page 199 and 200:
3.5.2 Binary Recursion When an algo
- Page 201 and 202:
Unfortunately, in spite of the Fibo
- Page 203 and 204:
To solve such a puzzle, we need to
- Page 205 and 206:
3.6 Exercises For source code and h
- Page 207 and 208:
C-3.2 Let A be an array of size n
- Page 209 and 210:
Write a recursive Java program that
- Page 211 and 212:
Chapter Notes The fundamental data
- Page 213 and 214:
Primitive Operations . . . . . . .
- Page 215 and 216:
4.1.2 The Logarithm function One of
- Page 217 and 218:
4.1.5 The Quadratic function Anothe
- Page 219 and 220:
which assigns to an input value n t
- Page 221 and 222:
For example, we have the following:
- Page 223 and 224:
primarily as slopes. Even so, the e
- Page 225 and 226:
and y-coordinate equal to the runni
- Page 227 and 228:
Counting Primitive Operations Speci
- Page 229 and 230:
Simplifying the Analysis Further In
- Page 231 and 232:
Proposition 4.7: The Algorithmarray
- Page 233 and 234:
is O(4n 2 + 6n log n), although thi
- Page 235 and 236:
256 16 4 16 64 256 4,096 65,536 32
- Page 237 and 238:
Running Maximum Problem Size (n) Ti
- Page 239 and 240:
should the constant factors they "h
- Page 241 and 242:
• There are two nested for loops,
- Page 243 and 244:
This definition leads immediately t
- Page 245 and 246:
Besides showing a use of the contra
- Page 247 and 248:
We may sometimes feel overwhelmed b
- Page 249 and 250:
The number of operations executed b
- Page 251 and 252:
R-4.22 Show that if d(n) is O(f(n))
- Page 253 and 254:
R-4.29 Show that 2 n+1 is O(2 n ).
- Page 255 and 256:
Describe a method for finding both
- Page 257 and 258:
Describe, in pseudo-code a method f
- Page 259 and 260:
Stacks.............................
- Page 261 and 262:
down on the stack to become the new
- Page 263 and 264:
7 (5) top() 5 (5) pop() 5 () pop()
- Page 265 and 266:
In addition, we must define excepti
- Page 267 and 268:
5.1.2 A Simple Array-Based Stack Im
- Page 269 and 270:
we indicate that the stack no longe
- Page 271 and 272:
271
- Page 273 and 274:
273
- Page 275 and 276:
The array implementation of a stack
- Page 277 and 278:
of the list and return its element.
- Page 279 and 280:
5.1.5 Matching Parentheses and HTML
- Page 281 and 282:
Matching Tags in an HTML Document A
- Page 283 and 284:
Code Fragment 5.12: Java program fo
- Page 285 and 286:
Another fundamental data structure
- Page 287 and 288:
true ( ) enqueue(9) - (9) enqueue(7
- Page 289 and 290:
5.2.2 A Simple Array-Based Queue Im
- Page 291 and 292:
Using the Modulo Operator to Implem
- Page 293 and 294:
which gives the correct result both
- Page 295 and 296:
Each of the methods of the singly l
- Page 297 and 298:
potato is equivalent to dequeuing a
- Page 299 and 300:
- (3) addFirst(5) - (5,3) removeFir
- Page 301 and 302:
Thus, a doubly linked list can be u
- Page 303 and 304:
Code Fragment 5.18: Class NodeDeque
- Page 305 and 306:
5.4 Exercises For source code and h
- Page 307 and 308:
Suppose Alice has picked three dist
- Page 309 and 310:
Implement a program that can input
- Page 311 and 312:
223 6.1.3 A Simple Array-Based Impl
- Page 313 and 314:
Sequences....................... 25
- Page 315 and 316:
- (7) add(0,4) - (4,7) get(1) 7 (4,
- Page 317 and 318:
get(size() −1) addFirst(e) add(0,
- Page 319 and 320:
have to be shifted forward. A simil
- Page 321 and 322:
Moreover, the java.util.ArrayList c
- Page 323 and 324:
An Amortized Analysis of Extendable
- Page 325 and 326:
Proposition 6.2: Let S be an array
- Page 327 and 328:
linked list without revealing this
- Page 329 and 330:
The node list ADT allows us to view
- Page 331 and 332:
(8,3,5) set(p 3 ,7) 3 (8,7,5) addAf
- Page 333 and 334:
Deque Method Realization with Node-
- Page 335 and 336:
new node v to hold the element e, l
- Page 337 and 338:
In conclusion, using a doubly linke
- Page 339 and 340:
Code Fragment 6.11: Portions of the
- Page 341 and 342:
An iterator is a software design pa
- Page 343 and 344:
Since looping through the elements
- Page 345 and 346:
Code Fragment 6.15: The iterator()
- Page 347 and 348:
the last element. That is, it uses
- Page 349 and 350:
isEmpty() isEmpty() O(1) time get(i
- Page 351 and 352:
deletion is at cursor; A is O(n),L
- Page 353 and 354:
where n is the number of elements i
- Page 355 and 356:
Efficiency Trade-Offs with an Array
- Page 357 and 358:
357
- Page 359 and 360:
The previous implementation of a fa
- Page 361 and 362:
decreasing order and then pops up a
- Page 363 and 364:
accesses several Web pages and then
- Page 365 and 366:
6.6 Exercises For source code and h
- Page 367 and 368:
R-6.16 Describe how to create an it
- Page 369 and 370:
Think about how to extend the circu
- Page 371 and 372:
C-6.24 Isabel has an interesting wa
- Page 373 and 374:
Chapter 7 Trees Contents 7.1 Genera
- Page 375 and 376:
7.3.3 Properties of Binary Trees ..
- Page 377 and 378:
Electronics R'Us. The children of t
- Page 379 and 380:
Edges and Paths in Trees An edge of
- Page 381 and 382:
There are also a number of generic
- Page 383 and 384:
Figure 7.5: The linked structure fo
- Page 385 and 386:
Code Fragment 7.3: Method depth wri
- Page 387 and 388:
Code Fragment 7.6: Algorithm height
- Page 389 and 390:
Example 7.6: The preorder traversal
- Page 391 and 392:
Code Fragment 7.10: Algorithm paren
- Page 393 and 394:
The postorder traversal method is u
- Page 395 and 396:
Although the preorder and postorder
- Page 397 and 398:
A Recursive Binary Tree Definition
- Page 399 and 400:
same depth d as the level dof T. In
- Page 401 and 402:
Figure 7.13: Operation that removes
- Page 403 and 404:
We use a Java interface BTPosition
- Page 405 and 406:
addition to the Binary Tree interfa
- Page 407 and 408:
Code Fragment 7.17: Portions of the
- Page 409 and 410:
Code Fragment 7.18: Portions of the
- Page 411 and 412:
Binary Tree interface. (Continues i
- Page 413 and 414:
• Methods size() and isEmpty() us
- Page 415 and 416:
The level numbering function p sugg
- Page 417 and 418:
Time size, isEmpty O(1) iterator, p
- Page 419 and 420:
As is the case for general trees, t
- Page 421 and 422:
The inorder traversal of a binary t
- Page 423 and 424:
The inorder traversal can also be a
- Page 425 and 426:
start an Euler tour by initializing
- Page 427 and 428:
• Calls auxiliary method visitRig
- Page 429 and 430:
ExpressionTerm at each node. Class
- Page 431 and 432:
Code Fragment 7.31: Class EvaluateE
- Page 433 and 434:
Let T be an n-node binary tree that
- Page 435 and 436:
c. Let T be a proper binary tree wi
- Page 437 and 438:
Creativity C-7.1 For each node v in
- Page 439 and 440:
C-7.10 Two ordered trees T ′ and
- Page 441 and 442:
postorderDraw is similar to preorde
- Page 443 and 444:
Describe a nonrecursive method for
- Page 445 and 446:
P-7.8 Write a program that can play
- Page 447 and 448:
Chapter 8 Priority Queues Contents
- Page 449 and 450:
The Heap Data Structure............
- Page 451 and 452:
As in the examples above from an ai
- Page 453 and 454:
package includes a similar Entry in
- Page 455 and 456:
Code Fragment 8.3: Class representi
- Page 457 and 458:
insert(5,A) e 1 [=(5,A)] {(5,A)} in
- Page 459 and 460:
size() size() isEmpty() isEmpty() i
- Page 461 and 462:
at the time the method is executed.
- Page 463 and 464:
Code Fragment 8.7: Java class Defau
- Page 465 and 466:
465
- Page 467 and 468:
Insertion-Sort If we implement the
- Page 469 and 470:
An efficient realization of a prior
- Page 471 and 472:
Proposition 8.5: A heap T storing n
- Page 473 and 474:
The Array List Representation of a
- Page 475 and 476:
java.util.ArrayList. (Continues in
- Page 477 and 478:
Code Fragment 8.12: Class ArrayList
- Page 479 and 480:
8.3.3 Implementing a Priority Queue
- Page 481 and 482:
The upward movement of the newly in
- Page 483 and 484:
Analysis Table 8.3 shows the runnin
- Page 485 and 486:
We conclude that the heap data stru
- Page 487 and 488:
Code Fragment 8.15: Remaining auxil
- Page 489 and 490:
As we have previously observed, rea
- Page 491 and 492:
8.3.6 Bottom-Up Heap Construction
- Page 493 and 494:
Recursive Bottom-Up Heap Constructi
- Page 495 and 496:
Figure 8.11: Visual justification o
- Page 497 and 498:
insert(3,B) e 2 {(3,B), (5,A)} inse
- Page 499 and 500:
The performance of an adaptable pri
- Page 501 and 502:
Code Fragment 8.18: An adaptable pr
- Page 503 and 504:
503
- Page 505 and 506:
Illustrate the execution of the sel
- Page 507 and 508:
A group of children want to play a
- Page 509 and 510:
C-8.13 We can represent a path from
- Page 511 and 512:
P-8.1 Give a Java implementation of
- Page 513 and 514:
Chapter 9 Maps and Dictionaries Con
- Page 515 and 516:
9.3.3 Ordered Search Tables and Bin
- Page 517 and 518:
In either case, we use a key as a u
- Page 519 and 520:
null {(5,A), (7,B)} put(2,C) null {
- Page 521 and 522:
get(k) put(k,v) put(k,v) remove(k)
- Page 523 and 524:
time of map operations in an n-entr
- Page 525 and 526:
Hash Codes in Java The generic Obje
- Page 527 and 528:
of the word lists provided in two v
- Page 529 and 530:
6 6 2 7 14 2 8 105 2 9 18 2 10 277
- Page 531 and 532:
however, for if there is a repeated
- Page 533 and 534:
only the one entry. We leave the de
- Page 535 and 536:
key k will skip over cells containi
- Page 537 and 538:
537
- Page 539 and 540:
539
- Page 541 and 542:
9.2.7 Load Factors and Rehashing In
- Page 543 and 544:
example, when pundits study politic
- Page 545 and 546:
for the keys, and we provide additi
- Page 547 and 548:
findAll(2) {(2,C), (2,E)} {(5,A), (
- Page 549 and 550:
Analysis of a List-Based Dictionary
- Page 551 and 552:
for entries with duplicate keys. As
- Page 553 and 554:
Figure 9.7: Realization of a dictio
- Page 555 and 556:
Considering the running time of bin
- Page 557 and 558:
Method List Hash Table Search Table
- Page 559 and 560:
An example of a skip list is shown
- Page 561 and 562:
We give a pseudo-code description o
- Page 563 and 564:
the new entry are drawn with thick
- Page 565 and 566:
can go into what is almost an infin
- Page 567 and 568:
of entries in the dictionary at the
- Page 569 and 570:
O(n) O(logn) (expected) 9.5.2 The O
- Page 571 and 572:
lastKey() last().getValue() get(las
- Page 573 and 574:
Formally, we say a price-performanc
- Page 575 and 576:
What is the worst-case running time
- Page 577 and 578:
Describe how to use a map to implem
- Page 579 and 580:
in memory, describe a method runnin
- Page 581 and 582:
please see the various research pap
- Page 583 and 584:
Amortized Analysis of Splaying ★.
- Page 585 and 586:
10.1.1 Searching To perform operati
- Page 587 and 588:
We can also show that a variation o
- Page 589 and 590:
The implementation of the remove(k)
- Page 591 and 592:
O(h) time, where h is the height of
- Page 593 and 594:
Class BinarySearchTree uses locatio
- Page 595 and 596:
Code Fragment 10.4: Class BinarySea
- Page 597 and 598:
Code Fragment 10.5: Class BinarySea
- Page 599 and 600:
10.2 AVL Trees In the previous sect
- Page 601 and 602:
(10.3) > 2 i · n(h − 2i). That i
- Page 603 and 604:
We restore the balance of the nodes
- Page 605 and 606:
Figure 10.9: Schematic illustration
- Page 607 and 608:
find another, we perform a restruct
- Page 609 and 610:
In Code Fragments 10.7 and 10.8, we
- Page 611 and 612:
Code Fragment 10.8: Auxiliary metho
- Page 613 and 614:
10.3 Splay Trees Another way we can
- Page 615 and 616:
We perform a zig-zig or a zig-zag w
- Page 617 and 618:
Figure 10.16: Example of splaying a
- Page 619 and 620:
10.3.2 When to Splay The rules that
- Page 621 and 622:
10.3.3 Amortized Analysis of Splayi
- Page 623 and 624:
When we perform a splaying, we pay
- Page 625 and 626:
≤ r ′(x)−r(x) ≤ 3(r ′(x)
- Page 627 and 628:
Proposition 10.6: Consider a sequen
- Page 629 and 630:
629
- Page 631 and 632:
The dictionary we store at each nod
- Page 633 and 634:
h≤log(n+1) (10.10) are true. To j
- Page 635 and 636:
insertion of 5, which causes an ove
- Page 637 and 638:
A split operation affects a constan
- Page 639 and 640:
operation; (f) after the fusion ope
- Page 641 and 642:
collection returned by findAll. The
- Page 643 and 644:
Figure 10.27: Correspondence betwee
- Page 645 and 646:
• Take node z, its parent v, and
- Page 647 and 648:
Figures 10.30 and 10.31 show a sequ
- Page 649 and 650:
The cases for insertion imply an in
- Page 651 and 652:
and (b) and for node b in part (c)
- Page 653 and 654:
Case 2: The Sibling y of r is Black
- Page 655 and 656:
Case 3: The Sibling y of r is Red.
- Page 657 and 658:
constant amount of work (in a restr
- Page 659 and 660:
Performance of Red-Black Trees Tabl
- Page 661 and 662:
Thus, a red-black tree achieves log
- Page 663 and 664:
Methods insert (Code Fragment 10.10
- Page 665 and 666:
665
- Page 667 and 668:
Are the rotations in Figures 10.8 a
- Page 669 and 670:
T is a (2,4) tree. c. T is a red-bl
- Page 671 and 672:
C-10.8 Let D be an ordered dictiona
- Page 673 and 674:
Projects P-10.1 N-body simulations
- Page 675 and 676:
early approaches to balancing trees
- Page 677 and 678:
11.5 Comparison of Sorting Algorith
- Page 679 and 680:
elements of S; that is, S 1 contain
- Page 681 and 682:
for a child invocation to return. (
- Page 683 and 684:
Proposition 11.1: The merge-sort tr
- Page 685 and 686:
idea is to iteratively remove the s
- Page 687 and 688:
merge-sort, are implemented by eith
- Page 689 and 690:
Code Fragment 11.3: Methods mergeSo
- Page 691 and 692:
A Nonrecursive Array-Based Implemen
- Page 693 and 694:
the case when n is a power of 2. (W
- Page 695 and 696:
each node of the quick-sort tree. T
- Page 697 and 698:
eturn). Note the divide steps perfo
- Page 699 and 700:
Performing Quick-Sort on Arrays and
- Page 701 and 702:
E has at least one element (the piv
- Page 703 and 704:
the size of the input for this call
- Page 705 and 706:
In-place quick-sort modifies the in
- Page 707 and 708:
Unfortunately, the implementation a
- Page 709 and 710:
algorithm to output the elements of
- Page 711 and 712:
itself is a sequence (of entries wi
- Page 713 and 714:
first component, we guarantee that
- Page 715 and 716:
Bucket-Sort and Radix-Sort Finally,
- Page 717 and 718:
generic merging takes time proporti
- Page 719 and 720:
• In class Union Merge, merge cop
- Page 721 and 722:
Performance of the Sequence Impleme
- Page 723 and 724:
With this partition data structure,
- Page 725 and 726:
The Log-Star and Inverse Ackermann
- Page 727 and 728:
This may come as a small surprise,
- Page 729 and 730:
is the same as the expected number
- Page 731 and 732:
Show that the probability that any
- Page 733 and 734:
Describe what additional informatio
- Page 735 and 736:
Argue why the previous claim proves
- Page 737 and 738:
threads of b. Describe and analyze
- Page 739 and 740:
Design and implement a stable versi
- Page 741 and 742:
Contents 12.1 String Operations ...
- Page 743 and 744:
567 12.5 Text Similarity Testing ..
- Page 745 and 746:
finite, we usually assume that the
- Page 747 and 748:
Return and update S to be the strin
- Page 749 and 750:
Performance The brute-force pattern
- Page 751 and 752:
We will formalize these heuristics
- Page 753 and 754:
In Figure 12.3, we illustrate the e
- Page 755 and 756:
A Java implementation of the BM pat
- Page 757 and 758:
using an alternative shift heuristi
- Page 759 and 760:
In Figure 12.5, we illustrate the e
- Page 761 and 762:
A Java implementation of the KMP pa
- Page 763 and 764:
12.3 Tries The pattern matching alg
- Page 765 and 766:
The worst case for the number of no
- Page 767 and 768:
A compressed trie is similar to a s
- Page 769 and 770:
trie. In the next section, we prese
- Page 771 and 772:
if such a path can be traced. The d
- Page 773 and 774:
Let m be the size of pattern P and
- Page 775 and 776:
transmit our text. Likewise, text c
- Page 777 and 778:
12.4.2 The Greedy Method Huffman's
- Page 779 and 780:
There are few algorithmic technique
- Page 781 and 782:
Turning this definition of L[i, j]
- Page 783 and 784:
Reinforcement R-12.1 List the prefi
- Page 785 and 786:
C-12.5 Say that a pattern P of leng
- Page 787 and 788:
suffix of length j in y. Design an
- Page 789 and 790:
pattern matching. The reader intere
- Page 791 and 792:
Depth-First Search Traversing a Dig
- Page 793 and 794:
Example 13.2: We can associate with
- Page 795 and 796:
In the propositions that follow, we
- Page 797 and 798:
are communication connections betwe
- Page 799 and 800:
vertices and m edges, an edge list
- Page 801 and 802:
The main feature of the edge list s
- Page 803 and 804:
• The edge object for an edge e w
- Page 805 and 806:
insertVertex, insertEdge, removeEdg
- Page 807 and 808:
not. The optimal performance of met
- Page 809 and 810:
came from to get to v, and repeat t
- Page 811 and 812:
We can visualize a DFS traversal by
- Page 813 and 814:
• Computing a cycle in G, or repo
- Page 815 and 816:
depend on the implementation of the
- Page 817 and 818:
Code Fragment 13.5: The main templa
- Page 819 and 820:
Using the Template Method Pattern f
- Page 821 and 822:
Class FindCycleDFS (Code Fragment 1
- Page 823 and 824:
levels. BFS can also be thought of
- Page 825 and 826:
825
- Page 827 and 828:
• Given a start vertex s of G, co
- Page 829 and 830:
Interesting problems that deal with
- Page 831 and 832:
A DFS on a digraph partitions the e
- Page 833 and 834:
Directed Breadth-First Search As wi
- Page 835 and 836:
edges (vi,vk) and (vk,vj) with dash
- Page 837 and 838:
ordering such that any directed pat
- Page 839 and 840:
Justification: The initial computat
- Page 841 and 842:
computers. In this case, it is prob
- Page 843 and 844:
their distances from v. Thus, in ea
- Page 845 and 846:
edge for pulling in u with a solid
- Page 847 and 848:
Proposition 13.23: In Dijkstra's al
- Page 849 and 850:
Referring back to Code Fragment 13.
- Page 851 and 852:
The main computation of Dijkstra's
- Page 853 and 854:
13.7 Minimum Spanning Trees Suppose
- Page 855 and 856:
13.7.1 Kruskal's Algorithm The reas
- Page 857 and 858:
Figure 13.19: An example of an exec
- Page 859 and 860:
execution of Kruskal's algorithm. (
- Page 861 and 862:
Analyzing the Prim-Jarn ık Algorit
- Page 863 and 864:
13.8 Exercises For source code and
- Page 865 and 866:
LA22: (none) • LA31: LA15 • LA3
- Page 867 and 868:
The graph has 10,000 vertices and 2
- Page 869 and 870:
265 175 215 180 185 155 3- - - - 26
- Page 871 and 872:
_ _ _ _ Find which bridges to build
- Page 873 and 874:
determine if it is constructed corr
- Page 875 and 876:
An Euler tour of a directed graph t
- Page 877 and 878:
C-13.21 Computer networks should av
- Page 879 and 880:
c. Now suppose that is weighted and
- Page 881 and 882:
P-13.9 Design an experimental compa
- Page 883 and 884:
Chapter 14 Memory Contents 14.1 Mem
- Page 885 and 886:
Multi-way Merging..................
- Page 887 and 888:
Keeping Track of the Program Counte
- Page 889 and 890:
In Section 7.3.6 we described how t
- Page 891 and 892:
Memory Allocation Algorithms The Ja
- Page 893 and 894:
identify and mark each live object.
- Page 895 and 896:
Caches and Disks Specifically, the
- Page 897 and 898:
are addressed. Virtual memory does
- Page 899 and 900:
The Random strategy is one of the e
- Page 901 and 902:
each would require to perform the s
- Page 903 and 904:
describe this structure, however, l
- Page 905 and 906:
are too large to fit entirely into
- Page 907 and 908:
Reinforcement R-14.1 Describe, in d
- Page 909 and 910:
Describe how to use a B-tree to imp
- Page 911 and 912:
Appendix A Useful Mathematical Fact
- Page 913 and 914:
The factorial function is defined a
- Page 915 and 916:
for any real number 0 < a ≠ 1. Pr
- Page 917 and 918:
E(X + Y) = E(X) + E(Y) and E(cX) =
- Page 919 and 920:
Bibliography [1] G. M. Adelson-Vels
- Page 921 and 922:
[28] S. A. Demurjian, Sr., Software
- Page 923 and 924:
[69] B. Liskov and J. Guttag, Abstr