Archie1101's blog

By Archie1101, history, 23 months ago, In English

I have recently learned FFT and how we can multiply polynomials in n * logn. I sometimes struggle in coming up with the polynomials and how they should be multiplied in the context of the problem. For example in this problem. https://open.kattis.com/problems/kinversions we have to calculate the inversions.

We have to multiply polynomials but how to come up with the polynomial and whether the second polynomial should be inverted/rotated/shifted before being multiplied?

Like something these for the polynomials multiplied

0 1 0 1 _ _ _ _

_ _ _ _ 0 1 0 1

or

0 1 0 1 _ _ _ _

_ _ _ _ 1 0 1 0

or

0 1 0 1 _ _ _ _

1 0 1 0 _ _ _ _

where 0 is B and 1 is A.

Thanks!!

Full text and comments »

  • Vote: I like it
  • 0
  • Vote: I do not like it

By Archie1101, 23 months ago, In English

This is regarding in implementation solution of the problem of finding bridges in a graph. For example in the solution https://cp-algorithms.com/graph/bridge-searching.html

It says that for finding the low_link[s] for the current node. For it's child say 'c' if c has not been visited we take low_link[s] = min(low_link[s],low_link[c]) but if the child is visited we take low_link[s] = min(low_link[s],tin[c])

For a back edge why do we min with the tin[c] and not it's low_link[c]. If it is to prevent doing 2 jumps, how does it matter in finding the bridges anyway?

Shouldn't the bridge finding logic be unaffected by it?

Full text and comments »

  • Vote: I like it
  • +6
  • Vote: I do not like it