Programming Language: C++ You have been hired by Google to work on their YouTube videos search team.  Every YouTube video has a unique ID and those IDs are in unsorted order.  As a software engineer, you are required to make a YouTube search engine which works for very user.  Create a test engine that only holds seven YouTube IDs.  Prompt for and get from the user the seven IDs and store them in an

C++ Programming: From Problem Analysis to Program Design
8th Edition
ISBN:9781337102087
Author:D. S. Malik
Publisher:D. S. Malik
Chapter8: Arrays And Strings
Section: Chapter Questions
Problem 16PE
icon
Related questions
Question

Programming Language: C++

You have been hired by Google to work on their YouTube videos search team.  Every YouTube video has a unique ID and those IDs are in unsorted order.  As a software engineer, you are required to make a YouTube search engine which works for very user.  Create a test engine that only holds seven YouTube IDs.  Prompt for and get from the user the seven IDs and store them in an integer array.  Then sort and print the array using the insertion sort algorithm.  Finally, use a sentinel loop to prompt for and get from the user a series of IDs.  For each ID, perform a binary search on the array and tell the user if it was found or not.  If found, print the index where the ID is stored.  Continue to prompt the user for an ID until entering the sentinel value of -999.

 

In addition to function main, define the following two functions:

 

void insertion_sort(int arr[], int arr_size)

 

int binary_search(int sort_arr[], int size_array, int search_value)

binary_seacrh returns the index of search value.  If the value does not exist in the array, it returns -1,

 

See Arrays – linear and binary searches sample application on Canvas.

 

Sample input:

Enter the number of in Youtube(assign the value 7): 8

Enter the file size (assign the value 7): 7

Enter the id each youtube_video:

12

7

100

78

105

67

32

Output

The sorted data is:

7

12

32

67

78

100

105

 

Then Input/output

Enter your value to search in the array:

32

32 is found in 2 th position of this sorted list

Enter your value to search in the array:

11

11 is not found in this sorted list

Enter your value to search in the array:

 

 Enter your value to search in the array:

-999

 

Process returned 0 (0x0)   execution time : 128.104 s

Press any key to continue.

Expert Solution
trending now

Trending now

This is a popular solution!

steps

Step by step

Solved in 4 steps with 4 images

Blurred answer
Knowledge Booster
Array
Learn more about
Need a deep-dive on the concept behind this application? Look no further. Learn more about this topic, computer-science and related others by exploring similar questions and additional content below.
Similar questions
  • SEE MORE QUESTIONS
Recommended textbooks for you
C++ Programming: From Problem Analysis to Program…
C++ Programming: From Problem Analysis to Program…
Computer Science
ISBN:
9781337102087
Author:
D. S. Malik
Publisher:
Cengage Learning
C++ for Engineers and Scientists
C++ for Engineers and Scientists
Computer Science
ISBN:
9781133187844
Author:
Bronson, Gary J.
Publisher:
Course Technology Ptr
Programming Logic & Design Comprehensive
Programming Logic & Design Comprehensive
Computer Science
ISBN:
9781337669405
Author:
FARRELL
Publisher:
Cengage
EBK JAVA PROGRAMMING
EBK JAVA PROGRAMMING
Computer Science
ISBN:
9781337671385
Author:
FARRELL
Publisher:
CENGAGE LEARNING - CONSIGNMENT