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
Katena32 [7]
3 years ago
8

Write a linear (O(N)) running time complexity program in Java to find all the dominant elements in the given array of N distinct

integer elements. An element is a dominant element if is greater than all the elements to its right side. The rightmost element in the array is always a dominant element. For example, in the array {16, 17, 4, 3, 5, 2}, dominant elements are 17, 5 and 2.
Computers and Technology
1 answer:
kotykmax [81]3 years ago
3 0

The program is an illustration of arrays

<h3>What are arrays?</h3>

Arrays are variables that hold multiple values of the same type in one variable name

<h3>The program in Java</h3>

The linear (O(N)) running time complexity program in Java, where comments are used to explain each line is as follows

import java.util.*;

public class Main{

   public static void main(String [] args){

       //This initializes an array

       int arr[] = {16, 17, 4, 3, 5, 2};

       //This gets the size of the array

       int size = arr.length;

       //This iterates through the array

       for (int i = 0; i < size; i++){

 //This declares an integer variable

 int j;

 //This iterates through every other element of the array

 for (j = i+1; j < size; j++){

     //This condition breaks the loop

  if (arr[i] <=arr[j])

   break;

 }

 //This conditions prints the dominant element

 if (j == size){

  System.out.print(arr[i] + " ");}

       }

   }

}

Read more about arrays at:

brainly.com/question/25083828

You might be interested in
Write a program that prompts the user to input the decimal value of a double and outputs the number rounded to the nearest integ
KengaRu [80]

Answer:

#include <bits/stdc++.h>

using namespace std;

int main() {

double n;

cout<<"Enter a decimal number: ";

cin>>n;

int Round= floor((n- floor(n))*2);

if(Round==0)

{

n= floor(n);

}

else n= ceil(n);

cout<<n;

return 0;

}

5 0
4 years ago
. In the select algorithm that finds the median we divide the input elements into groups of 5. Will the algorithm work in linear
8090 [49]

Answer:

we have that it grows more quickly than linear.

Explanation:

It will still work if they are divided into groups of 77, because we will still know that the median of medians is less than at least 44 elements from half of the \lceil n / 7 \rceil⌈n/7⌉ groups, so, it is greater than roughly 4n / 144n/14 of the elements.

Similarly, it is less than roughly 4n / 144n/14 of the elements. So, we are never calling it recursively on more than 10n / 1410n/14 elements. T(n) \le T(n / 7) + T(10n / 14) + O(n)T(n)≤T(n/7)+T(10n/14)+O(n). So, we can show by substitution this is linear.

We guess T(n) < cnT(n)<cn for n < kn<k. Then, for m \ge km≥k,

\begin{aligned} T(m) & \le T(m / 7) + T(10m / 14) + O(m) \\ & \le cm(1 / 7 + 10 / 14) + O(m), \end{aligned}

T(m)

​

 

≤T(m/7)+T(10m/14)+O(m)

≤cm(1/7+10/14)+O(m),

​

therefore, as long as we have that the constant hidden in the big-Oh notation is less than c / 7c/7, we have the desired result.

Suppose now that we use groups of size 33 instead. So, For similar reasons, we have that the recurrence we are able to get is T(n) = T(\lceil n / 3 \rceil) + T(4n / 6) + O(n) \ge T(n / 3) + T(2n / 3) + O(n)T(n)=T(⌈n/3⌉)+T(4n/6)+O(n)≥T(n/3)+T(2n/3)+O(n) So, we will show it is \ge cn \lg n≥cnlgn.

\begin{aligned} T(m) & \ge c(m / 3)\lg (m / 3) + c(2m / 3) \lg (2m / 3) + O(m) \\ & \ge cm\lg m + O(m), \end{aligned}

T(m)

​

 

≥c(m/3)lg(m/3)+c(2m/3)lg(2m/3)+O(m)

≥cmlgm+O(m),

​

therefore, we have that it grows more quickly than linear.

5 0
3 years ago
Which wireless communication is typically limited to six feet of distance?
Tcecarenko [31]

Answer:

Bluetooth is a wireless communication    is  typically limited to   six feet distances

Explanation:

Bluetooth is one type of communication maximum it covers  10 meters to 30 meters.   but it is one to one communication made for data transactions.  After  25 meters of coverage on communication will be very slow on data transactions. But Bluetooth has also had a limitation.

IR.  It is one of communication where infrared technology used. It is like face to face communication and speed of data transaction limited and it is also one to one communication made for data transactions. Communication paired and covered very little distances.

NFC it is chip-based and covers very little in fact just to device meet each and communication started. And very it caries very little data during the data transactions. it is also one to one communication made for data transactions

RFID is one of communication and it is powerful to cover more areas with multiple connections at the same time. It has a limitation  in distance and it covers  like a net with a specific distance  

4 0
3 years ago
Which of these statements are true of verifying that a program’s code is fixed? Check all of the boxes that apply.
aksik [14]

Answer:

Its C.

Explanation:

hope it helps !

mark me brainliest :))

7 0
3 years ago
Read 2 more answers
What is custom software
Kobotan [32]
A custom sofware is a computer program or website written <span>specifically for your company,</span>
4 0
4 years ago
Read 2 more answers
Other questions:
  • A group of students want to create an educational online game for computer laboratory in their school which type of network will
    6·1 answer
  • According to the presentation, integrity and ethics are particularly important for careers in which of the following pathways?
    5·1 answer
  • How do i get the schools admin password for the good wifi
    10·2 answers
  • Why vechiles Tyres are black in colour?​
    14·1 answer
  • What causes the poles of the electromagnet in an audio speaker to repeatedly switch directions?
    6·2 answers
  • Tables should be used when (a) the reader need not refer to specific numerical values. (b) the reader need not make precise comp
    14·1 answer
  • PLEASE HELP me with at least 1 of the problems in the picture <br><br>We are coding using python​
    14·1 answer
  • Solve the equation.<br>| 11 X 12362​
    14·1 answer
  • From few sometime I am unable to answer any question. Whenever I am clicking on Answer button it is taking me to logging page. B
    15·1 answer
  • A common hardware component found in electronic devices including desktop computers, laptops, tablets and smartphones. The amoun
    5·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!