Index

Numbers

A

  • abstract data types. See ADTs (abstract data types)

  • abstraction, described, 190191

  • adjacency, defined, 707

  • adjacency lists

  • adjacency matrix

    • as hash table, 712

    • as two-dimensional array, 710711

  • ADT lists, 191

  • ADTs (abstract data types)

  • AdvancedSorting Visualization tool

  • algorithms

    • defined, 1

    • invariants, 82

    • purpose of, 4047

    • recipe analogy, 13

    • speed of

      • Big O notation, 6568

      • general-purpose data structures, 819820, 824

      • sorting algorithms, 828

      • special-ordering data structures, 826

  • allocation of arrays, 39

  • all-pairs shortest-path problem, 796798

  • altering data structures during iteration, 216217

  • anagrams, described, 239242

  • analyzing the problem, 814818

    • amount of data, 815816

    • frequency of operations, 816817

    • software maintenance responsibilities, 817818

    • types of data, 814815

  • arguments, defined, 20

  • arithmetic expressions, parsing

    • described, 132133

    • evaluating postfix expressions, 148151

    • Infix Calculator tool, 142148

    • postfix notation, 133134

    • translating infix to postfix, 134142

  • Array class

    • accessing elements, 3839

    • bubble sorts, 8182

    • creating arrays, 3738

    • deletion, 42

    • encapsulation, 4243

    • example of, 3942

    • improved example of, 4347

    • initialization, 39

    • insertion, 42

    • insertion sorts, 90

    • searches, 42

    • selection sorts, 8586

    • traversal, 42

  • Array Visualization tool, 3037

    • deletion, 3435, 37

    • duplicates, 3537

    • insertion, 33

    • searches, 3133

    • speed of algorithms, 37

    • traversal, 35

  • arrays. See also hash tables; hashing

    • advantages/disadvantages, 5, 69, 820821

    • Array class

      • accessing elements, 3839

      • creating, 3738

      • deletion, 42

      • encapsulation, 4243

      • example of, 3942

      • improved example of, 4347

      • initialization, 39

      • insertion, 42

      • searches, 42

      • traversal, 42

    • Array Visualization tool, 3037

      • deletion, 3435, 37

      • duplicates, 3537

      • insertion, 33

      • searches, 3133

      • speed of algorithms, 37

      • traversal, 35

    • binary search trees as

    • insertion, speed of, 66

    • linked lists vs.164

    • lists as, 37

    • Ordered Array Visualization tool, 4751

      • binary searches, 4951

      • duplicates, 51

      • Guess-a-Number game example, 4849

    • OrderedArray class

      • advantages of, 5758

      • example of, 5357

      • find() method, 5253

    • OrderedRecordArray class, 6165

    • reusing in heapsort, 688691

    • as sequences, 1315

    • sorting. See sorting

    • two-dimensional

    • use case comparison with stacks/queues, 103104

  • arrival ordering, defined, 116117

  • ASCII codes, 386

  • assignment statements, multivalued assignment in Python, 1718

  • attributes

    • defined, 7

    • Python name mangling, 44

  • AVL trees

  • AVLtree class

  • AVLTree Visualization tool, 470

B

  • balanced trees. See also AVL trees; red-black trees

  • base case, defined, 233

  • best case, defined, 266

  • Big O notation, 6568

    • 2–3 trees, 438

    • 2–3-4 trees, 431432

    • AVL trees, 484485

    • binary search trees, 350, 375377

    • binary searches, 67

    • bubble sorts, 82

    • comparison of sorting methods, 9697

    • constants in, 6768

    • counting sorts, 324

    • degenerates, 463464

    • exact point matches, 622623

    • general-purpose data structures, 824

    • graphs, 798

    • hashing, 581

    • heaps, 683684

    • heapsort, 693

    • insertion in unordered arrays, 66

    • insertion sorts, 91

    • K highest, 696700

    • linear searches, 6667

    • linked lists, 183184

    • mergesorts, 264267, 456

    • ordered lists, 198

    • partitioning algorithm, 301302

    • priority queues, 132

    • quadtrees

      • exact matches, 645

      • insertion, 644

      • nearest matches, 655

    • queues, 125

    • quicksorts, 318320

    • radix sorts, 322

    • recursion, 236

    • red-black trees, 508

    • selection sorts, 8687

    • Shellsorts, 294

    • sorting algorithms, 828

    • spatial data searches, 656658

    • special-ordering data structures, 826

    • stacks, 116

    • Timsorts, 327

    • topological sorting, 751

  • Binary Search Tree Visualization tool, 341344

    • deleting double child nodes, 374

    • deleting leaf nodes, 367

    • deleting single child nodes, 368369

    • finding nodes, 346348

    • inserting nodes, 351352

    • traversal with, 361363

  • binary search trees. See also AVL trees; nodes; red-black trees

    • as arrays

    • Binary Search Tree Visualization tool, 341344

      • deleting double child nodes, 374

      • deleting leaf nodes, 367

      • deleting single child nodes, 368369

      • finding nodes, 346348

      • inserting nodes, 351352

      • traversal with, 361363

    • BinarySearchTree class, 344

    • defined, 340

    • duplicate keys in, 381382

    • hierarchical file system analogy, 340341

    • minimum/maximum key values, 365366

    • printing, 379381

    • separate chaining with, 585

    • speed of, 350, 375377

    • when to use, 822

  • binary searches, 4851

    • duplicates, 51

    • Guess-a-Number game example, 4849

    • logarithms in, 5860

    • Ordered Array Visualization tool, 4951

    • OrderedArray class

      • advantages of, 5758

      • example of, 5357

      • find() method, 5253

    • recursion in, 242244

    • speed of, 67

  • binary trees. See also binary search trees

  • BinarySearchTree class, 344

  • black height

  • blocks per node in B-trees, 444445

  • bottom-up insertion, 486487

  • bounding boxes of query circles, 603

    • Bounds class, 605606

    • bounds completely within other bounds, 610611

    • Cartesian coordinates, 603604

    • CircleBounds subclass, 607609

    • geographic coordinates, 604605

    • intersection of bounding boxes, 609610

    • intersection with grid cells, 628629

    • within layers, 625628

  • Bounds class, 605606

  • branches, defined, 338

  • breadth-first traversal

    • example of, 727731

    • Graph class, 731733

    • Graph Visualization tool, 731

  • B-trees

  • bubble sorts, 7782

    • in Array class, 8182

    • comparison of sorting methods, 9697

    • described, 7779

    • invariants, 82

    • Simple Sorting Visualization tool, 7981

    • speed of, 82

  • buckets, defined, 569

  • buffers, defined, 442

  • bytecode, defined, 8

