general question amortized cost and worst case

lets say a data structure has operations called insert and delete both of which take O(log(n)) worst case. Suppose the amortized cost of insert is O(log(n)) and the amortized cost of delete is O(1).

Now if a sequence that has n delete operations performed on this data structure that has n elements currently, then what is the worst case? If delete takes O(1) amortized cost does this mean the worst case (not amortized) is O(n) for n delete’s ?

I think no because it doesn’t seem right but I’m not sure how to explain it

Thoughts on using Bitcoin (SV) for freelancing or business in general?

Bitcoin SV is the original bitcoin fork that follows the original Satoshi design. Supporters include Craig Wright who is being sued for $ 4bn for being Satoshi Nakamoto. Practical advantages include:

– financial freedom & privacy (only I know how much I earn in bitcoin)
– niche market with very little competition (very few people use it at this point)
– 0 fees (no bank/payment processor commissions, forex exchange fees etc)
– users with high willingness to pay
– decentralised (nobody can ban…

Thoughts on using Bitcoin (SV) for freelancing or business in general?

General Solution for $u(r,\theta, t)$

I am trying to find a general solution for the PDE $ $ \frac{\partial u}{\partial t}=\frac{1}{r}\frac{\partial}{\partial r}\left(r\frac{\partial u}{\partial r}\right)+\frac{1}{r^2}\frac{\partial^2 u}{\partial\theta^2},$ $ using the substitution $ u(r,\theta, t)=R(r)S(\theta)T(t).$ The substitution gives the three ODES, \begin{align} S”-\beta S&=0 \tag{1}\ \frac{d}{dr}\left(r\frac{dR}{dr}\right)+\left(\lambda r+\frac{\beta}{r}\right)R&=0 \tag{2} \ T’+\lambda T&=0 \tag{3}. \end{align} The question states that $ \beta=-m^2$ , which gives the following solution to $ (1)$ , $ $ S_m(\theta)=A_m\cos(m\theta)+B_m\sin(m\theta).$ $ The question also states that $ \lambda=k^2>0$ . By transforming $ (2)$ into a Bessel equation of order $ m$ $ $ p\frac{d}{dp}\left(p\frac{dR}{dp}\right)+(p^2-m^2)R=0,$ $ we see that this has solution $ R_n(r)=J_m((\mu^n_m)^2),$ where $ \mu^n_m$ denotes the $ n^{th}$ zero of the $ m^{th}$ order Bessel function ($ R$ is finite as $ r\rightarrow 0^+$ ). Solving $ (3)$ gives $ $ T(t)=C_1e^{-k^2t}.$ $ But I am unsure if this is correct, as I do not know how to create an infinite series for $ u(r,\theta, t)$ .

What are Rules for concealing thieves tools (or items in general)?

I’m playing a rogue assassin in my current campaign, and I’m about to embark on an infiltration mission where I’ll be wearing formal attire. I told the DM I would want to conceal a few lockpicks on my person, but was told (because he was not sure how to rule it) that I would need specifically made attire to accomplish this.

This seemed a little odd to me, and I swear I saw a ruling on this topic somewhere, but haven’t been able to find it. Is there an established rule/official ruling out there about hiding small items, especially something like lockpicks?

DAO design pattern and general DB access in Python

I’m designing the code for adding database functionality with psycopg2 in a Python project consisting in a multithreaded Telegram bot deployed in Heroku.

The thing is, me coming from the Java world, I started to look for ways of designing the database access, the pool of connections, etc… My first thought was making facades and DAOs with maybe a Singleton to provide access to the pool of connections psycopg2 already provides.

But I’m finding difficult get Python DAO implementations from the internet. Is this pattern OK in Python or I am missing something?

I would love to see some common best practice example for designing all this. Every resource is welcome.

Thank you in advance.

Is there a general theory of when certain polynomials are integrable due to symmetry tricks?

Consider the functions $ x^2$ and $ x^4 + 2x^2y^2$ on the unit sphere $ S^2$ . The surface integral of these functions over the sphere can easily be calculated by symmetry via $ $ 3 \iint_{S^2} x^2 \mathrm{d}A = \iint_{S^2} (x^2 + y^2 + z^2) \, \mathrm{d}A = \iint_{S^2} \mathrm{d}A = 4\pi$ $ and $ $ 3 \iint_{S^2} (x^4+2x^2y^2)\, \mathrm{d}A = \iint_{S^2} (x^2 + y^2 + z^2)^2 \, \mathrm{d}A = \iint_{S^2} \mathrm{d}A = 4\pi.$ $

However, I suspect (although I cannot prove) that the function $ x^4$ cannot be integrated without direct parameterization of the sphere and evaluation of the surface integral.

My question is: in general, given any symmetries and polynomial relations on a manifold (in this case $ (x, y, z) \mapsto (y, z, x)$ and $ x^2 + y^2 + z^2 = 1$ ), is there a general theory to determine what functions are integrable over the manifold by symmetry and relations alone?

A reference (or definitive statement of lack thereof) would be greatly appreciated.

Is there an inexpensive general way to make items forever immune to energy damage?

Some monsters live in environments that deal constant energy damage so that any stuff left nearby is destroyed. Other monsters have special abilities that deal energy damage over a wide area and destroy stuff. In both cases, I want the stuff to survive. Here are some examples:

  • A fire weird (Monster Manual II 90-2, 94) lives in a pool of fire that deals fire damage to creatures and objects therein. (Don’t worry—the fire weird itself is immune to fire.) The weird’s smart enough to own useful gear, and I want to equip it appropriately, but if, while in her pool, she drops something, it’ll be destroyed by the fire damage. Likewise, if she doesn’t want to carry something, leaving it in the pool will see it destroyed and leaving it outside the pool sees it vulnerable to casual theft.
  • A wizard with a penchant for gardening keeps as a servant/pet/guard a greenvise (Monster Manual II 120-1). The greenvise’s extraordinary ability death fog deals to each creature and object in a 60-ft. spread 3d8 points of acid damage—no saving throw. (Don’t worry—the greenvise itself is immune to acid.) Each use of the greenvise’s death fog ability will see the surrounding area decimated… including all the tools the wizard-gardener had been using to prune his greenvise.

When I’ve encountered this issue while dungeoncrafting, I’ve longed for a dead simple way to make nearby or carried items immune to energy damage, be it completely or selectively. For example, it seems like overkill to pay 2,000 gp to make the wizard-gardener’s Profession (gardener) masterwork tool out of riverine (Stormwrack 128) solely so that it survives the greenvise’s deathfog!

Is there a mundane or magical game element that’s relatively inexpensive (ideally just double the cost of a normal item or something but certainly under 2,000 gp per lb.!) that can protect forever items from energy damage?

If instead an individualized list of game elements better meets this criteria—like an alchemical coating that prevents sonic damage and a magic item effect that grants an item immunity forever to acid damage and so on—, that kind of list makes an appropriate answer, too.

Explanation of how to resolve Hash conflicts in HAMT or hashtables in general

I am working on trying to understand HAMT and now am uncertain generally what to do when you run into a conflict in a hash. All I understand so far is you create a list to append the keys to, but I don’t understand any deeper. I would like to know (ideally for the HAMT case, but any hash would do) how you resolve conflicts, what you do exactly.

I would like to implement a hashtable / HAMT sort of thing, but don’t conceptually grasp how the collisions work. This goes into the HAMT implementation more, but it’s also hard to understand.

Essentially what I would like to do is create a binary trie, where the key of some data is hashed and used as the trie key. This works fine except for collisions. I’m not sure what to do in the case of collisions.