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
kondaur [170]
3 years ago
11

Given an array of integers and the size of the array, write a function findDuplicate which prints the duplicate element from the

array. The array consists of all distinct integers except one which is repeated. Find and print the repeated number. If no duplicate is found, the function should print -1.
Computers and Technology
1 answer:
Jlenok [28]3 years ago
5 0

Answer:

#include <iostream>

using namespace std;

void findDuplicate(int arr[], int size) {

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

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

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

              cout << arr[j] << endl;

              return;

          }

      }

  }

  cout << -1 << endl;

}

int main() {

  int arr[] = {2, 3, 5, 6, 11, 20, 4, 8, 4, 9};

  findDuplicate(arr, 20);

  return 0;

}

Explanation:

You might be interested in
A 2-dimensional 3x3 array of ints, has been created and assigned to tictactoe. Write an expression whose value is true if the el
ludmilkaskok [199]

Answer:

Following are the expression of the given statement.

tictactoe[0][0] == tictactoe[1][0] && tictactoe[1][0] == tictactoe[2][0]

Explanation:

In the following scenario, there is the two dimensional or matrix array of integer data type 'tictactoe' which has a total of nine elements then, after that we have to define the diagonal of the array variable which comprises the very 1st element of the 1st row are equal. So, the following expressions are true according to the scenario.

8 0
3 years ago
What the difference between an operating system drive and a storage drive?
mojhsa [17]

Answer:

An operating system is installed on a disk drive. An operating system is software and a disk drive is a storage medium. To put it very simply, a disk drive is what an operating system (or other data) is stored on.

Explanation:

g00gled it

6 0
2 years ago
Ill give you brainiest.
quester [9]
Hey there,

I believe that your correct answer would be that "<span> some people will tell you what they think you want to hear </span>". When you ask someone about the perceptions of your person trait, they will most likely <span>tell you what they think you want to hear because its what they want to make you happy. 

For example: Jimmy ask billy "Am I fat Billy"

                      Billy tells Jimmy "No, Your not fat, you look just great".

                         But really, Jimmy is very fat.

The point is that people are going to say things that make you feel happy and something that you want to hear.

~Jurgen</span>
6 0
3 years ago
Describe the basic features of the relational data model and discuss their importance to the end user and the designer. Describe
Mandarinka [93]

Answer:

The answer to this question can be described as follows:

Explanation:

Relational data model:

The use of data tables to organize sets of entities into relationships requires a relational data model. this model work on the assumption, which is a primary key or code, that is included in each table configuration. The symbol for "relational" data links and information is used by other tables.

Model Design:

This model is used for database management, it consists of structure and language consistency. It is design in 1969.

Importance of data model:  

This provides a common standard for processing the potentially sound data in machines, that was usable on almost any one device.  

Big Data:

It moves to locate new and innovative ways to handle large volumes of authentication tokens and to gather business insights when offering high efficiency and usability at an affordable cost at the same time.

6 0
3 years ago
What is the most important job of a web server?
attashe74 [19]

Answer:

Provide requested web pages to clients; the other tasks listed there are secondary to that.

6 0
2 years ago
Read 2 more answers
Other questions:
  • How often are computer and user policies applied after a user has logged into a computer?
    15·1 answer
  • Which of the following patterns of cell phone use can be observed in this chart
    12·1 answer
  • What task does the casting director do, apart from auditioning actors?
    8·1 answer
  • Review the two e-mail messages below for their adherence to the guidelines for professional e-mail correspondence you have learn
    6·1 answer
  • Instructions:Select the correct answer from each drop-down menu. What type of font color should Kim select if she chooses a dark
    10·2 answers
  • Write a loop to print 10 to 90 inclusive (this means it should include both the
    10·1 answer
  • How do i do a class in java??
    5·1 answer
  • Explain why it is important to follow a course or a program in keeping with your value system​
    13·1 answer
  • How i simplify this boolean expression ?A'.B'.C'+A'.B'.C+A'.B.C+A.B'.C+A.B.C
    6·2 answers
  • Please answer quickly :S
    7·2 answers
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!