C

  • Cartesian coordinates

    • bounding boxes of query circles, 603604

    • defined, 597598

    • distance between, 599

  • cells, defined, 38

  • character codes, 386388

  • children of tree nodes

    • defined, 338

    • double child nodes, deleting, 370375

    • null children in red-black trees, 495496

    • single child nodes, deleting, 367370

  • CircleBounds subclass, 607609

  • circles. See query circles

  • circular lists, 209210

  • circular queues, defined, 118

  • class attributes, defined, 25

  • classes, defined, 23

  • close matches. See nearest matches

  • clustering in hash tables

    • with HashTableOpenAddressing Visualization tool, 540543

    • primary and secondary clustering, 558559

  • collisions

  • combinations, recursion and, 278280

  • comments in Python, described, 12

  • complex numbers, defined, 26

  • compressing data. See Huffman code

  • computational complexity, defined, 68

  • concatenating sequences, 15

  • conditional expressions, defined, 20

  • connected graphs, defined, 708

  • connectivity in directed graphs, 751

    • connectivity matrix, 753

    • transitive closure, 751756

  • constants in Big O notation, 6768

  • counting sort, 323324

  • crossover subtrees

  • cutoff points, defined, 315

  • cycles

    • in directed graphs, 743744

    • Hamiltonian, 800802

    • Warshall’s algorithm and, 755758

D

  • data compression. See Huffman code

  • data organizations

    • defined, 1

    • recipe analogy, 13

  • data structures. See also types of specific data structures

    • altering during iteration, 216217

    • choosing what to use

      • foundational data structures, 818824

      • problem analysis, 814818

      • special-ordering data structures, 824826

      • specialty data structures, 828829

    • databases vs.7

    • defined, 1

    • list of, 45

    • operations on, 4

    • purpose of, 34

  • data types

    • ADTs (abstract data types)

    • described, 189190

    • dynamic typing, 1213

    • reference types, 160163

    • sequences in Python, 1315

  • databases

    • data structures vs.7

    • defined, 6

  • datasets distributed in cloud, defined, 438

  • decoding with Huffman trees, 388389

  • degenerate trees, defined, 463464

  • deletion. See also removal

    • in arrays

      • Array class, 42

      • Array Visualization tool, 3435, 37

    • defined, 4

    • in doubly linked lists

    • with duplicates, 36

    • in grids, 623

    • in hash tables

      • with HashTable class, 552553

      • with HashTableChaining Visualization tool, 568

      • with HashTableOpenAddressing Visualization tool, 542

      • for separate chaining, 574

    • in linked lists, 166167, 174177

    • of nodes

      • in 2–3-4 trees, 423430

      • in AVL trees, 479484

      • double child nodes, 370375

      • leaf nodes in binary trees, 367

      • process of, 366367

      • in red-black trees, 491, 508

      • single child nodes, 367370

    • in point lists, 614615

    • in quadtrees, 646647

  • delimiter matching example for stacks, 113116

  • dependency relationships example (topological sorting), 739

  • depth-first traversal

    • example of, 720722

    • game simulation, 727

    • Graph class, 724727

    • Graph Visualization tool, 722723

    • maze analogy, 722

  • deques

    • defined, 125126

    • doubly linked lists for, 208

  • descendants, defined, 339

  • dictionary example (hashing), 527530

  • Dijkstra’s algorithm

    • implementation, 791792

    • rail travel example, 782788

    • WeightedGraph Visualization tool, 788791

  • directed graphs

    • connectivity in, 751

      • connectivity matrix, 753

      • transitive closure, 751756

    • cycles in, 743744

    • defined, 708709

    • described, 739740

    • in Graph Visualization tool, 741742

    • topological sorting in, 742743

  • distance between points

    • Cartesian coordinates, 599

    • geographic coordinates, 599601

    • query circles, 601603

  • divide-and-conquer algorithms

  • double child nodes, deleting, 370375

  • double hashing, 559565

    • example of, 562564

    • HashTableOpenAddressing Visualization tool, 561562

    • implementation, 559561

    • speed of, 583

    • table size, 564565

  • double-ended lists, 177183

  • doubly linked lists, 198201

    • for deques, 208

    • insertion/deletion at ends, 201204

    • insertion/deletion in middle, 204208

  • duplicate keys in binary search trees, 381382

  • duplicates

    • in arrays

      • Array Visualization tool, 3537

      • Ordered Array Visualization tool, 51

    • in hash tables

      • with HashTableChaining Visualization tool, 568

      • with HashTableOpenAddressing Visualization tool, 542

  • dynamic typing, described, 1213

E

  • edges

  • efficiency. See speed

  • elements (of lists)

    • accessing, 3839

    • defined, 38

  • eliminating recursion, 267

  • encapsulation, defined, 4243

  • encoding

  • enumerating sequences, 1517

  • error handling in stacks, 111112

  • errors. See exceptions

  • Euclidean distance, defined, 599

  • Euler, Leonhard, 709

  • evaluating postfix expressions, 148151

  • exact matches

  • exceptions

    • described, 2223

    • finishing iteration, 213215

  • external storage

  • extreme values, finding

