algorithms – Time complexity of finding median in data stream

I was reading a solution to the problem in the title on leetcode and the article says that the time complexity of the following solution is O(n)

  1. setup a data structure to hold stream value and insert new element in the right place using linear search or binary search
  2. return median

my solution is as follows:

class MedianFinder:

    def __init__(self):
        initialize your data structure here.
        self.arr = ()

    def addNum(self, num: int) -> None:
        idx = bisect.bisect_left(self.arr, num)
        self.arr.insert(idx, num)

    def findMedian(self) -> float:
        # self.arr.sort()
        if len(self.arr) % 2 != 0:
            return self.arr(len(self.arr)//2)
            return (self.arr(len(self.arr)//2 -1) + self.arr(len(self.arr)//2 ))/2

My question is about the time complexity of the push method. the binary search will take O(log n) to find the index. the insert will take O(n). but since the method will be called on the stream, will the complexity be O(n^2) or O(n) ?

enter image description here

abstract algebra – Finding the smallest positive integer n such that Sn contains an element of order 11

I know how to find the n for the orders like 60,30,12…
But the orders which are prime numbers like 11,13,…, I doubt them; the answer is 11 right?
(Since I know that S8 has the element of order 15, so I think my answer cannot be true)
(thank you in advance)

java – How to write proper regex finding my patern

I want to find links with text in big string. I’m looking for such patern: (text)(url), for example (Check it on stackoverflow)( i have regex which finding mosly good results but there is problem when this patern is enclosed in brackets like This is our forum ((Check it on stackoverflow)( maybe you can help)
Regex: /((.*))((.*.*?))/ i do need to put sentence between .* like .*stackoverflow.*. Is there posibility to stop regex after first )?

python – Finding the Euclidean distance between the vectors of matrix a, and vector b

Here is the problem,

Given a 2D numpy array ‘a’ of sizes n×m and a 1D numpy array ‘b’ of
size m. You need to find the distance(Euclidean) of the ‘b’ vector
from the rows of the ‘a’ matrix. Fill the results in the numpy array.
Follow up: Could you solve it without loops?

a = np.array(((1, 1),
              (0, 1),
              (1, 3),
              (4, 5)))
b = np.array((1, 1))
print(dist(a, b))

And here is my solution

import math

def dist(a, b):
    distances = ()
    for i in a:
        distances.append(math.sqrt((i(0) - b(0)) ** 2 + (i(1) - b(1)) ** 2))
    return distances

a = np.array(((1, 1),
              (0, 1),
              (1, 3),
              (4, 5)))
print(dist(a, (1, 1)))

I wonder how can this be solved more elegant, and how the additional task can be implemented.

algorithms – Finding distinct pairs in geometric settings

Suppose there are $n$ points $p_1,p_2,…,p_n$ with color red or blue on a line. We want to find all pairs $(p_i,p_j)$ their color is distinct and there are no points between theme. If there are $k$ pairs with described design an algorithm with $O(nlog k)$ that use idea divide and pruning.

I think if we check all point we can solve this problem , but running time is not $O(nlog k)$.

I think for solving this problem we can use the duality that present in this page

But i get stuck to solve my problem. any help be appreciated.

calculus – Finding $min frac{left[int_{0}^{1}f(x)mathrm dxright]^2}{int_{0}^{1}(f(x))^3mathrm dx}$ given that $f(0)=0$ and $0lt f'(x)le 1$

enter image description here

I have been stuck on this for quite some time, here is what I have tried. Since $0lt f'(x)le 1$, then taking the definite integral on both sides of the inequality we get that $0lt f(1)le 1$. Let $f(1)=kin (0,1)$. then the curve $y=f(x)$ passes through the points $(0,0)$ and $(1,k)$ the join of which lies on the line $y=kx$. Since $0lt f'(x)le 1$, $y=f(x)$ cannot be concave upwards. I am unable to proceed from this step.

Another alternate approach I have tried to use was the Cauchy-Schwarz inequality for integrals but to no avail. Perhaps the AM-GM inequality might be useful, since the function is non-negative in $(0,1)$ but I am not exactly sure how. Any hints or ideas are appreciated. Thanks.

Finding and cracking BIOS PW with kali help

Finding and cracking BIOS PW with kali help – Information Security Stack Exchange

command line – Finding keychain item creator codes

command line – Finding keychain item creator codes – Ask Different

Not finding raspberry.local on my computers

So, just bought a Raspberry Pi Zero W, and downloaded the Sticky-Fingers Kali-Linux image, and flashed it to an micro-sd card. I don’t want to spend 20 dollars on a micro-HDMI adapter + USB keyboard, so I found a way to set it up headless from the official site ( I added the necessary files, triple checked they’re all right, and booted up my Pi. I tried using both nmap and fing to find devices on my network, but my device isn’t showing up. So, I decided to try mDNS. But when I try sshing into it with my WSL2 Ubuntu, it fails. So, I installed avahi-daemon, made sure it works, but ssh still fails. "No such host is known". I decide to just use powershell, still fails. I already had Bonjour but installed it again, and used putty to try connecting to it, still fails. Tried using a Mac, times out trying to connect to port 22. I checked the Sticky-Fingers image documentation, makes no mention of a different hostname. I tried connecting over a USB connection (configuring the pi as a ethernet/gadget), still fails. I have no idea why it’s not connecting, and I’ve tried everything I can find short of buying adapters. I really don’t want to spend money (even if it’s relatively cheap) if I can do it headless. If anyone can help, I really appreciate it.

equation solving – Finding the coefficients of an expression

I have a set of formulas of the following form:

{5.1011 + E^(-6876.32 t) (-5.1011 + 1. x), 
 5.28335 + E^(-4868.36 t) (-5.28335 + 1. x), 
 6.45616 + E^(-1847.14 t) (-6.45616 + 1. x), 
 144.165 + E^(-34.6815 t) (-144.165 + 1. x), 
 320. + E^(-15.6055 t) (-320. + 1. x)}

I would like to get the coefficients {a, b, c} where each of the formulas is expressed as

a + e^(b*t)*(c + 1.` vStart)

I tried using rules, “Normal”, and Solve to see if I could figure this out. I will note that if I take any of these expressions and for example do this:

5.1011 + E^(-6876.32 t) (-5.1011 + 1. x) //TreeForm

I get a picture like this:
TreeForm of equation

so Mathematica clearly understands the pieces. I just cannot figure out how to turn this into the list shown with TreeForm so I can grab the pieces. As an example, in this tree (simplifying each coefficient), I’d get a=5.1, b=-6876.3, c=-5.1.

I suspect this is something simple but am at a loss. Any help appreciated.

DreamProxies - Cheapest USA Elite Private Proxies 100 Private Proxies 200 Private Proxies 400 Private Proxies 1000 Private Proxies 2000 Private Proxies - Buy Cheap Private Proxies Buy 50 Private Proxies Buy 100 Private Proxies Buy 200 Private Proxies Buy 500 Private Proxies Buy 1000 Private Proxies Buy 2000 Private Proxies ProxiesLive New Proxy Lists Every Day Proxies123