Chapter 3 In-Class Practice Search Algorithms

$35.00 $24.00
Category:

Description

5/5 – (2 votes)

Complete the program that has an array containing the countries with confirmed Novel Coronavirus cases. There is a full initialization list of the following countries:

Write a linear search function and a binary search function. Both functions should return true if the country was found and false if the country was not found.

Call the following functions in the order listed below:

  1. linear search function
  2. sort function
  3. print function
  4. binary search function

Sample Output 1:

What is the name of your country? United States

Linear Search says that your country does have a confirmed case of the Coronavirus.

Sorted list of countries:

Australia

Canada

China

Finland

France

Germany

Hong Kong

India

Italy

Japan

Spain

Sweden

Thailand

United Kingdom

United States

Binary Search says that your country does have a confirmed case of the Coronavirus.

Sample Output 2:

What is the name of your country? Bangladesh

Linear Search says that your country does not have a confirmed case of the Coronavirus.

Sorted list of countries:

Australia

Canada

China

Finland

France

Germany

Hong Kong

India

Italy

Japan

Spain

Sweden

Thailand

United Kingdom

United States

Binary Search says that your country does not have a confirmed case of the Coronavirus.

Chapter 3 In-Class Practice Search Algorithms
$35.00 $24.00