pseudocode – Use magic-pivot as a black-box to obtain a deterministic quick-sort algorithm with worst-case runningtime of O(nlogn)

Suppose we have an array A(1 :n) of n distinct numbers. For any element A(i), we define the rank of A(i), denoted by rank (A(i)), as the number of elements in A that are strictly smaller than A(i) plus one; so rank (A(i)) is also the correct position of A(i) in the sorted order of A. Suppose we have an algorithm magic-pivot that given any array B (1 :m) (for anym >0), returns an element B(i) such that m/3≤rank(B(i))≤2m/3 and has worst-case runtime O(n)1. Example:if B= (1,7,6,2,13,3,5,11,8), then magic-pivot(B) will return one arbitrary number among {3,5,6,7}(since sorted order of B is (1,2,3,5,6,7,8,11,13))

r – How to obtain a plot from dataframe

Good afternoon !

Assume we have the following dataframe :

(1,)         1 0.2943036 0.5019925 0.6485579 0.7519886 0.7719700 0.8390800
(2,)         2 0.2943036 0.5019925 0.6485579 0.7519886 0.8002251 0.8390800
(3,)         3 0.2943036 0.5019925 0.6485579 0.7519886 0.7719700 0.8163203
(4,)         4 0.2943036 0.5019925 0.6485579 0.7519886 0.8002251 0.8390800
(5,)         5 0.2943036 0.5019925 0.6485579 0.7519886 0.8002251 0.8390800
(6,)         6 0.2943036 0.5019925 0.6485579 0.7169111 0.7719700 0.8163203
(1,) 0.8423178 0.8593898
(2,) 0.8703779 0.8955885
(3,) 0.8703779 0.8593898
(4,) 0.8703779 0.8955885
(5,) 0.8703779 0.8955885
(6,) 0.8423178 0.8593898

res_final=structure(c(1, 2, 3, 4, 5, 6, 0.294303552937154, 0.294303552937154, 
0.294303552937154, 0.294303552937154, 0.294303552937154, 0.294303552937154, 
0.501992524602876, 0.501992524602876, 0.501992524602876, 0.501992524602876, 
0.501992524602876, 0.501992524602876, 0.648557894001512, 0.648557894001512, 
0.648557894001512, 0.648557894001512, 0.648557894001512, 0.648557894001512, 
0.751988554448582, 0.751988554448582, 0.751988554448582, 0.751988554448582, 
0.751988554448582, 0.71691105972394, 0.771969986695426, 0.800225140644398, 
0.771969986695426, 0.800225140644398, 0.800225140644398, 0.771969986695426, 
0.839080029787269, 0.839080029787269, 0.816320316445505, 0.839080029787269, 
0.839080029787269, 0.816320316445505, 0.842317781397926, 0.870377899917965, 
0.870377899917965, 0.870377899917965, 0.870377899917965, 0.842317781397926, 
0.859389755570637, 0.895588541263924, 0.859389755570637, 0.895588541263924, 
0.895588541263924, 0.859389755570637), .Dim = c(6L, 9L), .Dimnames = list(
    NULL, c("res_final", "", "", "", "", "", "", "", "")))

I’m wanting to plot each row as a continous curve , i tried:

apply(res_final,1,function(x) plot(res_final(x,) , xlab = "Number of sensors ", ylab = "Cumulative detection probability", main = "Evolution of cumulative probabilities for 6-targets based on the Number of sensors"))

However , this doesn’t allow to plot all of the 6 continious curves within the same plot. I’m also searching to distinguish between the curves using different colors.

I hope my question is clear.

Thank you a lot for your help !

Is it possible to obtain the historical exchange rate time series of trading pair such as BTC-USD on exchanges that do not provide this trading pair?

On exchanges such as Poloniex and Binance, BTC-USD is not offered as trading pair. However, one can buy BTC with USD on some of such platforms (e.g. one can buy BTC with USD on Poloniex and Binance). Are there some ways of obtaining the historical exchange rate time series between BTC and USD on such exchanges?

india – Is there a simple procedure or what are the procedures to obtain a permit to visit Lakshadweep islands?

I wanted to know why Indian citizens need a permit to visit Lakshadweep, and an answer on Quora says:

“To protect the interests of the general public of Lakshadweep, about
95% of whom are Scheduled Tribes, the Administrator has, with previous
approval of Central Govt. and in exercise of powers vested under
Laccadive, Minicoy & Amindivi Islands (laws) Regulation, 1965, made
the Laccadive, Minicoy and Amindivi Islands (Restriction on Entry and
Residence) Rules, 1967. As per these rules, every person, who is not a
native of these islands, shall have to obtain a permit in the
Prescribed Form from the Competent authority, for entering into and
residing in these islands”. Lakshadweep also has a full-fledged naval
base. So, permit adds an additional security layer.

Cited from: Wayback Machine, 2015 archive of the department of revenue and the naval base establishment.

Since the requirement of a permit exists since 2004, and the naval base came up in 2012, it left me wondering if things could have changed as of 2019, that such strict restrictions and permits would not be necessary for a simple vacation to relax, snorkel, kayak and scuba dive?

Some websites say that a police clearance is required from near the residence of the visitor and then another clearance is required from a government department in Kochi. Some people write on their blogs that it’s not that much of a hassle to visit. Some recommend the government tour packages, some recommend the private packages, but there’s a lack of a clear, step-by-step explanation on how to get the permit and book a vacation to the islands. Could anyone help with providing these steps?

