1answer.
Ask question
Login Signup
Ask question
All categories
  • English
  • Mathematics
  • Social Studies
  • Business
  • History
  • Health
  • Geography
  • Biology
  • Physics
  • Chemistry
  • Computers and Technology
  • Arts
  • World Languages
  • Spanish
  • French
  • German
  • Advanced Placement (AP)
  • SAT
  • Medicine
  • Law
  • Engineering
Anon25 [30]
3 years ago
13

Is greedy algorithm non deterministic by nature?

Computers and Technology
1 answer:
Flura [38]3 years ago
7 0

Answer: Yes

Explanation: Greedy algorithm is the algorithm that gives the solution to the problem on the basis of the piece by piece or step by step architecture.  the next step of the solution is based on the aim of solving problem optimally.But the steps chosen can be correct or incorrect.

Non-deterministic nature is the feature that determines that the  steps that is being chosen is not the most optimal one and no high surety is present.Thus, this nature is present in the greedy algorithm and it has non-deterministic nature.

You might be interested in
10.13 lab 10c: output range with increment of 5 write a program whose input is two integers. output the first integer and subseq
Lynna [10]

he program gives an output in increment of 5, if the first inputted integer is less than the second. The program written in python 3 goes thus

3 0
2 years ago
You receive an email from someone who claims to be a representative from your credit card company. The email asks you to click o
cestrela7 [59]
Here are my definitions of each option:

Spam = Unwanted mail, advertisements, etc

Phishing = Link to a site, usually a fake replica of a legitimate site but with added implements that can be used to spy on you (how people become victims of identity theft

Malware = Usually a malicious piece of code that can be used to slow down your computer or to get a hold of your computer for some other malicious reason

Legitimate = Means that the sender is valid, you know who its coming from, and you know that you won't get attacked by the email

So based on this, I would say that the answer is B. Phishing


3 0
3 years ago
Read 2 more answers
We are building a word processor and we would like to implement a "reflow" functionality that full-justifies text.Given a maximu
adoni [48]

Answer:

The code is given below in Java with appropriate comments

Explanation:

Reflow is an function which helps you to justify your functionality

You need to input a string array and the max width and you will get the

output in a list(string).

public List<String> Reflow(String[] input, int width) {

   List<String> result = new ArrayList<String>();

 

   if(input==null || input.length==0){

       return result;

   }

 

 

   int count=0;

   int last=0;

   ArrayList<String> list = new ArrayList<String>();

   for(int i=0; i<input.length; i++){

       count = count + input[i].length();

 

       if(count+i-last>width){

           int wl = count-input[i].length();

           int sl = maxWidth-wl;

           int each = 1;

           int el = 0;

 

           if(i-last-1>0){

               each = sl/(i-last-1);

               el = sl%(i-last-1);

           }

 

           StringBuilder sb = new StringBuilder();

 

           for(int k=last; k<i-1; k++){

               sb.append(input[k]);

 

               int ce = 0;

               while(ce<each){

                   sb.append(" ");

                   ce++;

               }

 

               if(el>0){

                   sb.append(" ");

                   el--;

               }

           }

 

           sb.append(input[i-1]);//last input in the line

           //if only one word in this line, need to fill left with space

           while(sb.length()<width){

               sb.append(" ");

           }

 

           result.add(sb.toString());

 

           last = i;

           count=input[i].length();

       }

   }

 

   int lastLen = 0;

   StringBuilder sb = new StringBuilder();

 

   for(int i=last; i<input.length-1; i++){

       count = count+input[i].length();

       sb.append(input[i]+" ");

   }

 

   sb.append(input[input.length-1]);

   int d=0;

   while(sb.length()<maxWidth){

       sb.append(" ");

   }

   result.add(sb.toString());

 

   return result;

}

6 0
3 years ago
2) Please create a C program for the following: (25 points) a. Suppose the US dollar to Korean Won is 0.85 dollars to 1000 won.
Zanzabum

Answer:

In C:

#include <stdio.h>

int main(){

       float won,usd,rupee,dinar,peso;

       printf("Won: ");

       scanf("%f", &won);

       usd = won * 0.85/1000;

       rupee = won * 0.85 * 0.14/1000;

       dinar = won * 0.85 * 0.048/1000;

       peso = won * 0.85 * 1.41/1000;

       printf("USD = %f\n", usd);

       printf("Rupee = %f\n", rupee);

       printf("Dinar = %f\n", dinar);

       printf("Peso = %f\n", peso);

   return 0;

}

Explanation:

This declares all variables as float

float won,usd,rupee,dinar,peso;

This prompts the user for Korean Won

       printf("Won: ");

This gets the input for won

       scanf("%f", &won);

This converts to usd

       usd = won * 0.85/1000;

This converts to rupee

       rupee = won * 0.85 * 0.14/1000;

This converts to dinar

       dinar = won * 0.85 * 0.048/1000;

This converts to peso

       peso = won * 0.85 * 1.41/1000;

The next four lines print the converted currencies

       printf("USD = %f\n", usd);

       printf("Rupee = %f\n", rupee);

       printf("Dinar = %f\n", dinar);

       printf("Peso = %f\n", peso);

3 0
2 years ago
Identify the following as True or False.
Leni [432]

Answer:

The answer to this question as follows:

1) False

2) False

3) True

Explanation:

The description of the above option as follows

  • In option 1, A single character variable must be contained in one quote mark, but it is based on the alphabet, which is a specific device, and the price of a continued character varies from one device to another, that's why it is false.
  • In option 2, This option is wrong because in assembly language the identifier value must not exceed the length than 247 characters.
  • In option 3, It is correct because in the variable declaration the first char should be a letter, _, @ or $letter. A total of 1-247 characters. The default case is insensitive.

5 0
3 years ago
Other questions:
  • What is a negative impact of digital communication
    6·1 answer
  • Click _______ to view each individual record of a mail merge document.
    5·2 answers
  • How do I change the selected cell to 20 pt
    8·2 answers
  • Yahoo and Google are examples of __________ used to perform Internet research.
    14·2 answers
  • Solve the following quadratic equation <br><br>y=6x^2-12x+1
    9·1 answer
  • ) Which is true about the agile method?
    7·1 answer
  • HIPAA requires the following controls for medical records: A. Encryption of all data B. Technical safeguards C. Physical control
    12·1 answer
  • Can someone please help me to point out what's wrong with this C program:
    13·1 answer
  • Do you think lossy compression formats will be popular in 20 years? Why or why not?
    10·1 answer
  • Differentiate between patent and copyright.
    6·2 answers
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!