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
madam [21]
3 years ago
11

Pls help me pls I’m struggling

Computers and Technology
1 answer:
steposvetlana [31]3 years ago
6 0
You have it correct
You might be interested in
Descending selection sort with output during execution
zvonat [6]

Taking the input as a string, slicing it with a space as the delimiter, turning the divided portion into an integer, and then appending to the list.

<h3>Explanation:</h3>

def selection_sort_descend_trace(numbers):

i=len(numbers)

print("Output: ")

for num in range(0,i-1):# traversing from 0 to N-2, total N-1 iterations

val=numbers[num]

start=num+1

end=i

t=0

for j in range(start,end):

if(val<numbers[j]):

remember=j

val=numbers[j]

t=1

if(t==1):# swaping onlf if greater number is available

temp=numbers[num]

numbers[num]=val

numbers[remember]=temp

for p in range(i):# printing

print(numbers[p],end=' ')

print("\n")

if __name__ == "__main__":

print("Enter the integers separated by space: ")

numbers=[int(x) for x in input().split(' ')]

selection_sort_descend_trace(numbers)

For further details about the explanation, click here:

brainly.com/question/15728245

#SPJ1

6 0
2 years ago
6.25 (Prime Numbers) A positive integer is prime if it’s divisible by only 1 and itself. For example, 2, 3, 5 and 7 are prime, b
faltersainse [42]

Answer:

  1. public class Main {
  2.    public static void main (String [] args) {
  3.        for(int i = 2; i < 10000; i++){
  4.            if(isPrime1(i)){
  5.               System.out.print(i + " ");
  6.            }
  7.        }
  8.        System.out.println();
  9.        for(int i = 2; i < 10000; i++){
  10.            if(isPrime2(i)){
  11.                System.out.print(i + " ");
  12.            }
  13.        }
  14.    }
  15.    public static boolean isPrime1(int n){
  16.      
  17.        for(int i=2; i <= n/2; i++){
  18.            if(n % i  == 0){
  19.                return false;
  20.            }
  21.        }
  22.        return true;
  23.    }
  24.    public static boolean isPrime2(int n){
  25.        for(int i=2; i <= Math.sqrt(n); i++){
  26.            if(n % i  == 0){
  27.                return false;
  28.            }
  29.        }
  30.        return true;
  31.    }
  32. }

<u></u>

Explanation:

Firstly, create the first version of method to identify a prime number, isPrime1. This version set the limit of the for loop as n/2. The for loop will iterate through the number from 2 till input n / 2 and check if n is divisible by current value of i. If so, return false to show this is not a prime number (Line 22 - 26). Otherwise it return true to indicate this is a prime number.

In the main program, we call the isPrime1 method by passing the i-index value as an argument within a for-loop that will iterate through the number 2 - 10000 (exclusive).  If the method return true, print the current i value). (Line 5 - 9)

The most direct way to ensure all the prime numbers below 10000 are found, is to check the prime status from number 2 - 9999 which is amount to 9998 of numbers.

Next we create a second version of method to check prime, isPrime2 (Line 31 - 40). This version differs from the first version by only changing the for loop condition to i <= square root of n (Line 33).  In the main program, we create another for loop and  repeatedly call the second version of method (Line 13 - 17). We also get the same output as in the previous version.

8 0
3 years ago
G The method of mapping where each memory locationis mapped to exactly one location in the cache is
Otrada [13]

Answer:

Direct Mapped Cache

Explanation:

Given that a Direct Mapped Cache is a form of mapping whereby each main memory address is mapped into precisely one cache block.

It is considered cheaper compared to the associative method of cache mapping, and it is faster when searching through it. This is because it utilizes a tag field only.

Hence, The method of mapping where each memory location is mapped to exactly one location in the cache is "Direct Mapped Cache"

4 0
3 years ago
Five routers are to be connected in a point-to-point subnet. between each pair of routers, the designers may put a high-speed li
Natalija [7]

Let assume are lettered A to E in that order. Thus, there will be 10 potential lines: AB, AC, AD, AE, BC, BD, BE, CD, CE and DE. Each of these potential lines has 4 possibilities. Therefore, the total number of topologies is 4¹⁰=1,048,576. 1,048,576. At 100ms <span>it will take 104,857.6 seconds which is slightly above 29 hours to inspect each and one of them.</span>











6 0
3 years ago
Design the logic for a program that allows a usher to continuously enter numbers until the usher enters 0. Display the sum of th
uysha [10]

int sum = 0, n;

do {cin>>n; sum+=n;}while (n!=0);

cout<<sum;

5 0
3 years ago
Other questions:
  • You are troubleshooting an IEEE 802.11 wireless client device that cannot connect to the wireless network. You notice the client
    14·1 answer
  • You are using the grep command, but it is only searching through files in your immediate home directory. What option enables you
    7·1 answer
  • When would you use a template when working with word 2013?
    15·1 answer
  • What are some reasons a person might choose to remain anonymous on the Internet?
    12·2 answers
  • Write an expression that computes the average of the values 12 and 40.
    6·1 answer
  • You would like to emphasize certain key terms on a slide with a bold format. Which slide element should you modify to provide th
    15·2 answers
  • Which of the following activities does an effective team do?
    15·2 answers
  • HELPPPPPPPPP MEEEEE :):):):):)
    10·1 answer
  • How todraw a status bar​
    9·1 answer
  • Can someone help plz, I’d really appreciate it
    7·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!