F

  • factorials, described, 237238

  • fencepost loops, defined, 145

  • Fibonacci sequence, 218222

  • fields, defined, 7

  • file indexes

  • files, defined, 438

  • filled sequences in hash tables, 540542

  • find() method, binary searches with, 5253

  • finding. See also searching

    • extreme values in heaps, 695700

    • minimum/maximum key values, 365366

    • nodes

      • with Binary Search Tree Visualization tool, 346348

      • with BinarySearchTree class, 348349

    • successors, 372373

  • finishing iteration

    • exception handling, 213215

    • markers/sentinel values, 213

    • termination tests, 213

  • Floyd, Robert, 798

  • Floyd-Warshall algorithm, 798

  • folding, defined, 580581

  • folds, defined, 531

  • foundational data structures, when to use, 818824

  • functions in Python, described, 1920

  • fusion

G

  • game simulation with depth-first traversal, 727

  • gap sequences

  • general-purpose data structures, when to use, 818824

  • generators

    • for 2–3-4 tree traversal, 421423

    • for adjacent vertex traversal, 724727

    • described, 218222

    • doubleHashProbe(), 559565

    • for graph traversal, 731733

    • for grid offsets, 629630

    • for grid traversal, 623624

    • for hash table traversal, 553554

    • for heap traversal, 682683

    • linearProbe(), 552

    • for point traversal, 615

    • quadraticProbe(), 554559

    • for quadtree traversal, 645646

    • in Timsorts, 326

    • for tree traversal, 356361

  • geographic coordinates

    • bounding boxes of query circles, 604605

    • defined, 598

    • distance between, 599601

  • Graph class, 715718

    • breadth-first traversal, 731733

    • depth-first traversal, 724727

    • minimum spanning trees in, 735739

    • topological sorting in, 746747

  • Graph Visualization tool

    • breadth-first traversal, 731

    • depth-first traversal, 722723

    • directed graphs in, 741742

    • minimum spanning trees in, 733

    • topological sorting algorithm, 742

  • graphs. See also topological sorting; weighted graphs

    • adding vertices/edges, 713716

    • advantages/disadvantages, 5

    • defined, 337

    • directed graphs

    • Graph class, 715718

    • history of, 709

    • intractable problems

      • defined, 798

      • Hamiltonian paths/cycles, 800802

      • Knight’s Tour, 798

      • Traveling Salesperson, 799800

    • minimum spanning trees

      • described, 733

      • in Graph class, 735739

      • in Graph Visualization tool, 733

      • as subgraphs, 733737

    • modeling

    • purpose of, 706

    • speed of algorithms, 798

    • terminology, 707709

    • traversal, 718719

    • when to use, 828829

  • great circle, defined, 599600

  • Grid class, 619620

  • grids, 617

    • deleting points, 623

    • exact matches, 621623

    • Grid class instances, 619620

    • implementation in Python, 618619

    • inserting points, 620621

    • intersection with query circles, 628629

    • nearest matches, 624625, 630633

    • neighboring cell sequence, 629630

    • query circles within layers, 625628

    • traversing points, 623624

    • when to use, 828

  • growing hash tables

  • Guess-a-Number game example, 4849

H

  • Hamiltonian paths/cycles intractable problem, 800802

  • hash addresses, defined, 531

  • hash functions

  • hash tables

    • adjacency matrix as, 712

    • advantages/disadvantages, 5, 525

    • defined, 525, 531

    • for external storage, 588590

    • HashTable class, 544545

    • HashTableChaining Visualization tool, 566569

      • buckets, 569

      • deleting data, 568

      • duplicates, 568

      • load factors, 568

      • table size, 569

    • HashTableOpenAddressing Visualization tool, 536543

    • when to use, 823

  • hashingf

    • collisions and, 533536

    • external storage and, 588590

    • keys

    • open addressing

      • double hashing, 559565

      • HashTable class, 544554

      • linear probing, 536543

      • quadratic probing, 554559

      • separate chaining vs.587–588

    • process of, 530533

    • separate chaining

      • defined, 565

      • HashTable class, 569574

      • HashTableChaining Visualization tool, 566569

      • KeyValueList class, 571572

      • open addressing vs.587–588

      • types to use, 574575

    • simpleHash() function, 545546

    • speed of, 581

    • strings, 578580

    • when to use, 830

  • HashTable class

  • HashTableChaining Visualization tool, 566569

    • buckets, 569

    • deleting data, 568

    • duplicates, 568

    • load factors, 568

    • table size, 569

  • HashTableOpenAddressing Visualization tool, 536543

  • haversine formula, defined, 600

  • Heap class, 677683

  • Heap Visualization tool, 674677

  • heapify() subroutine, 691693

  • heaps

    • advantages/disadvantages, 5

    • as binary trees, 666667, 684685

    • changing priority, 674

    • defined, 104, 666

    • finding extreme values, 695700

    • Heap class, 677683

    • Heap Visualization tool, 674677

      • erasing and randomly filling, 676

    • insertion in, 669670

      • with Heap class, 679680

      • with Heap Visualization tool, 675

    • for order statistics, 694695

    • as partially ordered, 668

    • peeking, 674

      • with Heap Visualization tool, 677

    • priority queues and, 667668

    • purpose of, 665

    • removal in, 670674

    • replacing maximum, 674

      • with Heap Visualization tool, 677

    • sifting up/down, 670674

    • sorting. See heapsort

    • speed of, 683684

    • traversal

      • with Heap class, 682683

      • with Heap Visualization tool, 677

  • heapsort

    • heapify() subroutine, 691693

    • heapsort() subroutine, 691693

    • process of, 686

    • reusing array for, 688691

    • sifting up/down, 686688

    • speed of, 693

    • when to use, 827

  • heapsort() subroutine, 691693

  • height of subtrees, defined, 467

  • hierarchical file system analogy, 340341

  • holes, defined, 3435

  • Huffman, David, 386

  • Huffman code

  • Huffman trees

