COMP2247 - Algorithms and Data Structures

Syllabus Software Installation Assignments Tests
Lectures and Labs
**Back to Full Menu**

Sorting and Searching Algorithms SelectionSort Program BinarySearch Program QuickSort Program HardwareStore Program HardwareStore Comparable Objects Program



HardwareStore Sort and Search Program


Description

This program uses the selection sort, quick sort, and sequential search algorithms to conduct sorting and searching on an array of Inventory objects.

Associated Concepts:

Selection Sort, Quick Sort, and Sequential Search on an array of objects.

Algorithm:

main method:

Case 5: call searchByName() method to search an inventory's name using sequential search algorithm.

Case 6: call selectionSortByID() method to sort the array of inventory objects by ID.

Case 7: call selectionSortByName() method to sort the array of inventory objects by name.

Case 8: call quickSortByID() method to sort the array of inventory objects by ID.

The method definitions are the same as the integer versions except that the objects' individual fields are used in the data comparison.

Source Code





Sample Run



Video