CMPS-2020 Programming II: Data Structures and Algorithms
Lab-5
Overview:
Please look at chapter-8 Searching and Sorting in our Gaddis textbook. Complete these sections at the end of the chapter... · Short Answer · Fill-in-the-blank · True or False Do your work neatly on paper. You do not need to write the questions out. Make your answers clear.
Complete programming challenges #2 and #3. page 492 of 8th edition. (also in the 9th edition) Name your program 2020/5/lotto.cpp Combine both challenges into one nicely written program. Your program will do both a linear and binary search. 2. Lottery Winners A lottery ticket buyer purchases 10 tickets a week, always playing the same 10 5-digit "lucky" combinations. Write a program that initializes an array or a vector with these numbers and then lets the player enter this week's winning 5-digit number. The program should perform a linear search through the list of the player's numbers and report whether or not one of the tickets is a winner this week. Here are the numbers: 13579 62483 26791 77777 26792 79422 33445 85647 55555 93121 3. Lottery Winners Modification Modify the program you wrote for Programming Challenge 2 (Lottery Winners) so it also performs a binary search and a linear search. Both search types should give the same results. Compare them.
Complete programming challenge #8. page 493 of 8th edition. Name your program 2020/5/searcher.cpp Write a program that is easy to understand when looking at the code, as well as when running the program. 8. Search Benchmarks Write a program that has an array of at least 20 integers. It should call a function that uses the linear search algorithm to locate one of the values. The function should keep a count of the number of comparisons it makes until it finds the value. The program then should call a function that uses the binary search algorithm to locate the same value. It should also keep count of the number of comparisons it makes. Display these values on the screen.
Write your programs on Odin server. All of your work should have these qualities: · on-time submission · a clean build · perfect coding style · clear and correct output