I

  • importing Python modules, 1819

  • indentation in Python, described, 912

  • indexes. See also file indexes

  • induction, defined, 237

  • infix notation

    • comparison with postfix notation, 133

    • defined, 133, 363

    • InfixCalculator tool, 142148

    • translating to postfix, 134142

  • InfixCalculator tool, 142148

  • inheritance, defined, 23

  • initialization of arrays, 39

  • in-order successors

  • in-order traversal, 353355

  • insertion

    • in 2–3 trees, 437438

    • in 2–3-4 trees, 404405

      • with Tree234 Visualization tool, 409410

    • in arrays

      • Array class, 42

      • Array Visualization tool, 33

      • speed of, 66

    • bottom-up in trees, 486487

    • defined, 4

    • in doubly linked lists

    • with duplicates, 36

    • in file indexes, 451452

    • in grids, 620621

    • in hash tables

      • with HashTable class, 548549

      • with HashTableOpenAddressing Visualization tool, 537540

      • speed of, 584

    • in heaps, 669670

      • with Heap class, 679680

      • with Heap Visualization tool, 675

    • in linked lists, 170174

    • of nodes

      • with AVLtree class, 474478

      • with AVLTree Visualization tool, 470472

      • with Binary Search Tree Visualization tool, 351352

      • with BinarySearchTree class, 352353

      • in B-trees, 446449

      • multiple red nodes, 492

      • process of, 350

      • in red-black trees, 492, 498499

    • in point lists, 613614

    • in priority queues, 127128

    • in quadtrees, 636638, 641644

    • in queues, 117, 119

    • in sequentially ordered files, 443

    • in stacks. See push (stacks)

    • top-down in trees, 486

  • insertion sorts, 8791

    • in Array class, 90

    • comparison of sorting methods, 9697

    • described, 8789

    • disadvantages, 286

    • invariants, 91

    • list insertion sorts, 198

    • Simple Sorting Visualization tool, 8990

    • within small partitions, 315

    • speed of, 91

    • when to use, 827

  • instance attributes, defined, 25

  • instances, defined, 23

  • integer index, defined, 38

  • internal nodes

    • defined, 339

    • deleting in 2–3-4 trees, 424425

    • promoting splits to, 435437

  • interpreter (Python), described, 812

  • intersection

  • interval sequences

  • intractable problems

    • defined, 798

    • Hamiltonian paths/cycles, 800802

    • Knight’s Tour, 798

    • Traveling Salesperson, 799800

  • invariants

    • in bubble sorts, 82

    • defined, 82

    • in insertion sorts, 91

    • in selection sorts, 86

  • isomorphic, defined, 508

  • items, defined, 38

  • iteration

    • altering data structures during, 216217

    • described, 1517

    • finishing

      • exception handling, 213215

      • markers/sentinel values, 213

      • termination tests, 213

    • iterators

    • described, 211212

    • methods in, 212217

    • in Python, 217222

K

  • K highest

  • k-d trees, defined, 659

  • key values

    • defined, 346

    • finding minimum/maximum in trees, 365366

  • keys

    • defined, 7, 61, 339

    • duplicates in binary search trees, 381382

    • for hashing

    • secondary sort keys, 96

  • KeyValueList class, 571572

  • knapsack problem, 277278

  • Knight’s Tour intractable problem, 798

  • Königsberg bridge problem, 709

L

  • latitude, defined, 598

  • layers, query circles within, 625628

  • leaves

    • defined, 339

    • deleting

      • in 2–3-4 trees, 424

      • in binary search trees, 367

    • left child, defined, 339340

    • left heavy, defined, 476

    • levels (of nodes)

    • defined, 339

    • in trees as arrays, 378379

  • libraries, when to use, 820

  • linear probing, 536543

    • defined, 536

    • HashTable class, 552

    • HashTableOpenAddressing Visualization tool, 536543

    • speed of, 582583

  • linear searches

    • defined, 48

    • speed of, 6667

  • Link class, 159

  • linked lists

    • adjacency list, modeling, 712713

    • advantages/disadvantages, 5, 336, 821

    • arrays vs.164

    • circular lists, 209210

    • double-ended lists, 177183

    • doubly linked lists, 198201

      • for deques, 208

      • insertion/deletion at ends, 201204

      • insertion/deletion in middle, 204208

    • Link and LinkedList classes

    • LinkedList Visualization tool, 164167

    • links in, 158160

    • ordered lists

      • described, 192

      • list insertion sort with, 198

      • OrderedList class, 193198

      • OrderedList Visualization class, 192193

      • speed of, 198

    • queue implementation by, 187189

    • reference types and, 160163

    • speed of, 183184

    • stack implementation by, 184187

  • linked trees, nodes in, 378379

  • LinkedList class, 159

  • LinkedList Visualization tool, 164167

  • links in linked lists, 158160

  • list comprehensions, described, 2022

  • list of points, 612

    • deleting points, 614615

    • exact matches, 614

    • inserting points, 613614

    • nearest matches, 615616

    • PointList class, 612

    • traversing points, 615

  • lists (data type in Python). See also ADT lists; linked lists

    • as arrays, 37

      • accessing elements, 3839

      • creating, 3738

      • deletion, 42

      • initialization, 39

      • insertion, 42

      • searches, 42

      • traversal, 42

    • as sequences, 1315

    • slicing, 39

    • as stacks, 108112

      • delimiter matching example, 113116

      • error handling, 111112

      • word reversal example, 112113

    • load factors

    • defined, 548

    • in separate chaining, 568

  • local variables, defined, 25

  • logarithms in binary searches, 5860

  • logical lines in Python, defined, 10

  • longitude, defined, 598

  • looping. See also iterators

    • described, 1517

    • list comprehensions, 2022

