subject

Chris recently received an array p as his birthday gift from Joseph, whose elements are either 0 or 1. He wants to use it to generate an infinite long superarray. Here is his strategy: each time, he inverts his array by bits, changing all 0 to 1 and all 1 to 0 to get another array, then concatenate the original array and the inverted array together. For example, if the original array is [0,1,1,0] then the inverted array will be [1,0,0,1] and the new array will be [0,1,1,0,1,0,0,1]. He wonders what the array will look like after he repeat this many many times. He ask you to help him sort this out. Given the original array pp of length n and two indices a, b (≪≪, means much less than) Design an algorithm to calculate the sum of elements between a and b of the generated infinite array p^, specifically, ∑≤≤p^. He also wants you to do it real fast, so make sure your algorithm runs less than O(b) time. Explain your algorithm and analyze its complexity.

ansver
Answers: 2

Another question on Computers and Technology

question
Computers and Technology, 21.06.2019 17:30
How many pairs of chromosomes do human body cells contain?
Answers: 2
question
Computers and Technology, 22.06.2019 03:50
You are working as a security analyst in a company xyz that owns the whole subnet range of 23.0.0.0/8 and 192.168.0.0/8. while monitoring the data, you find a high number of outbound connections. you see that ip's owned by xyz (internal) and private ip's are communicating to a single public ip. therefore, the internal ip's are sending data to the public ip. after further analysis, you find out that this public ip is a blacklisted ip, and the internal communicating devices are compromised. what kind of attack does the above scenario depict?
Answers: 3
question
Computers and Technology, 22.06.2019 18:30
What is outfitting a workplace with video in a technology
Answers: 2
question
Computers and Technology, 24.06.2019 02:10
Which sentences describe the things you need to ensure while creating a sketch and a drawing? while an artistic or creative drawing is a creative expression, a technical drawing is an informative expression. you need to create accurate and neat drawings to convey accurate information. a technical drawing clearly conveys its meaning or information, and does not leave room for interpretation maintain a good speed while creating drawings
Answers: 1
You know the right answer?
Chris recently received an array p as his birthday gift from Joseph, whose elements are either 0 or...
Questions
question
History, 06.11.2020 20:50
question
Mathematics, 06.11.2020 20:50
question
Mathematics, 06.11.2020 20:50
question
Biology, 06.11.2020 20:50
question
Mathematics, 06.11.2020 20:50
question
Mathematics, 06.11.2020 20:50
question
Mathematics, 06.11.2020 20:50
Questions on the website: 13722363