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
sashaice [31]
3 years ago
15

Describe an algorithm that, given n integers in range 0 to k, preprocesses its input and then answers any query about how many o

f the n integers fall into a range [a...b] in O(1) time. Your algorithm should use O(n+k) preprocessing time.
Computers and Technology
1 answer:
pogonyaev3 years ago
8 0

Answer:

Explanation:

Assume that our integers are stored in array A[1 · · · n] and thus, length[A] = n. We need two additional  arrays B[1 · · · k] and C[1 · · · k].

Our algorithm will first initialize all elements of array B to 0. This step

requires O(k) time.

Next, for each element of array A (i.e., A[i] for i = 1, 2, · · · , n), we will increment

B[A[i]]. Observe that this step will require O(n) time and B[j] for j = 1, 2, · · · , k, now contains the number

of elements of A having value j. Finally, make C[1] = B[1] and for each element l of array C where

l = 2, 3, · · · , k, we will compute C[l] = B[l] + B[l − 1]. This step takes O(k) time.

Now, to answer any query about how many of n integers fall into a range [a · · · b], we simply compute

C[b] − C[a] + B[a].

Observe that this computation requires only O(1) time after the O(n + k) preprocessing

time.

You might be interested in
List five kinds of view in the computer and briefly define each​
mr Goodwill [35]

Answer:

It responds to a specific set of instructions in a well-defined manner. It can execute a prerecorded list of instructions (a program).

5 0
2 years ago
Leah’s computer is connected to the network most of the time. Once, she noticed few of her files with sensitive data were missin
vivado [14]

Answer:

The Firewall (Router) is the vulnerable hardware.

Explanation:

The entry into the network will be the firewall (If there is a firewall installed on the network), if this medium is compromised, every workstation on the network will be vulnerable.

3 0
3 years ago
List and briefly describe the major types of system in organization?​
Anni [7]

The major types of systems in the organization are:

  1. Operational Level system
  2. Management Level system
  3. Strategic Level system  

The classification of information systems based on organization levels is determined by the specialties and interests in some functional areas.

Operational-level systems assist operational managers by tracking the organization's basic operations and transactions, as well as the movement of materials in a factory. The primary function of systems at this level is to respond to routine inquiries and to record the movement of transactions via the organization. In general, information must be easily accessible, up to date, and accurate.

Management-level systems support middle managers' observing, regulating decision-making, and administrative operations. The primary question tackled by such systems is:

  • Are things running smoothly?

Management-level systems usually give regular reports rather than real-time operational data.

Strategic-level systems assist senior management in addressing strategic challenges and long-drawn patterns, both inside the organization and in the external world. Their primary focus is harmonizing external adjustments in the environment with current organizational capacity. 

Therefore, from the above explanation, we can conclude that we've fully understood the types of systems in the organization of information systems.

Learn more about information systems here:

brainly.com/question/13299592?referrer=searchResults

7 0
3 years ago
Read 2 more answers
Which of the following is not an example of a technological aid?
emmainna [20.7K]
I think the correct answer among the choices given is option A. Manipulative aids are not technological aids. It refers to items that is used to support hands-on learning like markers, toothpick or coins. Technological aids, on the other hand, are things which makes use of the new technology present like slideshows, DVD's, audioclips and projectors.
6 0
3 years ago
Which of the following technologies is the best choice to convey urgent and highly sensitive information? telephone fax letter e
snow_lady [41]
Using e-mail to send messages is the best choice to convey urgent and highly sensitive information. E-mail is just a conversation between you and the recipient. So it is the best when it comes to when you are sending a highly sensitive information. While telephone fax letter and dispatch radio may need to use a mediator to transfer messages which violates the confidentiality of the information.
3 0
3 years ago
Other questions:
  • I. Given the following Java code fragment, what is output? int a, b; String c, d, e; String x = new String("I LOVE"); String y =
    14·1 answer
  • The North American Free Trade Agreement (NAFTA) among Canada, Mexico, and the United States is intended to _____.
    5·2 answers
  • A disadvantage of ethernet??
    6·1 answer
  • Data ____ travel over the Internet from router to router until reaching their destinations.
    7·1 answer
  • The need to strike a<br>- among work, life, family, and other responsibilities is<br>universal.​
    15·1 answer
  • If we can lock a file, we can solve the race condition problem by locking a file during the check-and-use window, because no oth
    14·1 answer
  • [This is on Edhesive (coding and programming)]
    8·2 answers
  • Vadik is creating a program where the user inputs their grade level and the program tells them which sports teams they are allow
    9·2 answers
  • Susan wants to play the games that come with Windows on her computer, but they are not on the Start menu. What should she do in
    7·1 answer
  • Define a function FindLargestNum() with no parameters that reads integers from input until a negative integer is read. The funct
    9·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!