Database System Concepts
Database System Concepts
7th Edition
ISBN: 9780078022159
Author: Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher: McGraw-Hill Education
Bartleby Related Questions 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
Check Mark
Knowledge Booster
Background pattern image
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
    Text book image
    Database System Concepts
    Computer Science
    ISBN:9780078022159
    Author:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
    Publisher:McGraw-Hill Education
    Text book image
    Starting Out with Python (4th Edition)
    Computer Science
    ISBN:9780134444321
    Author:Tony Gaddis
    Publisher:PEARSON
    Text book image
    Digital Fundamentals (11th Edition)
    Computer Science
    ISBN:9780132737968
    Author:Thomas L. Floyd
    Publisher:PEARSON
    Text book image
    C How to Program (8th Edition)
    Computer Science
    ISBN:9780133976892
    Author:Paul J. Deitel, Harvey Deitel
    Publisher:PEARSON
    Text book image
    Database Systems: Design, Implementation, & Manag...
    Computer Science
    ISBN:9781337627900
    Author:Carlos Coronel, Steven Morris
    Publisher:Cengage Learning
    Text book image
    Programmable Logic Controllers
    Computer Science
    ISBN:9780073373843
    Author:Frank D. Petruzella
    Publisher:McGraw-Hill Education