Select which of the following statements about searching for items in a list is incorrect.

Computer Networking: A Top-Down Approach (7th Edition)
7th Edition
ISBN:9780133594140
Author:James Kurose, Keith Ross
Publisher:James Kurose, Keith Ross
Chapter1: Computer Networks And The Internet
Section: Chapter Questions
Problem R1RQ: What is the difference between a host and an end system? List several different types of end...
icon
Related questions
Question
Select which of the following statements about searching for items in a list is incorrect.
Group of answer choices
 
1. In an unsorted list, if the item is not present in the list, we will need to check every single item. In a sorted list, if we start the search at the smallest item, at most we would only need to check all items smaller than the target. If we get to an item larger than the target we can end our search early. This would make searching faster in the sorted list.
 
2. Sorting a list only makes sense for primitive types (ints, doubles) and Strings but not objects. For this reason we cannot sort a list of objects, and will always have to check each object in a list when we search for a target object.
 
3. In an unsorted list you need to check each item, to see if it is the item you want. If the list is sorted you can look at the middle item and then you can direct your search to the relevant portion of the list (higher or lower). This is called binary search. This will make the search faster for a sorted list.
 
4. For either an unsorted list or a sorted list we would be able to write a method to search for the list in an iterative manner, that uses a for loop, or we could write a method that uses recursion.
Expert Solution
trending now

Trending now

This is a popular solution!

steps

Step by step

Solved in 2 steps

Blurred answer
Recommended textbooks for you
Computer Networking: A Top-Down Approach (7th Edi…
Computer Networking: A Top-Down Approach (7th Edi…
Computer Engineering
ISBN:
9780133594140
Author:
James Kurose, Keith Ross
Publisher:
PEARSON
Computer Organization and Design MIPS Edition, Fi…
Computer Organization and Design MIPS Edition, Fi…
Computer Engineering
ISBN:
9780124077263
Author:
David A. Patterson, John L. Hennessy
Publisher:
Elsevier Science
Network+ Guide to Networks (MindTap Course List)
Network+ Guide to Networks (MindTap Course List)
Computer Engineering
ISBN:
9781337569330
Author:
Jill West, Tamara Dean, Jean Andrews
Publisher:
Cengage Learning
Concepts of Database Management
Concepts of Database Management
Computer Engineering
ISBN:
9781337093422
Author:
Joy L. Starks, Philip J. Pratt, Mary Z. Last
Publisher:
Cengage Learning
Prelude to Programming
Prelude to Programming
Computer Engineering
ISBN:
9780133750423
Author:
VENIT, Stewart
Publisher:
Pearson Education
Sc Business Data Communications and Networking, T…
Sc Business Data Communications and Networking, T…
Computer Engineering
ISBN:
9781119368830
Author:
FITZGERALD
Publisher:
WILEY