Starting Out with Programming Logic and Design (5th Edition) (What's New in Computer Science)
5th Edition
ISBN: 9780134801155
Author: Tony Gaddis
Publisher: PEARSON
expand_more
expand_more
format_list_bulleted
Expert Solution & Answer
Chapter 9, Problem 3AW
Explanation of Solution
Pseudocode explanation:
The variable “index”, “scan” and “unsortedValue” is declared as integer. The first element is compared with the next one and the comparison carried out till the last index. Assign “index” to “scan”. If the “array[scan-1] ” is less than the “array[scan]” then swap is performed for that particular pairs of element.
The given pseudocode performs the “Insertion sort
Insertion sort algorithm
- Sorting is a process to place the elements in order...
Expert Solution & Answer
Want to see the full answer?
Check out a sample textbook solutionStudents have asked these similar questions
Parallel Arrays and Using Parallel Arrays
-Using a loop to step through an array
Declare Integer series [10]
Declare Integer index
For index = 0 to 9
Set series [index] =100
End For
MIPS assembly language program
Linear Search:
Write a MIPS assembly language program that can search for a number that entered by user in an array with 20 integer numbers and prints the index of the number in the array if it is found.
What algorithm does the following pseudocode perform?
Chapter 9 Solutions
Starting Out with Programming Logic and Design (5th Edition) (What's New in Computer Science)
Ch. 9.3 - Which of the sorting algorithms discussed makes...Ch. 9.3 - Prob. 9.2CPCh. 9.3 - Prob. 9.3CPCh. 9.4 - Prob. 9.4CPCh. 9.4 - On average, with an array of 1,000 elements, how...Ch. 9.4 - Prob. 9.6CPCh. 9 - Prob. 1MCCh. 9 - Prob. 2MCCh. 9 - Prob. 3MCCh. 9 - Prob. 4MC
Ch. 9 - Prob. 5MCCh. 9 - Prob. 6MCCh. 9 - Prob. 7MCCh. 9 - Prob. 8MCCh. 9 - Prob. 9MCCh. 9 - Prob. 10MCCh. 9 - Prob. 1TFCh. 9 - Prob. 2TFCh. 9 - Prob. 3TFCh. 9 - Prob. 4TFCh. 9 - Prob. 5TFCh. 9 - Prob. 1AWCh. 9 - Prob. 2AWCh. 9 - Prob. 3AWCh. 9 - What algorithm does the following pseudocode...Ch. 9 - Prob. 1SACh. 9 - Prob. 2SACh. 9 - Prob. 3SACh. 9 - Prob. 4SACh. 9 - Prob. 5SACh. 9 - Why is the selection sort more efficient than the...Ch. 9 - Prob. 7SACh. 9 - Prob. 8SACh. 9 - Assume the following main module is in a program...Ch. 9 - Prob. 1PECh. 9 - Sorted Names Design a program that allows the user...Ch. 9 - Rainfall Program Modification Recall that...Ch. 9 - Name Search Modify the Sorted Names program that...Ch. 9 - Charge Account Validation Recall that Programming...Ch. 9 - Prob. 7PECh. 9 - Sorting Benchmarks Modify the modules presented in...
Knowledge Booster
Similar questions
- Array TypesObjective: Based on the given values and initializations, give what is being required of each statement.1. Given A[10], α=2000, esize=4 bytes:a) Find the number of elements.b) Find the address of the 6th element.c) Find the index no. of the 8th element.2. Given E[3][4], α=2020, esize=4 bytes:a) Find the total no. of elements.b) Find the address of the last element.c) Find the address of the 10th element.arrow_forwardc++ language using addition, not get_sum function with this pseudocode: Function Main Declare Integer Array ages [ ] Declare integer total assign numbers = [ ] assign total = sum(ages) output "Sum: " & total end fucntion sum(Integer Array array) declare integer total declare integer index assign total = 0 for index = 0 to size(array) -1 assign total = total + array[ ] end return integer totalarrow_forwardSorted Names Problem:Assume that you already have the bubbleSort () ans swapS() modules. Design the main() program that allows the user to enter 20 names into a String array. Sort the array in ascending (alphabetical) order and display its contents. // The bubbleSort module accepts an array of Strings and array size// and sorts array in ascending orderModule bubbleSort(String Ref array[], integer arraySize) Declare Integer index1, index2 // bubblesort scores For index1 = arraySize – 1 to 0 Step -1 For index2 = 0 to index1 – 1 If array[index2] > array[index2 + 1] Then Call swapS(array[index2], array[index2 + 1) End If End For End ForEnd Module// The swapS module accepts two String elements and swaps their contentsModule swapS(String ref a, String ref b) Declare String temp // Swap a and b Set temp = a Set a = b Set b = tempEnd Modulearrow_forward
- The first element in each array is accessed with index number 0. (e.g., array[0]). Select one: True Falsearrow_forwardtest_var = 'AAMMTTMT';//test_var is testing variable takenarray = test_var.split('');//string is split into the array function SWAP(TAM, i, j)//function to swap{temp = TAM[i];TAM[i] = TAM[j];TAM[j] = temp;}function sort_AMT(TAMUK)//function to sort the array{for(i = 0; i<TAMUK.length;i++){for(j = 0; j<TAMUK.length-1;j++){if(TAMUK[i]<TAMUK[j])SWAP(TAMUK,i,j);}}console.log(TAMUK);} sort_AMT(array);//function call How to write an HTML code for this javascript result/output? where the result will be displayed in HTML page.arrow_forwardtest_var = 'AAMMTTMT';//test_var is testing variable takenarray = test_var.split('');//string is split into the array function SWAP(TAM, i, j)//function to swap{temp = TAM[i];TAM[i] = TAM[j];TAM[j] = temp;}function sort_AMT(TAMUK)//function to sort the array{for(i = 0; i<TAMUK.length;i++){for(j = 0; j<TAMUK.length-1;j++){if(TAMUK[i]<TAMUK[j])SWAP(TAMUK,i,j);}}console.log(TAMUK);} sort_AMT(array);//function call Can I have this program output and code in HTML page?arrow_forward
- arl = np.array([10,20,30,40]) ar2 = np.array([15,6,7]) np.vstack ( (arl,ar2)) The np.stack() function above will O a. Give error b. Stack the two arrays ar1 and ar2 horizontally c. Stack the two arrays ar1 and ar2 vertically O d. Sums the two arrays art and ar2arrow_forwardSearch Benchmarks Design an application in pseudocode that has an array of at least 20 integers. It should call a module that uses the sequential search algorithm to locate one of the values. The module should keep a count of the number of comparisons it makes until it finds the value. Then the program should call another module that uses the binary search algorithm to locate the same value. It should also keep a count of the number of comparisons it makes. Display these values on the screen.arrow_forwardJava language onlyarrow_forward
- JAVA CODE PLEASE Functions with 2D Arrays Quiz by CodeChum Admin Write a program that asks the user for the row and column size of a 2D array and asks the user for the elements. Write the total of the sum of each row multiplied with the row number. Example: 1 2 3 -> (1+2+3) * 1 = 6 4 5 6 -> (4+5+6) * 2 = 30 7 8 9 -> (7+8+9) * 3 = 72 total: 108 Input 1. One line containing an integer for the number of rows 2. One line containing an integer for the number of columns 3. Multiple lines containing an integer for every element of the array for each line Output Row·size:·3 Column·size:·3 R1C1:·1 R1C2:·2 R1C3:·3 R2C1:·4 R2C2:·5 R2C3:·6 R3C1:·7 R3C2:·8 R3C3:·9 1·2·3 4·5·6 7·8·9arrow_forwardMultidimensional Array Enhanced For-loop Input Scanner method using Case-statements Simple AI as machine input 1. Declare a multidimensional array of char to draw a table -+-- -+-+- 2. Use the enhanced for-loop to display the table for (char[] row:charName) for (char c:row) System.out.print(c); } System.out.println (); 3. Initialize some value (inside the table) in the array charName [0] [0] '1'; 4. Using Scanner for user input and case statement to put some character inside the table Scanner scan = new Scanner (System.in); int pos = scan.nextInt (); 5. Create some method/function to be used to add functionality to the application program. 6. Add simple AI (for machine input) 7. Using Arraylist to scan patterns in the multidimensional array.arrow_forwardSorting is a fundamental problem associated with arrays that seeks to locate in the array where target element is. Select one: True Falsearrow_forward
arrow_back_ios
SEE MORE QUESTIONS
arrow_forward_ios
Recommended textbooks for you
- C++ for Engineers and ScientistsComputer ScienceISBN:9781133187844Author:Bronson, Gary J.Publisher:Course Technology PtrEBK JAVA PROGRAMMINGComputer ScienceISBN:9781337671385Author:FARRELLPublisher:CENGAGE LEARNING - CONSIGNMENTC++ Programming: From Problem Analysis to Program...Computer ScienceISBN:9781337102087Author:D. S. MalikPublisher:Cengage Learning
- Programming Logic & Design ComprehensiveComputer ScienceISBN:9781337669405Author:FARRELLPublisher:CengageSystems ArchitectureComputer ScienceISBN:9781305080195Author:Stephen D. BurdPublisher:Cengage LearningMicrosoft Visual C#Computer ScienceISBN:9781337102100Author:Joyce, Farrell.Publisher:Cengage Learning,
C++ for Engineers and Scientists
Computer Science
ISBN:9781133187844
Author:Bronson, Gary J.
Publisher:Course Technology Ptr
EBK JAVA PROGRAMMING
Computer Science
ISBN:9781337671385
Author:FARRELL
Publisher:CENGAGE LEARNING - CONSIGNMENT
C++ Programming: From Problem Analysis to Program...
Computer Science
ISBN:9781337102087
Author:D. S. Malik
Publisher:Cengage Learning
Programming Logic & Design Comprehensive
Computer Science
ISBN:9781337669405
Author:FARRELL
Publisher:Cengage
Systems Architecture
Computer Science
ISBN:9781305080195
Author:Stephen D. Burd
Publisher:Cengage Learning
Microsoft Visual C#
Computer Science
ISBN:9781337102100
Author:Joyce, Farrell.
Publisher:Cengage Learning,