Display 17.3 gives a template function for sorting an array using the selection sort
Want to see the full answer?
Check out a sample textbook solutionChapter 17 Solutions
Problem Solving with C++ (10th Edition)
Additional Engineering Textbook Solutions
Computer Science: An Overview (13th Edition) (What's New in Computer Science)
Concepts Of Programming Languages
Starting Out with Programming Logic and Design (5th Edition) (What's New in Computer Science)
Database Concepts (8th Edition)
Elementary Surveying: An Introduction To Geomatics (15th Edition)
- Use the array built to shuffle and deal two poker hands. Change the corresponding values for all Jacks through Aces to 11, 12, 13, 14 respectively. Shuffle the deck, then deal two hands. Comment your code and submit the Python code. im using python 3.9.7arrow_forwardI need this written in C# to work in Visual Studio. Thank You.arrow_forward1. Write a program to input a list of names (strings) from the user and store them in an ArrayList. The input can be terminated by entering the empty string or byentering the string “quit”. 2. Add further functionality to your program so that it searches the ArrayList to find the first string and the last string according to dictionary ordering and then prints out these strings (names). Do this exercise without sorting the names in the ArrayList. For example, if the list contains the following names: Charles Darwin Albert Einstein Issac Newton Tony Hoare Grace Hopper Edgar Dijkstra Ada Lovelace Charles Babbage Stephen Hawking Your program should output:The first name in the list in alphabetical order is: Ada Lovelace The last name in the list in alphabetical order is: Tony Hoarearrow_forward
- O8.. Example explain.arrow_forwardA scientist has developed a mathematical model for a physical process, and he wants to check how good is model is. To evaluate the correctness of his model, he wants to test the results of his model under certain parameters and compare them with experimental results. Write a program that first reads the number of tests (testCount) as an int followed by the results of each test according to the model as a double array (testModel) and finally the results of each test according to experiments as a double array (testExperiment. Then, the program should calculate the error of the model by evaluating the average of the squares of the differences between the model result and experimental result (see formula below) using a function. Error= (testModel, - textExperiment,) testCount IN NOTE: individual square of the difference between the model value and the experiment value calculations MUST be done in the function. Every other functionality MUST be done in the main function. TeCount NOTE: To…arrow_forward1. Write a program that would resemble a power utility billing system. There will be an input window that would enter or input the meter number (5 numeric digits) and the present meter reading in kilowatt hours, the maximum would be 9999 kilowatts. A search from a 2d-arraylist would be made in order to get the previous meter reading of a particular meter number. The 2d- arraylist consists of meter number (5 numeric digits) and the previous meter reading in kilowatt hours (4 numeric digits with 9999 as maximum value). Provide at least 5 sample data or 5 rows with meter number and previous meter reading each row for the 2d-arraylist. When an input of meter number and present meter reading is made, search the 2d-arraylist for the equivalent meter number. If a match is found, get the kilowatt hour used (KWH) by subtracting the previous meter reading from the present meter reading. Note that if the present meter reading is less than previous meter reading, add 10000 first to the present…arrow_forward
- 2. Write a program that will load A with 15 random numbers (range : 1-50). Display elements of A in ascending order. Then get a number X. Compare X to each element of A, if array element is less than X, replace that element with X. On another line, display elements of A after replacing all elements less than X with X.arrow_forwarddo in javaarrow_forwardA scientist has developed a mathematical model for a physical process, and he wants to check how good is model is. To evaluate the correctness of his model, he wants to test the results of his model under certain parameters and compare them with experimental results. Write a program that first reads the number of tests (testCount) as an int followed by the results of each test according to the model as a double array (test Model) and finally the results of each test according to experiments as a double array (testExperiment). Then, the program should calculate the error of the model by evaluating the average of the squares of the differences between the model result and experimental result (see formula below) using a function. Error Input 1 testCount NOTE: Individual square of the difference between the model value and the experiment value calculations MUST be done in the function. Every other functionality MUST be done in the main function. NOTE: To calculate square of a number you…arrow_forward
- Suppose you are given a list of students registered in a course and you are required to implement an array-based student list. Each student in the list has name, regNo, department and cGpa. Implement different functions for entering the data (like constructor (for setting to default values), setName, setReg, etc.). You also need to implement the following function related to the array. insertStudent( ) : It has 2 options • Asking the user for index and then insert the student at that index AND • Asking the user for name of the student where the new student is to be added (New student should be added at the index of the student whose name is entered) o If the list is full, it should create a larger list (new size should be entered by the user), copy all the data in it and make insertion as instructed o (Insertion will only be made if the reg of the new student doesn’t exist in the list) deleteStudent( ): Same as insertStudent( ) (either by asking the index or student name) sort( ): Ask…arrow_forwardWrite a program that declares an array of 5 integers called intArray. Do this in main(). Call function fill_up (Display 7-4 in your Module 12 download) from main, passing in a reference to intArray Load the array with the followng values (2, 4, 6, 8, 10). Print the contents of intArray. Do this in main().arrow_forwardmergeAndRemove(int[], int[]) This is a public static function that takes a int[] and int[] for the parameters and returns an int[]. Given two arrays of integers. Your job is to combine them into a single array and remove any duplicates, finally return the merged array.arrow_forward
- Database System ConceptsComputer ScienceISBN:9780078022159Author:Abraham Silberschatz Professor, Henry F. Korth, S. SudarshanPublisher:McGraw-Hill EducationStarting Out with Python (4th Edition)Computer ScienceISBN:9780134444321Author:Tony GaddisPublisher:PEARSONDigital Fundamentals (11th Edition)Computer ScienceISBN:9780132737968Author:Thomas L. FloydPublisher:PEARSON
- C How to Program (8th Edition)Computer ScienceISBN:9780133976892Author:Paul J. Deitel, Harvey DeitelPublisher:PEARSONDatabase Systems: Design, Implementation, & Manag...Computer ScienceISBN:9781337627900Author:Carlos Coronel, Steven MorrisPublisher:Cengage LearningProgrammable Logic ControllersComputer ScienceISBN:9780073373843Author:Frank D. PetruzellaPublisher:McGraw-Hill Education