For example:

  • Where are the offices located, from where I can obtain the permits? What precautions should I take and what insider information do I need to know to avoid hassles, scams and delays? Both for people who know the local language and for those who don’t.
  • Is a police verification from a police station close to my house required (if Indian citizen)? What are the procedures followed for this? Hassles, scams, delays, precautions, necessary documents?
  • If a resort or agent can arrange for the permits, how to I know which ones can be trusted and where are they located? Precautions, scams, delays, reliability and extra charges?
  • If I book one of the government’s vacation packages like “Samudram”, do they arrange for the permits and police verification or am I expected to do it?
  • Any other info that would be helpful for someone who would prefer to
    follow their own itinerary instead of following what some pre-planned
    package offers?

A wish I hope could be conveyed to organizers of Lakshadweep tours: To have a simple, reliable online procedure to get the permits and tickets booked, without having to visit any offices and without having to go through any agents. To be able to decide the duration of the stay and activities without having to follow an itinerary decided by someone else.

Update: A person I know, went to Lakshadweep for official work. He asked around a lot, but even he couldn’t get a clear step-by-step procedure of how to go there on vacation. Somebody there told him that tourism is restricted so that they can preserve the local population’s simple, humble culture and also preserve the pristine natural beauty of the place (which is a sensible thing to do). Also, apparently since the islands are small, they cannot support the load and resources required for a large number of tourists. Perhaps the Lakshadweep admin office or the ticket counter at Kochi could provide more info about procedures, if someone visits and asks for details.

copyright – How do you obtain official brand logos for design prototypes?

I need to use company logos as a part of my designs. These companies are institutions that are stakeholders for my client. Some sites have SVGs you can grab from the website but how does one go about getting those that are not available on the site in a useable format like a PNG or SVG?

Should I ask my client to ask these companies for design assets? Does my client need permission for these logos as well?

fourier analysis – How to analyse raw data to obtain frequency and phase from FFT?

I have some data from an experiment which has multiple “nodes” (dominant sine wave components) and some noise. I want to use FFT to find the amplitude and phase of these dominant components.

Currently, by editing the output of the Fourier function, i have managed to make a function to get the dominant frequencies.

I was wondering if there is a way to find the phase as well? (as well as sort it to only see the phase for the dominant components)

This is the code for the FFT function:

FFT(list_, tstep_, (Omega)max_, n_) := 
  Module({FTlist = Abs(Fourier(list)), 
    totaltime = Length(list) tstep, (CapitalDelta)(Omega), 
    completeFFTlist, plot, peaks, (CapitalOmega)peak},
   (CapitalDelta)(Omega) = N((2 (Pi))/totaltime);
   completeFFTlist = 
        For(i = 1, (2 (Pi) (i - 1))/totaltime > (Omega)max (Nor) 
          i > Length(FTlist), i++, 
         Sow({N((2 (Pi) (i - 1))/totaltime), FTlist((i))/
           Max(FTlist)})))), 1), 1);
   plot = 
     PlotRange -> {{0, (Omega)max}, All}, Frame -> True, 
     PlotStyle -> {SBlue, Thickness(0.005)}, 
     FrameLabel -> {"Angular Frequency (rad/s)", 
       "Power (Arbitrary units)"}, LabelStyle -> Directive(50), 
     PlotTheme -> "Classic");
   peaks = 
    Sort(FindPeaks(completeFFTlist((All, 2))), #1((2)) > #2((2)) &);
   peaks = If(peaks((1, 1)) == 1, Delete(peaks, 1), peaks);
   (CapitalOmega)peak = 
    Table(completeFFTlist((peaks((i, 1)), 1)), {i, 1, n});
   Return({(CapitalOmega)peak, (CapitalDelta)(Omega), 
     completeFFTlist, plot}));

This just makes a nice plot and tells me the n frequencies with the highest intensity/amplitude.

logging – Obtain log of when audio starts and stops

I want to get a list of timestamped events for when the audio player starts and stops. By “audio player” I mean the one that is common for all apps that you see when you pull down the notification bar in Android 11. So when audio that is not system notifications start or stop.

Any way of doing it would be okay. Either an app or through adb and system logs, or something else. As far as I can tell, Android destroys logs from before that last reboot, but I might be wrong about this. If I can access old logs, that would be a solution.

Can I obtain my bitcoin wallet files back from my HDD from the old OS?

So i guess now its good time again to give my lost wallet files another attempt.

I’m an idiot for doing such a thing but then I heard perhaps I can unformat my HDD and retrieve my files back.

I definitely have an idea of the passwords I used and that won’t be the issue.

I was buying btc around 2014-2015. I then decided to install a new mobo and I believe I wasn’t able to unless I reinstalled Windows. I used the windows usb to re-install everything but I’m not sure. It was a very long time ago.

I also don’t know if it was Bitcoin Core or MultiBit app that I was using on the desktop. Either way, I believe the files should be in the same place i.e. APP DATA > ROAMING > etc etc.

Is it possible to use a program like EaseUs to recover these files?

Is anybody willing to help me figure out if the files are completely gone forever or its still hidden under the old partition (which hopefully isn’t over written).

Would it be perhaps under the Window.old folder? (i’m not sure if I have that folder, I need to double check back at work).

I was using WINDOWS 10 and nothing else I think.

If anyone can help me retrieve, I will personally send 0.3 BTC to you from that wallet. 🙂

Thanks for reading guys.

Hope you can help.