M

  • mapping, defined, 21

  • markers, finishing iteration, 213

  • matching delimiters example for stacks, 113116

  • mathematical induction, defined, 237

  • maximum, replacing in heaps, 674, 677

  • maze analogy (depth-first traversal), 722

  • measuring tree balance, 464469

  • median-of-three partitioning, 313315

  • mergesort

    • advantages/disadvantages, 255, 827

    • as divide-and-conquer algorithm, 257260

    • eliminating recursion in, 270275

    • for external files, 453456

    • Mergesort Visualization tool, 263264

    • with sorted arrays, 255257

    • speed of, 264267

    • with subranges, 260262

    • testing code, 262263

  • Mergesort Visualization tool, 263264

  • methods, defined, 23

  • minimum spanning trees

    • described, 733

    • in Graph class, 735739

    • in Graph Visualization tool, 733

    • as subgraphs, 733737

    • with weighted graphs

      • building, 770774

      • creating algorithm, 774780

      • networking example, 768

      • WeightedGraph class, 776779

      • WeightedGraph Visualization tool,768–770

    • modeling graphs

    • adjacency list, 712713

    • adjacency matrix, 710712

    • edges, 710

    • vertices, 709710

  • modules, importing, 1819

  • multiple file indexes, 452

  • multiple red nodes during insertion, 492

  • multiplying sequences, 15

  • multivalued assignment, described, 1718

  • multiway trees, defined, 337. See also 2–3 trees; 2–3-4 trees; B-trees

  • mutual recursion, defined, 374

N

  • name mangling in Python, defined, 44

  • namespaces in Python, defined, 19

  • nearest matches

  • neighbors, defined, 707

  • networking example (minimum spanning trees), 768

    • algorithm, 774780

    • building minimum spanning tree, 770774

  • __Node class

  • Node class (quadtrees), 640641

  • nodes

    • blocks per node in B-trees, 444445

    • defined, 336

    • deleting

    • finding

      • with Binary Search Tree Visualization tool, 346348

      • with BinarySearchTree class, 348349

    • flipping colors, 489490, 493494, 499500

    • inserting

      • with AVLtree class, 474478

      • with AVLTree Visualization tool, 470472

      • with Binary Search Tree Visualization tool, 351352

      • with BinarySearchTree class, 352353

      • in B-trees, 446449

      • process of, 350

      • in red-black trees, 492491, 498499

    • in linked trees, 378379

    • replacing with successors, 373374

    • rotating in red-black trees, 490491, 492493, 500507

    • splitting

    • nonrandom keys for hashing, 576578

    • nonvolatile data storage, defined, 439

    • null children in red-black trees, 495496

    • numbers

    • converting words to, 527530

    • as hash keys, 526527

    • raising to powers, 275276

O

  • object-oriented programming, described, 2326

  • objects

    • defined, 23

    • storing, 6065

  • octrees, defined, 659

  • open addressing

    • defined, 535

    • double hashing, 559565

      • example of, 562564

      • HashTableOpenAddressing Visualization tool, 561562

      • implementation, 559561

      • table size, 564565

    • HashTable class, 544545

    • linear probing, 536543

      • defined, 536

      • HashTableOpenAddressing Visualization tool, 536543, 554

    • quadratic probing, 554559

    • separate chaining vs.587–588

    • speed of, 581583

  • operands, defined, 133, 364

  • operators

  • order of the function, defined, 68

  • order statistics, heaps for, 694695

  • ordered arrays

    • advantages/disadvantages, 5, 5758, 335336, 826

    • defined, 47

    • Guess-a-Number game example, 4849

    • OrderedArray class

      • advantages of, 5758

      • example of, 5357

      • find() method, 5253

    • OrderedArray Visualization tool, 4751

      • binary searches, 4951

      • duplicates, 51

    • OrderedRecordArray class, 6165

  • ordered lists

    • described, 192

    • list insertion sort with, 198

    • OrderedList class, 193198

    • OrderedList Visualization class, 192193

    • speed of, 198

  • OrderedArray class

    • advantages of, 5758

    • example of, 5357

    • find() method, 5253

  • OrderedArray Visualization tool, 4751

    • binary searches, 4951

    • duplicates, 51

    • Guess-a-Number game example, 4849

  • OrderedList class, 193198

  • OrderedList Visualization class, 192193

  • OrderedRecordArray class, 6165

  • orders of magnitude, defined, 815

P

  • parameters, defined, 20

  • parent nodes, defined, 338

  • parsing arithmetic expressions

    • described, 132133

    • evaluating postfix expressions, 148151

    • Infix Calculator tool, 142148

    • postfix notation, 133134

    • translating infix to postfix, 134142

    • traversal order and, 363365

  • partial sorting

    • defined, 87

    • finding extreme values, 695700

    • heaps and, 668

  • partitioning

    • with AdvancedSorting Visualization tool, 295297

    • algorithm for, 297301

    • defined, 294295

    • in quicksort algorithm, 302304

      • detailed explanation, 310313

      • eliminating recursion in, 318

      • full implementation, 315318

      • initial implementation, 306309

      • median-of-three partitioning, 313315

      • small partitions, 315

      • speed of, 318320

    • speed of, 301302

  • paths

  • peeking

    • in heaps, 674

      • with Heap Visualization tool, 677

    • in priority queues, 128

    • in queues, 120

    • in stacks

      • defined, 106

      • in Stack Visualization tool, 108

    • perfect hash functions, defined, 575576

    • permutations, defined, 239

    • Peters, Tim, 325

    • pivot values

    • defined, 295296

    • equal keys, 300301

    • median-of-three, 313315

    • selecting, 304306

  • PointList class, 612

  • points

    • distance between

      • Cartesian coordinates, 599

      • geographic coordinates, 599601

      • query circles, 601603

    • grids, 617

      • deleting points, 623

      • exact matches, 621623

      • Grid class instances, 619620

      • implementation in Python, 618619

      • inserting points, 620621

      • intersection with query circles, 628629

      • nearest matches, 624625, 630633

      • neighboring cell sequence, 629630

      • query circles within layers, 625628

      • traversing points, 623624

    • lists, 612

      • deleting points, 614615

      • exact matches, 614

      • inserting points, 613614

      • nearest matches, 615616

      • PointList class, 612

      • traversing points, 615

    • quadtrees

    • pop (stacks)

    • defined, 104

    • in Stack Visualization tool, 108

  • postfix notation

    • comparison with infix notation, 133

    • defined, 133, 364

    • described, 133134

    • evaluating expressions, 148151

    • Infix Calculator tool, 142148

    • translating infix to, 134142

  • post-order traversal, 355

  • powers, raising numbers to, 275276

  • precedence (of operators), defined, 135

  • prefix notation, defined, 134, 364

  • pre-order traversal, 355

  • primary clustering, defined, 558

  • printing binary search trees, 379381

  • priority, changing in heaps, 674

  • priority queues

    • defined, 106

    • described, 126127

    • heaps and, 667668

    • PriorityQueue class, 129132

    • PriorityQueue Visualization tool, 127129

    • search and traversal, 132

    • speed of, 132

    • use case comparison with arrays, 103104

    • when to use, 826

  • PriorityQueue class, 129132

  • PriorityQueue Visualization tool, 127129

  • probing, defined, 541

  • problem analysis, 814818

    • amount of data, 815816

    • frequency of operations, 816817

    • software maintenance responsibilities, 817818

    • types of data, 814815

  • pseudocode, defined, 140

  • push (stacks)

    • defined, 104

    • in Stack Visualization tool, 107

  • Python

    • comments, 12

    • dynamic typing, 1213

    • exceptions, 2223

    • functions/subroutines, 1920

    • as interpreted language, 812

    • iteration, 1517

    • list comprehensions, 2022

    • modules, importing, 1819

    • multivalued assignment, 1718

    • as object-oriented programming, 2326

    • sequences, 1315

    • whitespace, 8, 912

