Java: An Introduction to Problem Solving and Programming (8th Edition)
8th Edition
ISBN: 9780134462035
Author: Walter Savitch
Publisher: PEARSON
expand_more
expand_more
format_list_bulleted
Question
Chapter 1, Problem 17E
Program Plan Intro
- • It is a step by step by process or a method of solving the problem with the finite number of steps.
- • Defining the algorithm involves the human understandable language and it is independent of any
programming language. - • It is mainly focused to help the data processing, mathematical calculation and other computer related calculations.
- • It is used to manipulate the data in various ways such as inserting a new data item, searching a required item, retrieving the particular item or sorting an item.
Expert Solution & Answer
Want to see the full answer?
Check out a sample textbook solutionStudents have asked these similar questions
Name:
Na
ID: A
Name:
3. An algorithm will be used to identify the maximum value in a list of one or more integers. Consider the two
versions of the algorithm below.
Algorithm I: Set the value of a variable max to - 1. Iterate through the list of integer values. If a data value is
greater than the value of the variable max, set max to the data value.
Algorithm II : Set the value of a variable max to the first data value. Iterate through the remaining values in
the list of integers. If a data value is greater than the value of the variable max, set max to the data value.
Which of the following statements best describes the behavior of the two algorithms?
Algorithm I always works correctly, but
Algorithm II only works correctly when
the maximum value is not the first value
Both algorithms work correctly on all
input values.
а.
с.
in the list.
b. Neither algorithm will correctly identify d. Algorithm II always works correctly, but
the maximum value when the input
contains both positive and…
Baby Names: Each year, the government releases a list of the 10,000 most common baby namesand their frequencies (the number of babies with that name). The only problem with this is thatsome names have multiple spellings. For example, "John" and ''.Jon" are essentially the same namebut would be listed separately in the list. Given two lists, one of names/frequencies and the otherof pairs of equivalent names, write an algorithm to print a new list of the true frequency of eachname. Note that if John and Jon are synonyms, and Jon and Johnny are synonyms, then John andJohnny are synonyms. (It is both transitive and symmetric.) In the final list, any name can be usedas the "real" name.EXAMPLEInput:Names: John (15), Jon (12), Chris (13), Kris (4), Christopher (19)Synonyms: (Jon, John), (John, Johnny), (Chris, Kris), (Chris, Christopher)Output: John (27), Kris (36)
Write a program that displays a list of integers from 10 to 20 inclusive each with its square root next to it.
Chapter 1 Solutions
Java: An Introduction to Problem Solving and Programming (8th Edition)
Ch. 1.1 - What are the two kinds of memory in a computer?Ch. 1.1 - What is software?Ch. 1.1 - What data would you give to a program that...Ch. 1.1 - What data would you give to a program that...Ch. 1.1 - What is the difference between a program written...Ch. 1.1 - Is Java a high-level language or a low-level...Ch. 1.1 - Is Java bytecode a high-level language or a...Ch. 1.1 - What is a compiler?Ch. 1.1 - What is a source program?Ch. 1.1 - What do you call a program that translates Java...
Ch. 1.2 - What would the following statement, when used in a...Ch. 1.2 - Write a statement or statements that can be used...Ch. 1.2 - Prob. 13STQCh. 1.2 - What is the meaning of the following line in the...Ch. 1.2 - Write a complete Java program that uses system....Ch. 1.2 - Suppose you define a class named YourClass in a...Ch. 1.2 - Prob. 17STQCh. 1.3 - What is a method?Ch. 1.3 - Prob. 19STQCh. 1.3 - Do all objects of the same class have the same...Ch. 1.3 - Prob. 21STQCh. 1.3 - Prob. 22STQCh. 1.3 - Prob. 23STQCh. 1.3 - Prob. 24STQCh. 1.3 - What is an algorithm?Ch. 1.3 - What is pseudocode?Ch. 1.3 - Prob. 27STQCh. 1.3 - Prob. 28STQCh. 1.3 - Prob. 29STQCh. 1.3 - Prob. 30STQCh. 1.3 - Prob. 31STQCh. 1.3 - Suppose you write a program that is supposed to...Ch. 1.4 - Prob. 33STQCh. 1.4 - How would you change the program in Listing 1.2 so...Ch. 1 - How does a computers main memory differ from its...Ch. 1 - Prob. 2ECh. 1 - Prob. 3ECh. 1 - How does machine language differ from Java?Ch. 1 - What would the following statements, when used in...Ch. 1 - Write a statement or statements that can be used...Ch. 1 - Write statements that can be used in a Java...Ch. 1 - Given a persons year of birth, the Birthday Wizard...Ch. 1 - Write statements that can be used in a Java...Ch. 1 - Prob. 11ECh. 1 - Prob. 12ECh. 1 - Prob. 13ECh. 1 - Prob. 14ECh. 1 - What attributes and behaviors would an object...Ch. 1 - Suppose that you have a numberxthat is greater...Ch. 1 - Prob. 17ECh. 1 - Write statements that can be used in a JavaFX...Ch. 1 - Prob. 19ECh. 1 - Prob. 20ECh. 1 - Obtain a copy of the Java program shown in Listing...Ch. 1 - Modify the Java program described in Practice...Ch. 1 - Prob. 3PCh. 1 - The following program will compile but it has...Ch. 1 - Programming Projects require more problem-solving...Ch. 1 - Write a complete program for the problem described...Ch. 1 - Prob. 3PPCh. 1 - Prob. 4PPCh. 1 - Prob. 5PPCh. 1 - Prob. 6PP
Knowledge Booster
Similar questions
- The function sum_evens in python takes a list of integers and returns the sum of all the even integers in the list. For example: Test Result print(sum_evens([1, 5, 2, 5, 3, 5, 4])) 6 print(sum_evens([5, 5, -5, -5])) 0 print(sum_evens([16, 24, 30])) 70arrow_forwardWrite an algorithm that counts the number of values that are odd in a listof integers.arrow_forwardCLO2: Write an algorithm that takes a list of binary numbers as an input, counts the number of O's in the list, and returns the count as output. Example: when the input Is [0, 0, 1, 1, 0, 1, 0, 1] the output should be 4 (since there are 4 0's in the input list).arrow_forward
- In computational geometry, often you need to find the rightmost lowest point in a set of points. Write the following function that returns the rightmost lowest point in a set of points:# Return a list of two values for a pointdef getRightmostLowestPoint(points):Write a test program that prompts the user to enter the coordinates of six points and displays the rightmost lowest point.arrow_forwardIn python, The function count_contains_x takes a list of strings (wordList) and returns the count of how many strings in the list contain at least one upper- or lower-case 'x'. Hint: Use the accumulator pattern to accumulate the count. Hint: You might want to use the string method count. For example: Test Result strlist = ["xerox", "OXEN", "whiffleball", "XOXOX"] print(count_contains_x(strlist)) 3 fish = ["angel", "gold", "cat", "puffer", "damsel"] print(count_contains_x(fish)) 0 strlist = ["X", "x"] print(count_contains_x(strlist)) 2 list_of_one_x = ["x"] print(count_contains_x(list_of_one_x)) 1arrow_forwardin pythonarrow_forward
- Q2: a. Write an algorithm that searches a sorted list of n items by dividing it into three sublists of almost n/3 items. This algorithm finds the sublist that might contain the given item and divides it into three smaller sublists of almost equal size. The algorithm repeats this process until it finds the item or concludes that the item is not in the list. Dry run the above algorithm to find the value 240. A[] = {10,15,20,60,65,110,150,220,240,245,260,290,300,460,470,501}arrow_forwardcreate a piece of code that demonstrates how to find a key K using a skip list S. The search is carried out using the algorithm using the functions next(p) and below(p).arrow_forwardIn python Write program that counts the number of times an element appears in a list. you should ask the user to enter the number and continue as long as the user wish. For example, if the list is: numbers=[1,4,3,2,5,8,2,3,4,6,2,1]and we are looking for 2 , it should return 3 . If we look for 7 , it should return 0 .)arrow_forward
arrow_back_ios
SEE MORE QUESTIONS
arrow_forward_ios
Recommended textbooks for you
- 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
Database System Concepts
Computer Science
ISBN:9780078022159
Author:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:McGraw-Hill Education
Starting Out with Python (4th Edition)
Computer Science
ISBN:9780134444321
Author:Tony Gaddis
Publisher:PEARSON
Digital Fundamentals (11th Edition)
Computer Science
ISBN:9780132737968
Author:Thomas L. Floyd
Publisher:PEARSON
C How to Program (8th Edition)
Computer Science
ISBN:9780133976892
Author:Paul J. Deitel, Harvey Deitel
Publisher:PEARSON
Database Systems: Design, Implementation, & Manag...
Computer Science
ISBN:9781337627900
Author:Carlos Coronel, Steven Morris
Publisher:Cengage Learning
Programmable Logic Controllers
Computer Science
ISBN:9780073373843
Author:Frank D. Petruzella
Publisher:McGraw-Hill Education