Find the probability of occurrence of each edge in a graph having $n$ nodes after $k$ operations

Given a graph with $ n$ nodes . The adjacency matrix of the graph is given. We do $ k$ operations on this graph. In each operation we choose two distinct nodes $ i$ and $ j$ (there are $ (n*(n-1))/2$ such choices) equiprobably (all choices are equiprobable) and if there exists a edge between $ i$ and $ j$ we delete that edge or else we draw an edge between the chosen pair of nodes.
We have to output a $ n*n$ matrix where the element at $ (i,j)th$ position denotes the probability of occurrence of edge connecting the nodes $ i$ and $ j$ in the final resulting graph.
The constraints on n and k are $ n<=50$ and $ k<=50$ .
I tried it using dynamic programming but could figure out transitions properly.
Can you please help me out.

How to estimate the complexity of sequential algorithm given that we know the complexity of each step?

First case: I was stumble upon a two step sequential algorithm where the big O complexity of each step is O(N^9).

Second case: Also if the algorithm have three steps where the complexity of step 1 is O(N^2), the complexity of step 2 is O(N^3) and the complexity of step 3 is O(N^9)

What would be the complexity of the first case and second case ?

What Illusion spell would allow me to trick two enemies into fighting each other?

Is there a good spell or combination of spells that will allow me to cause opponents to see their allies as the enemies they are fighting? Either one on one or in groups? The intention is to make them fight their allies thinking that the allies are the enemy.

The best i can think of is using Major Image and placing it over another creature, so that his companions see him as the bad guy. Then through concentration I can manipulate the illusion to make it look like its fighting… Unfortunately that would only work for one attack because once the illusion is touched the opponent can see through it… Any other options?

Having a backdoor password for each user to allow impersonation

For some context, I want my api to be able to ‘impersonate’ (or connect as) a user on my ldap database as most of the api’s access controls are on the ldap database and tied to the user you are connected as.

In order to do this I have an idea where I will generate a random password for each user. The random password will then be encrypted with a key only the api has access to. The encrypted string will then be stored under the user’s entry. Now when the api wants to impersonate a user, it will get the encrypted string, decrypt it and then connect as that user.

How bad of an idea is this?

Oracle PL-SQL “Regular expression” to replace each “(space)and(space)” with ‘,’ in a string

I have a string like this x=y and g=h and u=1 and I need to replace each (space)and(space) with ,. I’m using the powerful regular_expression for this but it does not give me the desired result.

select regexp_replace('x=y and g=h and u=1','(^[[:space:]]*)AND(^[[:space:]]*)', ',') from dual; 

I was wondering if you could help me out here. thanks in advance.