Q

  • quadratic probing, 554559

    • speed of, 583

  • QuadTree class, 635636

  • QuadTree Visualization tool, 639640

  • quadtrees

  • query circles

    • bounding boxes of, 603

      • Bounds class, 605606

      • bounds completely within other bounds, 610611

      • Cartesian coordinates, 603604

      • CircleBounds subclass, 607609

      • geographic coordinates, 604605

      • intersection of bounding boxes, 609610

      • intersection with grid cells, 628629

      • within layers, 625628

    • distance between points, 601603

  • Queue class, 120125

  • Queue Visualization tool, 119120

  • queues. See also priority queues

    • advantages/disadvantages, 5, 825

    • circular, 118

    • defined, 106

    • deques, 125126

    • described, 116117

    • linked list implementation of, 187189

    • Queue class, 120125

    • Queue Visualization tool, 119120

    • search and traversal, 132

    • shifting, 117118

    • speed of, 125

    • use case comparison with arrays, 103104

  • quicksort

    • AdvancedSorting Visualization tool, 309310, 318

    • algorithm for, 302304

    • defined, 302

    • detailed explanation, 310313

    • eliminating recursion in, 318

    • full implementation, 315318

    • initial implementation, 306309

    • median-of-three partitioning, 313315

    • pivot values, 304306

    • small partitions, 315

    • speed of, 318320

R

  • radix, defined, 321

  • radix sort, 320323

  • rail travel example (shortest-path problem), 780782

    • all-pairs shortest-path problem, 796798

    • Dijkstra’s algorithm, 782788

    • implementation of algorithm, 791792

    • WeightedGraph class, 792796

    • WeightedGraph Visualization tool, 788791

  • raising numbers to powers, 275276

  • random heaps, 676

  • random keys for hashing, 575576

  • records

    • defined, 6, 6061

    • OrderedRecordArray class, 6165

  • recursion

    • anagrams, 239242

    • applications for

      • combinations, 278280

      • knapsack problem, 277278

      • raising numbers to powers, 275276

    • binary searches, 242244

    • characteristics of, 235236

    • defined, 6, 229

    • divide-and-conquer algorithms, 245

    • eliminating, 267

    • factorials, 237238

    • finding nth terms with, 232235

    • mathematical induction and, 237

    • mergesort

      • advantages/disadvantages, 255

      • as divide-and-conquer algorithm, 257260

      • eliminating recursion in, 270275

      • Mergesort Visualization tool, 263264

      • with sorted arrays, 255257

      • speed of, 264267

      • with subranges, 260262

      • testing code, 262263

    • in partitioning algorithm, 297301

    • in quicksort algorithm, 302304

      • detailed explanation, 310313

      • eliminating recursion in, 318

      • full implementation, 315318

      • initial implementation, 306309

      • median-of-three partitioning, 313315

      • small partitions, 315

      • speed of, 318320

    • speed of, 236

    • Tower of Hanoi puzzle

      • described, 245246

      • implementation of solution, 250255

      • solution to, 247249

      • TowerOfHanoi Visualization tool, 246247

    • recursive depth, defined, 255

    • red-black correct, defined, 487

    • red-black rules

    • balanced trees and, 495

    • described, 487488

    • fixing violations, 488

    • null children, 495496

    • rotations and, 496497

  • red-black trees, 485

    • 2–3-4 trees and, 508510

      • operational equivalence, 510514

      • transformation between, 509510

    • advantages/disadvantages, 5

    • bottom-up insertion, 486487

    • characteristics of, 487

    • implementation, 513515

    • red-black rules

    • RedBlackTree Visualization tool, 488489

    • speed of, 508

    • top-down insertion, 486

  • RedBlackTree Visualization tool, 488489

  • reference types, 160163

  • rehashing hash tables with HashTable class, 551

  • removal. See also deletion

  • reversing words example for stacks, 112113

  • right child, defined, 339340

  • right heavy, defined, 476

  • ring buffers, defined, 118

  • root (of trees)

  • rotation of tree nodes

