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
dmitriy555 [2]
3 years ago
15

Define a function max_n(arr, n) that takes in an array and an integer as arguments. Your function will then return the n largest

values from that array as an array containing n elements. It is safe to assume that arr will have at least n elements. The resulting array should have the largest number on the end and the smallest number at the beginning.
Computers and Technology
1 answer:
NikAS [45]3 years ago
4 0

Answer:

def max_n(arr, n):

   arr.sort()

   i = len(arr)-n

   return arr[i:]

Explanation:

Define a function called max_n that takes two parameters, an array and an integer

Sort the array

In order to get the last n largest values, we need to slice the array. To do that we need a starting point. Our starting point of slicing will be the "lentgh of the array - n". That means, if we start slicing from that index to the last in the sorted array, we will get the last n largest values.

Assume array is 10, 2, 444, 91 initially.

When we sort it, it becomes 2, 10, 91, 444

Now let's say we want last 2 largest values, our sliced array index should start from 2 and go until the end

i = 4 - 2 = 2 → arr[2:]  will return us 91 and 444

You might be interested in
pWhat macOS system application tracks each block on a volume to determine which blocks are in use and which ones are available t
Anna [14]

Answer:

The answer is "The Volume Bitmap".

Explanation:

It is a hidden file, that records the available space and it can't accessible on the drive. It accelerates the process of publishing new documents onto the database by keeping the device from testing the position of each file, and the wrong option can be described as follows:

  • The MDB is used to define the data volume, that's why it is wrong.
  • The volume control block is used to maintain the system heap, that's why it is wrong.
5 0
3 years ago
When methods have ____, other programs and methods may use the methods to get access to the private data.
Nostrana [21]

When methods have public access, other programs and methods may use the methods to get access to the private data.

<h3>What do you mean by public access?</h3>

The Definition of the term public access is known to be a kind of a television channel where anybody can be able to broadcast a program

An example is the city council meeting can be able to broadcast on public access.

Hence, When methods have public access, other programs and methods may use the methods to get access to the private data.

See full question below

When methods have ____, other programs and methods may use the methods to get access to the private data.

a. private access

b. public access

c. complete access

d. all access

Learn more about public access from

brainly.com/question/2736088

#SPJ1

5 0
1 year ago
Escribe un ejemplo de:• Software de aplicación. • Software de diagnóstico. • Software de sistema. ayudenme plis, me toca entrega
Afina-wow [57]

Answer:

1. Software de aplicación: Microsoft Word.

2. Software de diagnóstico: Speccy.

3. Software de sistema: Windows operating system (OS).

Explanation:

Un software puede definirse como un conjunto de instrucciones ejecutables (códigos) o una colección de datos que se utiliza normalmente para instruir a una computadora sobre cómo realizar una tarea específica y resolver un problema en particular.

Básicamente, los softwares se clasifican en tres (3) categorías principales y estas son;

1. <u>Software de aplicación</u>: es un software de usuario final que normalmente está diseñado para realizar tareas y funciones específicas.

Algunos ejemplos de software de aplicación son Microsoft PowerPoint, Notepad, Windows Media player, Firefox, Go-ogle Chrome, Adobe Photoshop, AutoCAD, etc.

2. <u>Software de diagnóstico</u>: estos son programas de software que se utilizan para solucionar problemas y posiblemente reparar un sistema informático.

Algunos ejemplos de software de diagnóstico son Speccy, Windows Sysinternals Suite, System Explorer, hddscan, HWiNFO, SIW (System Information for Windows), CPU-Z, HD Tune, etc.

3. <u>Software de sistema</u>: es un software que normalmente está diseñado para ejecutar el hardware de la computadora y todas las demás aplicaciones de software.

Algunos ejemplos de software del sistema son Linux, Windows OS, Mac OS, WinZip, McAfee antivirus, Norton antivirus, Avast antivirus, Piriform CCleaner, Ubuntu, etc.

8 0
3 years ago
Netflix uses ________ analytics to suggest which movies we should watch as well as to develop new content that it is confident w
marusya05 [52]

Answer:

"Predictive analytics" is the correct answer to the given question.

Explanation:

Predictive analysis is the analysis of the data. It is a type of data analytics that gives the future results by analyzing the historical data Some of the examples of predictive analytics are Machine Learning. Netflix is using the technique of Predictive analytics.

Netflix provides the services of entertainment. In Netflix, we watch the movies also it developed the new content.

6 0
3 years ago
Where do players resurrect if they have been destroyed in a game?
CaHeK987 [17]

Usually back to their start point. Or a random place on the map.

3 0
3 years ago
Other questions:
  • Add the following functions to the code:
    9·1 answer
  • Which network topology requires terminators at the ends of the backbone cable?
    6·1 answer
  • Which is a benefit of peer-to-peer networking?
    10·1 answer
  • You want to create Web pages that can easily adapt to and serve multimedia content to smartphones, tablets, gaming devices and s
    13·1 answer
  • Question 4 of 20
    5·1 answer
  • You can count on everything online to be 100% accurate. <br> A. FALSE <br> B. TRUE
    11·2 answers
  • 10.7 LAB: Fat-burning heart rate Write a program that calculates an adult's fat-burning heart rate, which is 70% of 220 minus th
    8·1 answer
  • What does the following code segment do?
    13·1 answer
  • What happens to a message when it is deleted?
    11·1 answer
  • Which of the following are the most important reasons people in the 1920s were so interested in seeing lifelike stories in audio
    6·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!