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
nlexa [21]
3 years ago
13

Given a sorted list of integers, output the middle integer. A negative number indicates the end of the input (the negative numbe

r is not a part of the sorted list). Assume the number of integers is always odd.
Ex: If the input is: 2 3 4 8 11 -1
the output is:
Middle item: 4
The maximum number of inputs for any test case should not exceed 9. If exceeded, output "Too many numbers". Hint: First read the data into a vector. Then, based on the number of items, find the middle item. 276452.1593070
(Must include vector library to use vectors)
Computers and Technology
1 answer:
7nadin3 [17]3 years ago
5 0

Answer:

If the input is: 2 3 4 8 11 -1

the output is:

Middle item: 4

To explain the given is as follows,

Explanation:

Code:-

#include <iostream>

#include <vector>

using namespace std;

int main()

{

   std::vector<int> v;

   int temp, i=0;

   cout <<"Enter the sorted elements "<<endl;

   while(1){

        cout<<"Enter ["<<i<<"]element"<<endl;//Accept elements in a vector

        cin >> temp;

        i++;

        if(temp>0)

          v.push_back(temp);

        else       //If negative number is inputed assume end of input

          break;

   }

   cout<<"Size of a vector is:"<<v.size()<<endl; //Find size of vector

   

 

   if (v.size() % 2 == 0){

       cout <<"NUMBER OF ELEMENTS SHOULD BE ODD";

   }

   else if(v.size()>9){

       cout<<"Too many numbers.";

   }

   else{

       cout<<"Median = " << v[v.size()/2]<<endl; //Find median  

   }

       

}

Output:

You might be interested in
1.1 what is the osi security architecture? 1.2 what is the difference between passive and active security threats? 1.3 list and
ioda

The well-designed standard architecture for security features in computer networking is defined by the OSI Security Architecture.

The OSI architecture is widely accepted because it establishes the process for ensuring safety in an organization. In a live attack, the victim is made aware of it. The victim of a passive attack is not made aware of the attack. System resources can be modified during an active attack. System resources are not changing while under passive attack. Monitoring a system is the focus of passive assaults, which do not require changing any data on the target system. On the system under attack, active threats will alter data.

Learn more about system here-

brainly.com/question/14253652

#SPJ4

6 0
1 year ago
These things are commonly found on the front of desktop computer cases:
jok3333 [9.3K]

USB ports, headphone jack/microphone port, and of course, a power button.

3 0
3 years ago
The U.S. government has put in place IPv6-compliance mandates to help with the IPv4-to-IPv6 transition. Such mandates require go
schepotkina [342]

Answer:

The U.S. Government has put in place an IPv6 mandate that comes into affect on September 30th. That new mandate requires all government agencies to have their public facing websites and email services available over IPv6.

At this point, it’s not likely that every government website will meet the deadline, though a large number of them will. Christine Schweickert, senior engagement manager for public sector at Akamai, told EnterpriseNetworkingPlanet that she expects over 1,800 U.S Government websites will be on IPv6 by the mandate deadline.

From an Akamai perspective, the company has a large number of U.S. Government customers that it is enabling for IPv6 with dual-stack servers. In a dual-stack implementation, a site is available natively over both IPv4 and IPv6. Akamai’s Content Delivery Network has a mapping technology that optimizes traffic around the Internet. Getting the government websites to run on IPv6 is just a matter of putting the site configuration on the Akamai dual-stack server maps.

“So if a request comes in to a government website from an IPv6 client, we will go ahead and route them to the best performing Akamai Edge server that can speak IPv6 back to that request,” Schweickert explained.

Another approach that some network administrators have tried for IPv6 support has been to tunnel the IPv6 traffic over an IPv4 network, or vice-versa. In Schweickert’s view, that’s not an ideal solution as it tends to break things.“When you’re tunneling, you’re routing through IPv4 packets and that’s not in the spirit that we have to operate in globally,” Schweickert said.

In contrast, Schweickert noted that with dual-stack, the server will respond to IPv4 requests with IPv4 content and to IPv6 requests with IPv6 content. “If you’re using tunneling, you’re really just doing a workaround,” Schweickert said.

To make it even easier for the U.S. Government websites, Akamai isn’t actually charging more money for the dual-stack service either. Schweickert noted that the dual-stack capability is a feature that is already part of the delivery service that Akamai is providing to its U.S Government customers.

David Helms, Vice President, Cyber Security Center of Excellence at Salient Federal Solutions is among those that are backers of the Akamai approach to meeting the September 30th IPv6 mandate. In his view, it’s all about enabling interesting services and locations over IPv6 in order to spur adoption.

8 0
3 years ago
Directions: Identify the measuring devices and write its functions.
FrozenT [24]

Answer:

1.weigher - to weigh meat

2.

3. scissor - to cut things

4. tongs

5.measuring cups - to measure dry ingredients like flour

6 temperature - measures temperature

7 measuring spoons

5 0
3 years ago
A production house needs an operating system that captures, saves, and generates information within specific time. Which type of
Natali [406]

Answer:

A real-time operating system

Explanation:

An operating system is a system software pre-installed on a computing device to manage or control software application, computer hardware and user processes.

This ultimately implies that, an operating system acts as an interface or intermediary between the computer end user and the hardware portion of the computer system (computer hardware) in the processing and execution of instructions. Some examples of an operating system on computers are QNX, Linux, OpenVMS, MacOS, Microsoft windows, IBM, Solaris, VM etc.

There are different types of operating systems (OS) based on their functions and these includes;

I. Simple Batch System.

II. Multiprocessor System.

III. Desktop System.

IV. Multiprogramming Batch System.

V. Distributed Operating System.

VI. Network System.

VII. Realtime Operating System.

In this scenario, a production house needs an operating system that captures, saves, and generates information within specific time. Therefore, the type of operating system that the production house should choose is a real-time operating system.

A real-time operating system can be defined as an operating system (OS) that provides services to a system as they are required, without any form of delay or buffering of data.

4 0
3 years ago
Other questions:
  • What is a method whereby new problems are solved based on the solutions from similar cases solved in the past?
    5·1 answer
  • Apache web server is the most widely used network operating system used on web servers.
    8·2 answers
  • How does knowing the player type you are impact your game designing?
    6·1 answer
  • Explain 5 service provided by Internet​
    6·1 answer
  • What does it mean to say that a graph is complete?
    14·1 answer
  • In computer science how can you define "copyright, designs and patents act 1988"?​
    8·1 answer
  • To override a method in a subclass, the method must be defined in the subclass using the same signature and compatible return ty
    12·1 answer
  • Stacy is in the process of creating a storyboard for her personal website, but she is unable to decide which storyboarding techn
    13·1 answer
  • _____ have networked and texted all of their lives with smartphones, tablets, and high-speed Internet.
    8·1 answer
  • True or false: Concurrent validation is more time consuming to measure than predictive validation because it involves a wait per
    13·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!