S

  • saving operators on stacks, 139140

  • scrolling in Tree234 Visualization Tool, 410411

  • search

  • search keys. See keys

  • searching. See also finding

    • 2–3-4 trees, 404

      • with Tree234 class, 415417

      • with Tree234 Visualization tool, 409

    • arrays

      • Array class, 42

      • Array Visualization tool, 3133

    • B-trees, 445446

    • with duplicates, 3536

    • file indexes, 451, 452453

    • hash tables

      • with HashTable class, 546548

      • with HashTableOpenAddressing Visualization tool, 540

      • speed of, 584

    • linked lists, 166, 170174

    • red-black trees, 491

    • sequences, 15

    • sequentially ordered files, 442443

    • spatial data, 611612

    • stacks and queues, 132

  • secondary clustering, defined, 558

  • secondary sort keys, defined, 96

  • selection sorts, 8387

    • in Array class, 8586

    • comparison of sorting methods, 9697

    • described, 8385

    • invariants, 86

    • Simple Sorting Visualization tool, 85

    • speed of, 8687

  • sentinel values

    • finishing iteration, 213

    • median-of-three partitioning, 314

  • separate chaining

    • with buckets, 569

    • defined, 535, 565

    • HashTable class, 569574

    • HashTableChaining Visualization tool, 566569

      • deleting data, 568

      • duplicates, 568

      • load factors, 568

      • table size, 569

    • KeyValueList class, 571572

    • open addressing vs.587–588

    • speed of, 583587

    • types to use, 574575

  • sequences

    • described, 1315

    • enumerating, 1517

    • multivalued assignment, 1718

  • sequential ordering, 442443

  • sequential storage, 829

  • Shell, Donald L.285

  • Shellsort

    • AdvancedSorting Visualization tool, 289291

    • advantages/disadvantages, 285286

    • described, 286288

    • insertion sort disadvantages, 286

    • interval sequences, 288289, 293

    • ShellSort class, 291293

    • speed of, 294

    • when to use, 827

  • ShellSort class, 291293

  • shifting queues, 117118

  • shortest-path problem

    • all-pairs shortest-path problem, 796798

    • Dijkstra’s algorithm, 782788

    • implementation, 791792

    • rail travel example, 780782

    • WeightedGraph class, 792796

    • WeightedGraph Visualization tool, 788791

  • siblings, defined, 339

  • sifting up/down

  • Simple Sorting Visualization tool

    • bubble sorts, 7981

    • insertion sorts, 8990

    • selection sorts, 85

  • simpleHash() function, 545546

  • single child nodes, deleting, 367370

  • slicing

    • lists in Python, 39

    • sequences, 14

  • software bloat, defined, 819

  • sort keys. See keys

  • SortArray class, 9196

  • sorting

    • with counting sort, 323324

    • defined, 6

    • with heapsort

      • heapify() subroutine, 691693

      • heapsort() subroutine, 691693

      • process of, 686

      • reusing array for, 688691

      • sifting up/down, 686688

      • speed of, 693

    • with mergesort

      • advantages/disadvantages, 255

      • as divide-and-conquer algorithm, 257260

      • eliminating recursion in, 270275

      • for external files, 453456

      • Mergesort Visualization tool, 263264

      • with sorted arrays, 255257

      • speed of, 264267

      • with subranges, 260262

      • testing code, 262263

    • partitioning. See partitioning

    • with quicksort

      • AdvancedSorting Visualization tool, 309310, 318

      • algorithm for, 302304

      • defined, 302

      • detailed explanation, 310313

      • eliminating recursion in, 318

      • full implementation, 315318

      • initial implementation, 306309

      • median-of-three partitioning, 313315

      • pivot values, 304306

      • small partitions, 315

      • speed of, 318320

    • with radix sort, 320323

    • with Shellsort

      • AdvancedSorting Visualization tool, 289291

      • advantages/disadvantages, 285286

      • described, 286288

      • insertion sort disadvantages, 286

      • interval sequences, 288289, 293

      • ShellSort class, 291293

      • speed of, 294

    • simple sorting algorithms

      • bubble sorts, 7782

      • comparison of, 9697

      • insertion sorts, 8791

      • list insertion sorts, 198

      • selection sorts, 8387

      • SortArray class, 9196

      • stability of, 96

    • with Timsort, 324327

    • topological sorting

      • algorithm for, 742

      • dependency relationships example, 739

      • in directed graphs, 742743

      • in Graph class, 746747

      • improving, 747751

      • speed of, 751

    • when to use, 826828

  • spatial data

    • Cartesian coordinates

      • bounding boxes of query circles, 603604

      • defined, 597598

      • distance between points, 599

    • defined, 597

    • geographic coordinates

      • bounding boxes of query circles, 604605

      • defined, 598

      • distance between points, 599601

    • higher dimensions for, 658659

    • operations on, 658

    • query circles

      • bounding boxes of, 603

      • Bounds class, 605606

      • bounds completely within other bounds, 610611

      • CircleBounds subclass, 607609

      • distance between points, 601603

      • intersection of bounding boxes, 609610

      • within layers, 625628

    • searching, 611612

    • special-ordering data structures, when to use, 824826, 828829

    • speed

    • 2–3 trees, 438

    • 2–3-4 trees, 431

    • algorithms

      • Big O notation, 6568

      • general-purpose data structures, 819820, 824

      • sorting algorithms, 828

      • special-ordering data structures, 826

    • AVL trees, 484485

    • binary search trees, 350, 375377

    • B-trees, 449450

    • bubble sorts, 82

    • counting sort, 324

    • graph algorithms, 798

    • hash function computation, 575

    • hashing, 581

    • heaps, 683684

    • heapsort, 693

    • insertion sorts, 91

    • K highest, 696700

    • linked lists, 183184

    • mergesort, 264267, 456

    • ordered lists, 198

    • partitioning, 301302

    • priority queues, 132

    • quadtrees

      • exact matches, 645

      • insertion, 644

      • nearest matches, 655

    • queues, 125

    • quicksorts, 318320

    • radix sort, 322

    • recursion, 236

    • red-black trees, 508

    • selection sorts, 8687

    • Shellsorts, 294

    • spatial data searches, 656658

    • stacks, 116

    • Timsort, 327

    • topological sorting, 751

  • splitting

  • stability of sorting algorithms, 96

  • Stack class, 108112

    • delimiter matching example, 113116

    • error handling, 111112

    • word reversal example, 112113

  • Stack Visualization tool, 106108

    • New button, 107108

    • Peek button, 108

    • Pop button, 108

    • Push button, 107

    • size of stack, 108

  • stacks

    • advantages/disadvantages, 5, 825

    • defined, 104105

    • eliminating recursion with, 267270

    • linked list implementation of, 184187

    • postal analogy, 105106

    • saving operators on, 139140

    • search and traversal, 132

    • speed of, 116

    • Stack class, 108112

      • delimiter matching example, 113116

      • error handling, 111112

      • word reversal example, 112113

    • Stack Visualization tool, 106108

      • New button, 107108

      • Peek button, 108

      • Pop button, 108

      • Push button, 107

      • size of stack, 108

    • use case comparison with arrays, 103104

  • storage requirements. See also external storage

  • storing

    • edges

      • in adjacency lists, 714716

      • in adjacency matrices, 710712

      • for weighted graphs, 774776

    • objects, OrderedRecordArray class, 6165

  • strings

  • subgraphs, minimum spanning trees as, 733737

  • subheaps, 686688

  • subranges, merging, 260262

  • subroutines, described, 1920

  • subtrees

  • successors

  • swapping node colors, 489490, 493494, 499500

    • node splits and, 512

  • symbol tables, defined, 527

