Question

05-02-2017 CMSC 250 Problem (3): YOU write some (pseudo-)code! (90 pts) write a program in pseudocode (Similar to the code on the Big-o slides) for the following problems 1. (15 points) Given n, z1,z2,zs, 4 determine if there is a c c4 such that The program MUST run in O(m) time. 2. (15 points Given n z .z2.zs, do Two things: (1) determine if there is a ci, c2.cs,c4 such that AND (2) if there IS such a c c2, ca, cs then OUTPUT one such tuple The program MUST run in O(n) time. 3. (0 points but this is an HONORs PROBLEM) Given n,zi,r2,ra,z4 determine How MANY ci, cz.ca, are such that c4 The program MUST run in O(n) time. BEGIN YOUR ANSWER TO PROBLEM (3) BELOw THIS LINE
media%2F855%2F855f8814-c32d-41b1-922f-ff
0 0
Add a comment Improve this question Transcribed image text
Answer #1

Solution:

1)

  1. Begin
  2. for i=0 to 3
  3. set z= c1*x1+c2*x2+c3*x3+c4*x4
  4. if n is equal to z
  5. return true
  6. else
  7. return false

2)

  1. Begin
  2. for i=0 to 3
  3. set z= c1*x1+c2*x2+c3*x3+c4*x4
  4. if n is equal to z
  5. print c1, c2, c3, c4
  6. return true
  7. else
  8. return false

I hope this helps. Don't forget to give a thumbs up if you like this.

Add a comment
Know the answer?
Add Answer to:
05-02-2017 CMSC 250 Problem (3): YOU write some (pseudo-)code! (90 pts) write a program in pseudocode...
Your Answer:

Post as a guest

Your Name:

What's your source?

Earn Coins

Coins can be redeemed for fabulous gifts.

Not the answer you're looking for? Ask your own homework help question. Our experts will answer your question WITHIN MINUTES for Free.
Similar Homework Help Questions
  • 20 points] Collaborative Problem: You are helping some security analysts monitor a collection of networked computers,...

    20 points] Collaborative Problem: You are helping some security analysts monitor a collection of networked computers, tracking the spread of an online virus. There are n computers in the system, labeled C1,C2 Cn, and as input, you are given a collection of trace data indicating the times at which pairs of computers communicated. Thus the data is a sequence of ordered triples (Ci, Cj, tk) Such a triple indicates that Ci and C, communicated at time tk. Assume there are...

  • How do i write the pseudocode for this java code? First, write out pseudocode, and then create a program to help you by accomplishing the following tasks: :  Use command line interface to ask the use...

    How do i write the pseudocode for this java code? First, write out pseudocode, and then create a program to help you by accomplishing the following tasks: :  Use command line interface to ask the user to input the following. ○ How many apples are on hand ○ How many apples should be in stock ○ How many oranges are on hand ○ How many oranges should be in stock  Perform an operation to determine how many of...

  • Python Problem, just need some guidance with the description, pseudocode and run time. I believe this...

    Python Problem, just need some guidance with the description, pseudocode and run time. I believe this is an 0-1 knapsack problem? Shopping Spree: (20 points) Acme Super Store is having a contest to give away shopping sprees to lucky families. If a family wins a shopping spree each person in the family can take any items in the store that he or she can carry out, however each person can only take one of each type of item. For example,...

  • NOTE: You are NOT required to write a program for this problem. We wish to determine...

    NOTE: You are NOT required to write a program for this problem. We wish to determine whether at least one three-of-a-kind exists in a hand of N cards, where a three-of-a-kind is three of the same value. Assume the cards have values 1 – 13. For example, the hand with card values {11, 5, 11, 5, 5} does have at least one three-of-a-kind. For each of the following algorithms (A and B), find the simplified total Big-O run time as...

  • write a code on .C file Problem Write a C program to implement a banking application...

    write a code on .C file Problem Write a C program to implement a banking application system. The program design must use a main and the below functions only. The program should use the below three text files that contain a set of lines. Sample data of these files are provided with the assessment. Note that you cannot use the library string.h to manipulate string variables. For the file operations and manipulations, you can use only the following functions: fopen(),...

  • Can you please help me with creating this Java Code using the following pseudocode? Make Change C...

    Can you please help me with creating this Java Code using the following pseudocode? Make Change Calculator (100 points + 5 ex.cr.)                                                                                                                                  2019 In this program (closely related to the change calculator done as the prior assignment) you will make “change for a dollar” using the most efficient set of coins possible. In Part A you will give the fewest quarters, dimes, nickels, and pennies possible (i.e., without regard to any ‘limits’ on coin counts), but in Part B you...

  • Develop a functional flowchart and then write a C++ program to solve the following problem. 1....

    Develop a functional flowchart and then write a C++ program to solve the following problem. 1. Create a text file named c1.txt and write your brand of computer (like Dell, HP, etc) in the file. You will be reading the name of the file from the keyboard as a string, using the string class. Your program will also read the brand of your computer from the keyboard. The process of the file creation (name of the file, mode for opening...

  • NOTE: You are NOT required to write a program for this problem. We wish to determine...

    NOTE: You are NOT required to write a program for this problem. We wish to determine whether at least one three-of-a-kind exists in a hand of N cards, where a three-of-a-kind is three of the same value. Assume the cards have values 1 – 13. For example, the hand with card values {11, 5, 11, 5, 5} does have at least one three-of-a-kind. For each of the following algorithms (A and B), find the simplified total Big-O run time as...

  • Edit a C program based on the surface code(which is after the question's instruction.) that will...

    Edit a C program based on the surface code(which is after the question's instruction.) that will implement a customer waiting list that might be used by a restaurant. Use the base code to finish the project. When people want to be seated in the restaurant, they give their name and group size to the host/hostess and then wait until those in front of them have been seated. The program must use a linked list to implement the queue-like data structure....

  • Write a C program for: One technique for dealing with deadlock is called “detect and recover.” In...

    Write a C program for: One technique for dealing with deadlock is called “detect and recover.” In this scheme, some procedure is used to identify when a deadlock occurs, and then another procedure is used to deal with the blocked processes. One technique to identify a deadlock is to maintain a resource graph that identifies all processes, all resources, and the relationships between them (that is, which processes exclusively own which resources, and which processes are blocked waiting for which...

ADVERTISEMENT
Free Homework Help App
Download From Google Play
Scan Your Homework
to Get Instant Free Answers
Need Online Homework Help?
Ask a Question
Get Answers For Free
Most questions answered within 3 hours.
ADVERTISEMENT
ADVERTISEMENT