Merge Sort Roberto Hibbler Dept

Total Page:16

File Type:pdf, Size:1020Kb

Merge Sort Roberto Hibbler Dept Merge Sort Roberto Hibbler Dept. of Computer Science Florida Institute of Technology Melbourne, FL 32901 [email protected] ABSTRACT solution in Section 3, the evaluation of our results in Section 4, Given an array of elements, we want to arrange those elements and our final conclusion in Section 5. into a sorted order. To sort those elements, we will need to make comparisons between the individual elements efficiently. Merge Sort uses a divide and conquer strategy to sort an array 2. RELATED WORK efficiently while making the least number of comparisons The three algorithms that we will discuss are Bubble Sort, between array elements. Our results show that for arrays with Selection Sort, and Insertion Sort. All three are comparison sort large numbers of array elements, Merge Sort is more efficient algorithms, just as Merge Sort. than three other comparison sort algorithms, Bubble Sort, Insertion Sort, and Selection Sort. Our theoretical evaluation The Bubble Sort algorithm works by continually swapping shows that Merge Sort beats a quadratic time complexity, while adjacent array elements if they are out of order until the array is our empirical evaluation shows that on average Merge Sort is 32 in sorted order. Every iteration through the array places at least times faster than Insertion Sort, the current recognized most one element at its correct position. Although algorithmically efficient comparison algorithm, with one real data set. correct, Bubble Sort is inefficient for use with arrays with a large number of array elements and has a ͉ʚͦ͢ʛ worst case time Keywords complexity. Knuth observed[1], also, that while Bubble Sort Merge Sort, sorting, comparisons, Selection Sort, time shares the worst-case time complexity with other prevalent complexity sorting algorithms, compared to them it makes far more element swaps, resulting in poor interaction with modern CPU hardware. 1. INTRODUCTION We intend to show that Merge Sort needs to make on average The ability to arrange an array of elements into a defined order fewer element swaps than Bubble Sort. is very important in Computer Science. Sorting is heavily used with online stores, were the order that services or items were The Selection Sort algorithm arranges array elements in order by purchased determines what orders can be filled and who first finding the minimum value in the array and swapping it receives their order first. Sorting is also essential for the with the array element that is in its correct position depending database management systems used by banks and financial on how the array is being arranged. The process is then repeated systems, such as the New Stock Exchange, to track and rank the with the second smallest value until the array is sorted. This billions of transactions that go on in one day. There are many creates two distinctive regions within the array, the half that is algorithms, which provide a solution to sorting arrays, including sorted and the half that has not been sorted. Selection Sort shows algorithms such as Bubble Sort[1], Insertion Sort[2], and an improvement over Bubble Sort by not comparing all the Selection Sort[3]. While these algorithms are programmatically elements in its unsorted half until it is time for that element to be correct, they are not efficient for arrays with a large number of placed into its sorted position. This makes Selection Sort less elements and exhibit quadratic time complexity. affected by the input’s order. Though, it is still no less inefficient with arrays with a large number of array elements. We are given an array of comparable values. We need to arrange Also, even with the improvements Selection Sort still shares the these values into either an ascending or descending order. same worst-case time complexity of ͉ʚͦ͢ʛ. We intend to show that Merge Sort will operate at a worst-case time complexity We introduce the Merge Sort algorithm. The Merge Sort faster than ͉ʚͦ͢ʛ. algorithm is a divide-and-conquer algorithm. It takes input of an array and divides that array into sub arrays of single elements. A The Insertion Sort algorithm takes elements from the input array single element is already sorted, and so the elements are sorted and places those elements in their correct place into a new array, back into sorted arrays two sub-arrays at a time, until we are left shifting existing array elements as needed. Insertion Sort with a final sorted array. We contribute the following: improves over Selection Sort by only making as many comparisons as it needs to determine the correct position of the 1. We introduce the Merge Sort algorithm. current element, while Selection Sort makes comparisons 2. We show that theoretically Merge Sort has a worst- against each element in the unsorted part of the array. In the case time complexity faster than ͦ . )v ͉ʚ͢ ʛ average case, Insertion Sort’s time complexity is ͉ʚ ʛ, but its 3. We show that empirically Merge Sort is faster than ͨ worst case is ͦ , the same as Bubble Sort and Selection Selection Sort. ͉ʚ͢ ʛ Sort. The tradeoff of Insertion Sort is that on the average more elements are swapped as array elements are shifted within the This paper will discuss in Section 2 comparison sort algorithms array with the addition of new elements. Even with its related to the problem, followed by the detailed approach of our limitations, Selection Sort is the current fastest comparison based sorting algorithm since it equals Bubble Sort and array after the comparisons are made, the remainder is added so Selection Sort in the worst case, but is exceptionally better in the no elements are lost (lines 24 – 27). In the following examples, average case. We intend to show that Merge Sort operates at an using the given input, the division of the array (Figure 3) and average case time complexity faster than ͉ʚͦ͢ʛ. how the array is merged back into a sorted array (Figure 4) are illustrated. 3. APPROACH Inputs – A: array of n elements A large array with an arbitrary order needs to be arranged in an (38 27 43 3 9 82 10 1) ascending or descending order, either lexicographically or Output – array A in ascending order numerically. Merge sort can solve this problem by using two key ideas. The first key idea of merge sort is that a problem can be divided and conquered. The problem can be broken into smaller arrays, and those arrays can be solved. Second, by dividing the array into halves, then dividing those halves by recursively halving them into arrays of single elements, two sorted arrays are merged into one array, as a single element array is already sorted. Refer to the following pseudocode: Input – A: array of n elements Figure 3: Shows the splitting of the input array into single Output – array A sorted in ascending order element arrays. 1. proc mergesort(A: array) 2. var array left, right, result 3. if length(A)<=1 4. return(A) 5. var middle=length(A)/2 6. for each x in A up to middle 7. add x to left 8. for each x in A after middle 9. add x to right 10. left=mergesort(left) 11. right=mergesort(right) 12. result=merge(left,right) 13. return result Figure 1: Pseudocode of the Merge Sort algorithm Figure 4: Shows the merging of the single element arrays during the Merge Step. Input – left:array of m elements, right: array of k elements As the example shows, array A is broken in half continuously Output – array result sorted in ascending order until they are in arrays of only a single element, then those 14. proc merge(left: array, right: array) single elements are merged together until they form a single 15. var array result 16. which length(left) > 0 and length(right) > sorted array in ascending order. 0 17. if first(left) <= first(right) 18. append first(left) to result 4. EVALUATION 19. left=rest(left) 20. else 4.1 Theoretical Analysis 21. append first(right) to result 4.1.1 Evaluation Criteria 22. right=rest(right) All comparison based sorting algorithms count the comparisons 23. end while 24. if length(left) > 0 of array elements as one of their key operations. The Merge Sort 25. append left to result algorithm can be evaluated by measuring the number of 26. if length(right) > 0 comparisons between array elements. As the key operation, we 27. append right to result can measure the number of comparisons made to determine the 28. return result overall efficiency of the algorithm. We intend to show that Figure 2: Pseudocode of the Merge step of Merge Sort because the Merge Sort algorithm makes less comparisons over the currently acknowledged most efficient algorithm, Insertion Sort[Sec 2], Merge Sort is the most efficient comparison sort As the pseudocode shows, after the array is broken up into a left algorithm. half and a right half (lines 5 - 9), the two halves are divided recursively (lines 10 – 11) until they are all within a single element array. Then, the two halves’ elements are compared to determine how the two arrays should be arranged (lines 16 -22). Should any one half contain elements not added to the sorted 4.1.2 Merge Sort Case Scenarios 4.1.2.2 Best Case 4.1.2.1 Worst Case The best case of Merge Sort, depicted in Figure 5, occurs when Merge Sort makes the element comparisons we want to measure the largest element of one array is smaller than any element in the other. In this scenario, only ͢ comparisons of array during the merge step, where pairs of arrays are recursively Ɵ2 merged into a single array.
Recommended publications
  • Sort Algorithms 15-110 - Friday 2/28 Learning Objectives
    Sort Algorithms 15-110 - Friday 2/28 Learning Objectives • Recognize how different sorting algorithms implement the same process with different algorithms • Recognize the general algorithm and trace code for three algorithms: selection sort, insertion sort, and merge sort • Compute the Big-O runtimes of selection sort, insertion sort, and merge sort 2 Search Algorithms Benefit from Sorting We use search algorithms a lot in computer science. Just think of how many times a day you use Google, or search for a file on your computer. We've determined that search algorithms work better when the items they search over are sorted. Can we write an algorithm to sort items efficiently? Note: Python already has built-in sorting functions (sorted(lst) is non-destructive, lst.sort() is destructive). This lecture is about a few different algorithmic approaches for sorting. 3 Many Ways of Sorting There are a ton of algorithms that we can use to sort a list. We'll use https://visualgo.net/bn/sorting to visualize some of these algorithms. Today, we'll specifically discuss three different sorting algorithms: selection sort, insertion sort, and merge sort. All three do the same action (sorting), but use different algorithms to accomplish it. 4 Selection Sort 5 Selection Sort Sorts From Smallest to Largest The core idea of selection sort is that you sort from smallest to largest. 1. Start with none of the list sorted 2. Repeat the following steps until the whole list is sorted: a) Search the unsorted part of the list to find the smallest element b) Swap the found element with the first unsorted element c) Increment the size of the 'sorted' part of the list by one Note: for selection sort, swapping the element currently in the front position with the smallest element is faster than sliding all of the numbers down in the list.
    [Show full text]
  • Quick Sort Algorithm Song Qin Dept
    Quick Sort Algorithm Song Qin Dept. of Computer Sciences Florida Institute of Technology Melbourne, FL 32901 ABSTRACT each iteration. Repeat this on the rest of the unsorted region Given an array with n elements, we want to rearrange them in without the first element. ascending order. In this paper, we introduce Quick Sort, a Bubble sort works as follows: keep passing through the list, divide-and-conquer algorithm to sort an N element array. We exchanging adjacent element, if the list is out of order; when no evaluate the O(NlogN) time complexity in best case and O(N2) exchanges are required on some pass, the list is sorted. in worst case theoretically. We also introduce a way to approach the best case. Merge sort [4]has a O(NlogN) time complexity. It divides the 1. INTRODUCTION array into two subarrays each with N/2 items. Conquer each Search engine relies on sorting algorithm very much. When you subarray by sorting it. Unless the array is sufficiently small(one search some key word online, the feedback information is element left), use recursion to do this. Combine the solutions to brought to you sorted by the importance of the web page. the subarrays by merging them into single sorted array. 2 Bubble, Selection and Insertion Sort, they all have an O(N2) In Bubble sort, Selection sort and Insertion sort, the O(N ) time time complexity that limits its usefulness to small number of complexity limits the performance when N gets very big. element no more than a few thousand data points.
    [Show full text]
  • 1 Lower Bound on Runtime of Comparison Sorts
    CS 161 Lecture 7 { Sorting in Linear Time Jessica Su (some parts copied from CLRS) 1 Lower bound on runtime of comparison sorts So far we've looked at several sorting algorithms { insertion sort, merge sort, heapsort, and quicksort. Merge sort and heapsort run in worst-case O(n log n) time, and quicksort runs in expected O(n log n) time. One wonders if there's something special about O(n log n) that causes no sorting algorithm to surpass it. As a matter of fact, there is! We can prove that any comparison-based sorting algorithm must run in at least Ω(n log n) time. By comparison-based, I mean that the algorithm makes all its decisions based on how the elements of the input array compare to each other, and not on their actual values. One example of a comparison-based sorting algorithm is insertion sort. Recall that insertion sort builds a sorted array by looking at the next element and comparing it with each of the elements in the sorted array in order to determine its proper position. Another example is merge sort. When we merge two arrays, we compare the first elements of each array and place the smaller of the two in the sorted array, and then we make other comparisons to populate the rest of the array. In fact, all of the sorting algorithms we've seen so far are comparison sorts. But today we will cover counting sort, which relies on the values of elements in the array, and does not base all its decisions on comparisons.
    [Show full text]
  • Sorting Algorithms Correcness, Complexity and Other Properties
    Sorting Algorithms Correcness, Complexity and other Properties Joshua Knowles School of Computer Science The University of Manchester COMP26912 - Week 9 LF17, April 1 2011 The Importance of Sorting Important because • Fundamental to organizing data • Principles of good algorithm design (correctness and efficiency) can be appreciated in the methods developed for this simple (to state) task. Sorting Algorithms 2 LF17, April 1 2011 Every algorithms book has a large section on Sorting... Sorting Algorithms 3 LF17, April 1 2011 ...On the Other Hand • Progress in computer speed and memory has reduced the practical importance of (further developments in) sorting • quicksort() is often an adequate answer in many applications However, you still need to know your way (a little) around the the key sorting algorithms Sorting Algorithms 4 LF17, April 1 2011 Overview What you should learn about sorting (what is examinable) • Definition of sorting. Correctness of sorting algorithms • How the following work: Bubble sort, Insertion sort, Selection sort, Quicksort, Merge sort, Heap sort, Bucket sort, Radix sort • Main properties of those algorithms • How to reason about complexity — worst case and special cases Covered in: the course book; labs; this lecture; wikipedia; wider reading Sorting Algorithms 5 LF17, April 1 2011 Relevant Pages of the Course Book Selection sort: 97 (very short description only) Insertion sort: 98 (very short) Merge sort: 219–224 (pages on multi-way merge not needed) Heap sort: 100–106 and 107–111 Quicksort: 234–238 Bucket sort: 241–242 Radix sort: 242–243 Lower bound on sorting 239–240 Practical issues, 244 Some of the exercise on pp.
    [Show full text]
  • Quicksort Z Merge Sort Z T(N) = Θ(N Lg(N)) Z Not In-Place CSE 680 Z Selection Sort (From Homework) Prof
    Sorting Review z Insertion Sort Introduction to Algorithms z T(n) = Θ(n2) z In-place Quicksort z Merge Sort z T(n) = Θ(n lg(n)) z Not in-place CSE 680 z Selection Sort (from homework) Prof. Roger Crawfis z T(n) = Θ(n2) z In-place Seems pretty good. z Heap Sort Can we do better? z T(n) = Θ(n lg(n)) z In-place Sorting Comppgarison Sorting z Assumptions z Given a set of n values, there can be n! 1. No knowledge of the keys or numbers we permutations of these values. are sorting on. z So if we look at the behavior of the 2. Each key supports a comparison interface sorting algorithm over all possible n! or operator. inputs we can determine the worst-case 3. Sorting entire records, as opposed to complexity of the algorithm. numbers,,p is an implementation detail. 4. Each key is unique (just for convenience). Comparison Sorting Decision Tree Decision Tree Model z Decision tree model ≤ 1:2 > z Full binary tree 2:3 1:3 z A full binary tree (sometimes proper binary tree or 2- ≤≤> > tree) is a tree in which every node other than the leaves has two c hildren <1,2,3> ≤ 1:3 >><2,1,3> ≤ 2:3 z Internal node represents a comparison. z Ignore control, movement, and all other operations, just <1,3,2> <3,1,2> <2,3,1> <3,2,1> see comparison z Each leaf represents one possible result (a permutation of the elements in sorted order).
    [Show full text]
  • An Evolutionary Approach for Sorting Algorithms
    ORIENTAL JOURNAL OF ISSN: 0974-6471 COMPUTER SCIENCE & TECHNOLOGY December 2014, An International Open Free Access, Peer Reviewed Research Journal Vol. 7, No. (3): Published By: Oriental Scientific Publishing Co., India. Pgs. 369-376 www.computerscijournal.org Root to Fruit (2): An Evolutionary Approach for Sorting Algorithms PRAMOD KADAM AND Sachin KADAM BVDU, IMED, Pune, India. (Received: November 10, 2014; Accepted: December 20, 2014) ABstract This paper continues the earlier thought of evolutionary study of sorting problem and sorting algorithms (Root to Fruit (1): An Evolutionary Study of Sorting Problem) [1]and concluded with the chronological list of early pioneers of sorting problem or algorithms. Latter in the study graphical method has been used to present an evolution of sorting problem and sorting algorithm on the time line. Key words: Evolutionary study of sorting, History of sorting Early Sorting algorithms, list of inventors for sorting. IntroDUCTION name and their contribution may skipped from the study. Therefore readers have all the rights to In spite of plentiful literature and research extent this study with the valid proofs. Ultimately in sorting algorithmic domain there is mess our objective behind this research is very much found in documentation as far as credential clear, that to provide strength to the evolutionary concern2. Perhaps this problem found due to lack study of sorting algorithms and shift towards a good of coordination and unavailability of common knowledge base to preserve work of our forebear platform or knowledge base in the same domain. for upcoming generation. Otherwise coming Evolutionary study of sorting algorithm or sorting generation could receive hardly information about problem is foundation of futuristic knowledge sorting problems and syllabi may restrict with some base for sorting problem domain1.
    [Show full text]
  • Improving the Performance of Bubble Sort Using a Modified Diminishing Increment Sorting
    Scientific Research and Essay Vol. 4 (8), pp. 740-744, August, 2009 Available online at http://www.academicjournals.org/SRE ISSN 1992-2248 © 2009 Academic Journals Full Length Research Paper Improving the performance of bubble sort using a modified diminishing increment sorting Oyelami Olufemi Moses Department of Computer and Information Sciences, Covenant University, P. M. B. 1023, Ota, Ogun State, Nigeria. E- mail: [email protected] or [email protected]. Tel.: +234-8055344658. Accepted 17 February, 2009 Sorting involves rearranging information into either ascending or descending order. There are many sorting algorithms, among which is Bubble Sort. Bubble Sort is not known to be a very good sorting algorithm because it is beset with redundant comparisons. However, efforts have been made to improve the performance of the algorithm. With Bidirectional Bubble Sort, the average number of comparisons is slightly reduced and Batcher’s Sort similar to Shellsort also performs significantly better than Bidirectional Bubble Sort by carrying out comparisons in a novel way so that no propagation of exchanges is necessary. Bitonic Sort was also presented by Batcher and the strong point of this sorting procedure is that it is very suitable for a hard-wired implementation using a sorting network. This paper presents a meta algorithm called Oyelami’s Sort that combines the technique of Bidirectional Bubble Sort with a modified diminishing increment sorting. The results from the implementation of the algorithm compared with Batcher’s Odd-Even Sort and Batcher’s Bitonic Sort showed that the algorithm performed better than the two in the worst case scenario. The implication is that the algorithm is faster.
    [Show full text]
  • Data Structures & Algorithms
    DATA STRUCTURES & ALGORITHMS Tutorial 6 Questions SORTING ALGORITHMS Required Questions Question 1. Many operations can be performed faster on sorted than on unsorted data. For which of the following operations is this the case? a. checking whether one word is an anagram of another word, e.g., plum and lump b. findin the minimum value. c. computing an average of values d. finding the middle value (the median) e. finding the value that appears most frequently in the data Question 2. In which case, the following sorting algorithm is fastest/slowest and what is the complexity in that case? Explain. a. insertion sort b. selection sort c. bubble sort d. quick sort Question 3. Consider the sequence of integers S = {5, 8, 2, 4, 3, 6, 1, 7} For each of the following sorting algorithms, indicate the sequence S after executing each step of the algorithm as it sorts this sequence: a. insertion sort b. selection sort c. heap sort d. bubble sort e. merge sort Question 4. Consider the sequence of integers 1 T = {1, 9, 2, 6, 4, 8, 0, 7} Indicate the sequence T after executing each step of the Cocktail sort algorithm (see Appendix) as it sorts this sequence. Advanced Questions Question 5. A variant of the bubble sorting algorithm is the so-called odd-even transposition sort . Like bubble sort, this algorithm a total of n-1 passes through the array. Each pass consists of two phases: The first phase compares array[i] with array[i+1] and swaps them if necessary for all the odd values of of i.
    [Show full text]
  • 13 Basic Sorting Algorithms
    Concise Notes on Data Structures and Algorithms Basic Sorting Algorithms 13 Basic Sorting Algorithms 13.1 Introduction Sorting is one of the most fundamental and important data processing tasks. Sorting algorithm: An algorithm that rearranges records in lists so that they follow some well-defined ordering relation on values of keys in each record. An internal sorting algorithm works on lists in main memory, while an external sorting algorithm works on lists stored in files. Some sorting algorithms work much better as internal sorts than external sorts, but some work well in both contexts. A sorting algorithm is stable if it preserves the original order of records with equal keys. Many sorting algorithms have been invented; in this chapter we will consider the simplest sorting algorithms. In our discussion in this chapter, all measures of input size are the length of the sorted lists (arrays in the sample code), and the basic operation counted is comparison of list elements (also called keys). 13.2 Bubble Sort One of the oldest sorting algorithms is bubble sort. The idea behind it is to make repeated passes through the list from beginning to end, comparing adjacent elements and swapping any that are out of order. After the first pass, the largest element will have been moved to the end of the list; after the second pass, the second largest will have been moved to the penultimate position; and so forth. The idea is that large values “bubble up” to the top of the list on each pass. A Ruby implementation of bubble sort appears in Figure 1.
    [Show full text]
  • Selection Sort
    CS50 Selection Sort Overview Key Terms Sorted arrays are typically easier to search than unsorted arrays. One algorithm to sort • selection sort is bubble sort. Intuitively, it seemed that there were lots of swaps involved; but perhaps • array there is another way? Selection sort is another sorting algorithm that minimizes the • pseudocode amount of swaps made (at least compared to bubble sort). Like any optimization, ev- erything comes at a cost. While this algorithm may not have to make as many swaps, it does increase the amount of comparing required to sort a single element. Implementation Selection sort works by splitting the array into two parts: a sorted array and an unsorted array. If we are given an array Step-by-step process for of the numbers 5, 1, 6, 2, 4, and 3 and we wanted to sort it selection sort using selection sort, our pseudocode might look something like this: 5 1 6 2 4 3 repeat for the amount of elements in the array find the smallest unsorted value swap that value with the first unsorted value When this is implemented on the example array, the pro- 1 5 6 2 4 3 gram would start at array[0] (which is 5). We would then compare every number to its right (1, 6, 2, 4, and 3), to find the smallest element. Finding that 1 is the smallest, it gets swapped with the element at the current position. Now 1 is 1 2 6 5 4 3 in the sorted part of the array and 5, 6, 2, 4, and 3 are still unsorted.
    [Show full text]
  • Data Structures Using “C”
    DATA STRUCTURES USING “C” DATA STRUCTURES USING “C” LECTURE NOTES Prepared by Dr. Subasish Mohapatra Department of Computer Science and Application College of Engineering and Technology, Bhubaneswar Biju Patnaik University of Technology, Odisha SYLLABUS BE 2106 DATA STRUCTURE (3-0-0) Module – I Introduction to data structures: storage structure for arrays, sparse matrices, Stacks and Queues: representation and application. Linked lists: Single linked lists, linked list representation of stacks and Queues. Operations on polynomials, Double linked list, circular list. Module – II Dynamic storage management-garbage collection and compaction, infix to post fix conversion, postfix expression evaluation. Trees: Tree terminology, Binary tree, Binary search tree, General tree, B+ tree, AVL Tree, Complete Binary Tree representation, Tree traversals, operation on Binary tree-expression Manipulation. Module –III Graphs: Graph terminology, Representation of graphs, path matrix, BFS (breadth first search), DFS (depth first search), topological sorting, Warshall’s algorithm (shortest path algorithm.) Sorting and Searching techniques – Bubble sort, selection sort, Insertion sort, Quick sort, merge sort, Heap sort, Radix sort. Linear and binary search methods, Hashing techniques and hash functions. Text Books: 1. Gilberg and Forouzan: “Data Structure- A Pseudo code approach with C” by Thomson publication 2. “Data structure in C” by Tanenbaum, PHI publication / Pearson publication. 3. Pai: ”Data Structures & Algorithms; Concepts, Techniques & Algorithms
    [Show full text]
  • Download The
    Visit : https://hemanthrajhemu.github.io Join Telegram to get Instant Updates: https://bit.ly/VTU_TELEGRAM Contact: MAIL: [email protected] INSTAGRAM: www.instagram.com/hemanthraj_hemu/ INSTAGRAM: www.instagram.com/futurevisionbie/ WHATSAPP SHARE: https://bit.ly/FVBIESHARE File Structures An Object-Oriented Approach with C++ Michael J. Folk University of Illinois Bill Zoellick CAP Ventures Greg Riccardi Florida State University yyA ADDISON-WESLEY Addison-Wesley is an imprint of Addison Wesley Longman,Inc.. Reading, Massachusetts * Harlow, England Menlo Park, California Berkeley, California * Don Mills, Ontario + Sydney Bonn + Amsterdam « Tokyo * Mexico City https://hemanthrajhemu.github.io Contents VIE Chapter 7 Indexing 247 7.1 What is anIndex? 248 7.2 A Simple Index for Entry-SequencedFiles 249 7.3 Using Template Classes in C++ for Object !/O 253 7.4 Object-Oriented Support for Indexed, Entry-SequencedFiles of Data Objects 255 . 7.4.1 Operations Required to Maintain an Indexed File 256 7.4.2 Class TextIndexedFile 260 7.4.3 Enhancementsto Class TextIndexedFile 261 7.5 Indexes That Are Too Large to Holdin Memory 264 7.6 Indexing to Provide Access by Multiple Keys 265 7.7 Retrieval Using Combinations of Secondary Keys 270 7.8. Improving the SecondaryIndex Structure: Inverted Lists 272 7.8.1 A First Attempt at a Solution” 272 7.8.2 A Better Solution: Linking the List of References 274 “7.9 Selective Indexes 278 7.10 Binding 279 . Summary 280 KeyTerms 282 FurtherReadings 283 Exercises 284 Programming and Design Exercises 285 Programming
    [Show full text]