T

  • termination tests, finishing iteration, 213

  • testing

  • Timsort, 324327, 827

  • tokens, defined, 145

  • top-down insertion, 486

  • topological sorting

    • algorithm for, 742

    • dependency relationships example, 739

    • of directed graphs, 742743

    • in Graph class, 746747

    • improving, 747751

    • speed of, 751

  • Tower of Hanoi puzzle

    • described, 245246

    • implementation of solution, 250255

    • solution to, 247249

    • TowerOfHanoi Visualization tool, 246247

  • TowerOfHanoi Visualization tool, 246247

  • transitive closure, 751756

  • translating infix to postfix notation, 134142

  • Traveling Salesperson intractable problem, 799800

  • traversal

    • in arrays

      • Array class, 42

      • Array Visualization tool, 35

    • defined, 4

    • with duplicates, 3637

    • of graphs, 718719

    • in grids, 623624

    • in hash tables

      • with HashTable class, 553554

      • with HashTableOpenAddressing Visualization tool, 554

      • order of, 573574

    • in heaps

      • with Heap class, 682683

      • with Heap Visualization tool, 677

    • iterators

    • in linked lists, 169170

    • in point lists, 615

    • in quadtrees, 645646

    • in stacks and queues, 132

    • of trees

      • 2–3-4 trees, 421423

      • with Binary Search Tree Visualization tool, 361363

      • with BinarySearchTree class, 356361

      • defined, 339, 353

      • order of, 363365

      • in-order traversal, 353355

      • post-order traversal, 355

      • pre-order traversal, 355

    • Tree234 class, 415

    • deleting nodes, 423430

    • __Node class, 412415

    • node splits, 418421

    • searching, 415417

    • traversing, 421423

  • Tree234 Visualization tool, 408411

  • tree-based heaps, 684685

  • trees. See also types of trees

    • advantages/disadvantages, 335336

    • balanced/unbalanced

    • cycles and, 743744

    • defined, 336337

    • terminology, 337340

    • traversal of

      • 2–3-4 trees, 421423

      • with Binary Search Tree Visualization tool, 361363

      • with BinarySearchTree class, 356361

      • defined, 339, 353

      • order of, 363365

      • in-order traversal, 353355

      • post-order traversal, 355

      • pre-order traversal, 355

    • triangular numbers

    • defined, 230231

    • eliminating recursion in, 268270

    • finding nth term

    • tuples, defined, 17, 715

    • two-dimensional arrays

    • adjacency matrix as, 710711

    • in Python, 713714

U

  • unbalanced trees

  • unweighted graphs. See graphs

  • use cases for data structures, 103104

V

  • vertices

  • virtual memory, 830831

  • visiting, defined, 339, 353

  • visualization tools

    • 2–3-4 trees, 408411

    • advanced sorting

    • arrays, 3037

      • deletion, 3435, 37

      • duplicates, 3537

      • insertion, 33

      • searches, 3133

      • speed of algorithms, 37

      • traversal, 35

    • AVL trees, 470

    • binary search trees, 341344

      • deleting double child nodes, 374

      • deleting leaf nodes, 367

      • deleting single child nodes, 368369

      • finding nodes, 346348

      • inserting nodes, 351352

      • traversal with, 361363

    • graphs

      • breadth-first traversal, 731

      • depth-first traversal, 722723

      • directed graphs in, 741742

      • minimum spanning trees in, 733

      • topological sorting algorithm, 742

    • hash tables

    • heaps, 674677

    • linked lists, 164167

    • mergesorts, 263264

    • ordered arrays, 4751

      • binary searches, 4951

      • duplicates, 51

      • Guess-a-Number game example, 4849

    • ordered lists, 192193

    • priority queues, 127129

    • quadtrees, 639640

    • queues, 119120

    • red-black trees, 488489

    • simple sorting

      • bubble sorts, 7981

      • insertion sorts, 8990

      • selection sorts, 85

    • stacks, 106108

      • New button, 107108

      • Peek button, 108

      • Pop button, 108

      • Push button, 107

      • size of stack, 108

    • Tower of Hanoi puzzle, 246247

    • weighted graphs

      • minimum spanning trees, 768770

      • shortest-path problem, 788791

W

  • Warshall, Stephen, 752, 798

  • Warshall’s algorithm

    • implementation, 756

    • transitive closure and, 751758

  • weighted graphs

    • all-pairs shortest-path problem, 796798

    • defined, 708709

    • minimum spanning trees with

      • building, 770774

      • creating algorithm, 774780

      • networking example, 768

      • WeightedGraph class, 776779

      • WeightedGraph Visualization tool, 768770

    • shortest-path problem

      • Dijkstra’s algorithm, 782788

      • implementation, 791792

      • rail travel example, 780782

      • WeightedGraph class, 792796

      • WeightedGraph Visualization tool, 788791

  • WeightedGraph class

    • minimum spanning trees, 776779

    • shortest-path problem, 792796

  • WeightedGraph Visualization tool

    • minimum spanning trees, 768770

    • shortest-path problem, 788791

  • whitespace in Python, described, 8, 912

  • word clouds example (heaps), 694695

  • word reversal example for stacks, 112113

  • worst case, defined, 266

Z

  • zooming in 2–3-4 trees, 410411

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
18.227.0.192