Java Software Structures:: Chapter 9: Searching and Sorting

Réussis tes devoirs et examens dès maintenant avec Quizwiz!

(SR 9.1) When would a linear search be preferable to a logarithmic search?

(SRA 9.1) A linear search would be preferable for relatively small, unsorted lists and in languages where recursion is not supported.

(SR 9.2) Which searching method requires that the list be sorted?

(SRA 9.2) Binary search.

(SR 9.3) When would a sequential sort be preferable to a recursive sort?

(SRA 9.3) A sequential sort would be preferable for relatively small data sets and in languages where recursion is not supported.

(SR 9.4) The insertion sort algorithm sorts using what technique?

(SRA 9.4) The insertion sort algorithm sorts a list of values by repetitively inserting a particular value into a subset of the list that has already been sorted.

(SR 9.5) The bubble sort algorithm sorts using what technique?

(SRA 9.5) The bubble sort algorithm sorts a list by repeatedly comparing neighboring elements in the list and swapping their positions if they are not already in order.

(SR 9.6) The selection sort algorithm sorts using what technique?

(SRA 9.6) The selection sort algorithm, which is an O(n2) sort algorithm, sorts a list of values by repetitively putting a particular value into its final, sorted position.

(SR 9.7) The quick sort algorithm sorts using what technique?

(SRA 9.7) The quick sort algorithm sorts a list by partitioning the list using an arbitrarily chosen partition element and then recursively sorting the sublists on either side of the partition element.

(SR 9.8) The merge sort algorithm sorts using what technique?

(SRA 9.8) The merge sort algorithm sorts a list by recursively dividing the list in half until each sublist has one element and then recombining these sublists in order.

(SR 9.9) How many queues would it take to use a radix sort to sort names stored as all lowercase?

(SRA 9.9) It would require 27 queues, one for each of the 26 letters in the alphabet and one to store the whole list before, during, and after sorting.

(Term) search pool

A group of items to be searched.

(Term) logarithmic algorithm

An algorithm that has a time complexity of O(log2n), such as a binary search.

(Key Concept) What makes a search efficient?

An efficient search minimizes the number of comparisons made.

(Term) class method

See static method.

(Key Concept) Describe selection sort.

The selection sort algorithm sorts a list of values by repetitively putting a particular value into its final, sorted position.

(Key Concept)

A binary search capitalizes on the fact that the search pool is sorted.

(Key Concept) What does binary search do at each comparison?

A binary search eliminates half of the viable candidates with each comparison.

(Key Concept) What is the time complexity of binary search?

A binary search has logarithmic complexity, which makes it very efficient for a large search pool.

(Key Concept) How is a method made static?

A method is made static by using the static modifier in the method declaration.

(Term) generic method

A method that includes the definition of a type parameter in the header of the method.

(Term) static method

A method that is invoked through the class name and that cannot refer to instance data. Also called a class method.

(Key Concept) Describe radix sort.

A radix sort is inherently based on queue processing.

(Term) linear search

A search that begins at one end of a list of items and continues linearly until the element is found or the end of the list is reached.

(Term) binary search

A search that occurs on a sorted list and in which each comparison eliminates approximately half of the remaining viable candidates.

(Term) partition

A set of unsorted elements, used by the quick sort algorithm, that are all either less than or greater than a chosen partition element.

(Term) logarithmic sort

A sorting algorithm that requires approximately nlog2n comparisons to sort n elements.

(Term) quick sort

A sorting algorithm that sorts elements by partitioning the unsorted elements into two partitions and then recursively sorting each partition.

(Term) merge sort

A sorting algorithm that sorts elements by recursively dividing the list in half until each sublist has one element and then merging the sublists.

(Term) bubble sort

A sorting algorithm that sorts elements by repeatedly comparing adjacent values and swapping them.

(Term) selection sort

A sorting algorithm that sorts elements by repetitively finding a particular element and putting it in its final position.

(Term) insertion sort

A sorting algorithm that sorts elements by repetitively inserting a particular element into a previously sorted sublist.

(Term) radix sort

A sorting algorithm that sorts elements using a sort key instead of directly comparing elements.

(Term) sequential sort

A sorting algorithm that typically uses nested loops and requires approximately n2 comparisons to sort n elements.

(Term) partition element

An element used by the quick sort algorithm to separate unsorted elements into two distinct partitions.

(Key Concept) What is searching?

Searching is the process of finding a designated target within a group of items or determining that the target doesn't exist.

(Key Concept) What is sorting?

Sorting is the process of arranging a list of items into a defined order based on some criterion.

(Key Concept) Describe bubble sort.

The bubble sort algorithm sorts a list by repeatedly comparing neighboring elements and swapping them if necessary.

(Term) target element

The element that is being sought during a search operation.

(Term) viable candidates

The elements in a search pool among which the target element may still be found.

(Key Concept) Describe insertion sort.

The insertion sort algorithm sorts a list of values by repetitively inserting a particular value into a subset of the list that has already been sorted.

(Key Concept) Describe merge sort.

The merge sort algorithm sorts a list by recursively dividing the list in half until each sublist has one element and then merging these sublists into the sorted order.

(Term) sorting

The process of arranging a group of items into a particular order based on some criterion.

(Term) searching

The process of finding a designated target element within a group of elements, or determining that the target is not in the group.

(Key Concept) Describe quick sort.

The quick sort algorithm sorts a list by partitioning the list and then recursively sorting the two partitions.


Ensembles d'études connexes

Unit 5 Exam Monetary Policy and Fiscal Policy

View Set

Intro to Culinary Midterm Review

View Set

Lecture 14 - Field Techniques & Mammalian Ecology

View Set

Funeral Service Compend: Mortuary and Business Law

View Set

Chapter 12 - Romanesque Europe Multiple Choice

View Set