Design a function that utilizes Newton's method for calculating the cube root of a given number....
Fantastic news! We've Found the answer you've been seeking!
Question:
Transcribed Image Text:
Design a function that utilizes Newton's method for calculating the cube root of a given number. ; contract: calcCubeRoot: number(x) → number 2. (25 points) Design a function that applies binary addition for given two binary numbers. For example, z = 0010 (= 2 in 10-base system) and y = 1010 (= 10), then x + y = 1100 (= 12). ; contract: addBinaryNumbers: string(x) string(y)→ string 3. (25 points) Design a function that finds the smallest root of a quadratic equation. For example, for the given function x²-3x - 4, the smallest root is -1. ; contract: calcSmallest Root: number(coef1) number(coef2) number(coef3)→ num ; coef (coefficient) parameters are given in order such that coef1 corresponds to the coefficient of ², coef2 corresponds to x and coef3 is for xº 4. (25 points) Design a function that finds the first occurrence index of the given pattern in the given sentence. For example, assume that the query is "world" and the sentence is "Hello world", then the function returns 6. If any occurrence of the pattern is not found, then the function returns -1 indicating that the pattern does not exist in the given sentence. ; contract: findPatternIndex: string(sentence) string(query) → number Design a function that utilizes Newton's method for calculating the cube root of a given number. ; contract: calcCubeRoot: number(x) → number 2. (25 points) Design a function that applies binary addition for given two binary numbers. For example, z = 0010 (= 2 in 10-base system) and y = 1010 (= 10), then x + y = 1100 (= 12). ; contract: addBinaryNumbers: string(x) string(y)→ string 3. (25 points) Design a function that finds the smallest root of a quadratic equation. For example, for the given function x²-3x - 4, the smallest root is -1. ; contract: calcSmallest Root: number(coef1) number(coef2) number(coef3)→ num ; coef (coefficient) parameters are given in order such that coef1 corresponds to the coefficient of ², coef2 corresponds to x and coef3 is for xº 4. (25 points) Design a function that finds the first occurrence index of the given pattern in the given sentence. For example, assume that the query is "world" and the sentence is "Hello world", then the function returns 6. If any occurrence of the pattern is not found, then the function returns -1 indicating that the pattern does not exist in the given sentence. ; contract: findPatternIndex: string(sentence) string(query) → number
Expert Answer:
Related Book For
Data Structures and Algorithms in Java
ISBN: 978-1118771334
6th edition
Authors: Michael T. Goodrich, Roberto Tamassia, Michael H. Goldwasser
Posted Date:
Students also viewed these programming questions
-
Tucker Company shows the following transactions for the accounting period ending December 31, Year 1: Sold books to customers for $68,000 on account. Collected $56,000 from customers. Issued common...
-
Post - Combination Balance Sheet Presented below are the balance sheets of Allen Corporation and Benson Corporation, immediately prior to a business combination. The fair values of Benson s reported...
-
The cube root of 27 is 3. How much larger is the cube root of 27.2? Estimate using the Linear Approximation.
-
Refer to the information in BE4-7 for Hébert Company. Prepare the correcting journal entries. Information in BE4-7 1. A collection of cash on account from a customer for $750 was recorded as a...
-
Sherlock Holmes is using an 8.20-cm-focal-length lens as his magnifying glass. To obtain maximum magnification, where must the object be placed (assume a normal eye), and what will be the...
-
Usually the column space and null space of a matrix contain vectors of different sizes. For a square matrix, though, the vectors in these two sets are the same size. Usually the two sets will be...
-
Find an article that discusses ethics and the use of social media by paralegals.
-
For each of the following specific audit procedures, indicate the type of audit procedure it represents: (1) Inspection of records or documents, (2) Inspection of tangible assets, (3) Observation,...
-
how this following article related to culture and glocalization: Decoding Western Festive Season Symbols and Rituals in Marketing Messages: A Bottom of the Pyramid Consumer Study in South Africa
-
Daniel Company uses a periodic inventory system. Data for 2015: beginning merchandise inventory (December 31, 2014), 2,000 units at $38; purchases, 8,000 units at $40; expenses (excluding income...
-
What is the major difference between the scope of GATT, Article I and the scope of Article III? details.
-
provide requirements for a ATM machine On MS word (PLEASE USE AGILE METHODOLOGY) Who is the actor on a this ATM machine What is the system? Write a User Story for the ATM machine write system...
-
A 1 . 0 5 kg block is attached to a spring with spring constant 1 4 . 5 N / m . While the block is sitting at rest, a student hits it with a hammer and almost instantaneously gives it a speed of 4 1...
-
How do you reverse a linked list in place? Explain? Write an algorithm to reverse a list Input: Head of following linked list 1->2->3->4-> NULL Output: Linked list should be changed to,...
-
1. Why is it better to host an application in the cloud instead of on-prem? 2. What is REST API? How does it differ from SOAP API?
-
Calculate the binding energy per nucleon for Be, 59 Co, 208 pb, and 195 pt. (For the atomic masses, see this table. Enter your answers to at least two decimal places.) (a) Be MeV/nucleon 59 Co...
-
Montauk Oil Co.reports these account balances on December 31, 2017 Accounts payable $ 110.000 Kara $ 200.000 Notes payable $ 260.000 Equipment $ 160.000 in advance $ 80.000 Accounts receivable $...
-
Shreemaya Hotel in !adore was facing a problem of low demand for its rooms due to off season. The Managing Director (MD) of the hotel, Mrs. Sakina was very worried. She called upon the Marketing...
-
Write a program that visualizes an Euler tour traversal of a proper binary tree, including themovements from node to node and the actions associated with visits on the left, from below, and on the...
-
Develop a Java implementation of an adaptable priority queue that is based on an unsorted list and supports location-aware entries.
-
Write a Java class that extends the Progression class so that each value in the progression is the absolute value of the difference between the previous two values. You should include a default...
-
What is a best practice in general? Give examples of best practices in an area unrelated to project management, such as nutrition, exercise, or child rearing.
-
What are some unique features of project management software in general?
-
Why should organizations identify and use best practices? What are the main categories of best practices developed as part of OPM3?
Study smarter with the SolutionInn App