Question: C++ Binary Search with recursion from file input PLEASE USE DATA IN FILE FOR INPUT - NO USER INPUT Data in file called A3.txt 41

C++ Binary Search with recursion from file input

C++ Binary Search with recursion from file input PLEASE USE DATA IN

PLEASE USE DATA IN FILE FOR INPUT - NO USER INPUT

Data in file called A3.txt

41 0 24 27 34 41 45 50 58 61 62 64 67 69 78 81 91 16 18 20 21 27 36 40 42 53 82 91 91 92 95 95 27 11 12 22 26 31 33 35 38 47 67 69 71 73 94 99 41 11 23 29 37 41 41 44 47 53 57 59 62 64 68 78 64 5 6 16 29 35 40 42 42 46 48 64 70 88 90 90 98 1 23 29 31 40 48 50 54 56 66 76 81 84 93 98 39 15 18 23 26 29 33 37 38 39 39 40 41 44 58 82 78 12 21 24 29 30 45 62 70 72 73 73 77 77 86 97 36 24 31 36 41 50 50 52 55 55 61 66 67 74 86 90 37 6 16 24 28 29 36 38 38 39 39 40 41 44 58 82 

1. Write a program that will read each line from A3.txt 2. Read the number in the first line, and search that number in the line next to it 3. Use Binary search algorithm (using recursion) for searching 4. So, each number in the odd lines(line 1, line 3, ine 5, etc) will be searched in the even lines (line 2, line 4, line 6, etc) next to it respectively 5. Show the positions where you found that number. If a number appears multiple times, show the last position in the input list 6. Save your results in B3.txt Note: In C++, array index starts from 0 but the input file positions start from1 1 Sample input: 241 3 0 24 27 34 41 45 50 58 61 62 64 67 69 78 81 491 16 18 20 21 27 36 40 42 53 82 91 91 92 95 95 6 27 7 11 12 22 26 31 33 35 38 47 67 69 71 73 94 99 9 Sample output: 10 11 12 12 Not Found

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!