Time complexity – Algorithm to find the lowest common ancestor of all deepest leaves

This is the problem statement I came across today.

Given a binary tree, find the lowest common ancestor of all deepest leaves.

I came up with a correct algorithm, but I would like to confirm the running time of this approach.

The algorithm is as follows:

  1. Traverse the tree and find the deepest level of the tree, dmax.
  2. Traverse the tree and find all leaves at depth dmax.
  3. Given that LCA(A,B,C) = LCA(LCA(A,B),C), traverse all nodes found at step 2 and calculate LCA.

The subroutine for LCA(A,B) is simple. Starting at A, go all the way up to the root and store each visited node in a hashset. Then, starting at B, go up until you find a node which is contained in the hashset.

I know the first two steps of the algorithm are both O(n), where n corresponds to the number of nodes in the tree. However, I am uncertain about the last step.

LCA(A,B) subroutine has a linear complexity. But how many nodes, in the worst scenario, can be found at step 2?.

Intuitively, I would argue that it has to be far less than n nodes.

What is the lowest level that an adventuring party can safely make enough money to take care of a city-state?

Lets say that a party has recently decided to retire from adventuring to focus their efforts in caring for a city-state in need of benefactors. I want to know what the lowest level a party can be and still safely make enough money to provide the required financial support to care for a city-state’s population, without their risking life or limb adventuring.

This isn’t an easy question since the economy of 3.5 is so screwed up that it’s difficult to determine how much a gold piece is worth, much less how many it takes to equal a nations GDP. So Let’s be a bit more exact on what I mean. Let’s say the party is in charge of a City-State the size of Rome, with a population of 35,000. They want to generously provide for it’s citizens by ensuring that each and every person can live a wealthy lifestyle, which costs 50gp/week/person. That means they need to provide 1,750,000 gp/week.

The adventuring party consists of 5 members, all at or below the party level you chose for your answer, of whatever classes you deem appropriate. The party can work any ‘safe’ job necessary to help earn the income required. At the time of their retirement they have at their disposal an amount of money expected for a party of their level, based off of wealth/level guidelines, to spend on purchasing items or equipment which would assist in providing for the City State.

If necessary the party can take up to a month’s worth of time, starting at the moment of retirement, to prepare for providing for the city. This could be spent building equipment, training underlings, or saving up money for a large purchase; whatever will help them to best provide for their city.

The lucky members of the city are being cared for without being required to earn the support, meaning they can not be utilized as part of the parties money making scheme. However, the party can employ any underlings or hirelings they would otherwise have access to.

Any solution must be sustainable long term, at least until the original party grows too old to continue providing for the city. Bonus points for minimizing cheese factor (though I’m open to answers with some low degree cheese) or for not requiring every member of the party to be equal to the total party level

What’s the lowest level at which a PC can break through a hewn stone wall in 1 round?

This question asks how PCs can break a stone wall. Aside from the usage of disintigrate to immediately destroy a wall, it seems that a wall can be destroyed by reducing it’s HP to 0. Walls have a hardness which reduces the damage done to them.

What is the lowest level at which a player character can destroy a wall in 1 round? Magical and mundane means are both in scope, and any item which the character has access to. Limit items to the character’s level or lower.

What is the lowest level at which a human could run a marathon in under two hours?

Inspired by What is the lowest level at which a human can beat the 100m world record (or: the presumed human limit) without using magic?, which I read just after finishing the Athens Marathon last November. Earlier in 2019, Kenyan athlete Eliud Kipchoge ran the marathon distance (42.195 km, about 26.2 miles) somewhat an order of magnitude faster than me in an amazing time of just under 2 hours, during the Ineos 1:59 Challenge.

Most D&D optimization attempts are aimed at short periods/distances (focused on combat situations), so for a change I’d like my (human) athlete to perform a feat of endurance: break the marathon distance record. What is the minimum level at which this can be achieved? A level 12 Monk has a base speed of 30ft + 40ft (assuming they’re unarmed) = 70ft, which, extrapolating the ‘Movement and Distance’ table on page 162 of my 3.5e Player’s Handbook translates to a Hustle speed of 14 miles an hour. A second hour of hustling incurs 1 point of nonlethal damage, and makes the character fatigued (I know how that feels) but doesn’t influence movement speed, so this monk should cross the finish line after 1:52 and a bit.

Since, unlike Usain Bolt, Eliud Kipchoge got some help from others (pacemakers, nutrition provided by a horseback bike rider, pacing lasers) during this record attempt, our human athlete character is allowed to invoke the help of their fellow party members, but magic is still out of the question; otherwise, you could just hire a bunch of Sorcerers, located at specific intervals on the track, each casting Expeditious Retreats for a continuous 30ft/round bonus.

Assume D&D 3.5e rules, and any officially rule book is allowed (I only have the Core Rulebooks, which for instance (AFAICT) don’t contain a feat which increases movement). When in doubt, the contest rules in the linked question apply (except for the assistance of up to five party members, which are the same level as the athlete).

Rolling 7 stats of 4d6R1R2-L and dropping lowest one in AnyDice

Rolling an individual (N)PC stat of 4d6, rerolling 1s and 2s, and dropping the lowest gives a modal average of 15 with a range of 9-18.  The AnyDice code to produce the graph for that is simple enough (and there are multiple ways to code this):

output [highest 3 of 4d{3..6}] 

What I’d like to do is roll 7 sets of these and drop the lowest sum (thus obtaining a standard 6 D&D stat scores, but specifically the highest 6 sums out of 7).
     How might I tell AnyDice to show me how this affects the scores in contrast to a standard 6 rolls of 3d6?

Git Merge Lowest common ancestor problem

How does Git find the ‘merge base’ of two branches in a commit graph? From what I understand, this reduces to finding the lowest common ancestor of a directed acyclic graph. After reading up on several algorithms with which one may do this, I am wondering how Git manages to solve the LCA problem.

(Apologies if this is more of a stack overflow question. I am however more interested in the internal algorithm Git uses so it may be appropriate for this forum.)

What is the lowest level at which a human can beat the 100m world record (or: the presumed human limit) without using magic?

Optimizing a character build for fast movement in order to break the sound barrier is a well-tried source of fun with numbers in DnD. Such speed optimizations usually incorporate lots of magic and possibly additional help by allies. But I’d like to learn more about what the human body is capable of within the rules of DnD, so I’m more interested in what can be achieved without magic.

A high level Monk with two levels in Fighter and the Mobile Feat can still become ridiculously fast. If I didn’t mess up the calculations, he can run 100m in about 7.52 seconds: Use Action Surge and Step of the Wind for triple dashing to run 84m in 6 seconds, then double dash in the next round for the remaining 16m. This is even almost 2 seconds faster than 9.4s, which scientists think is the human limit (in our world, that is). But hey, it’s a Level 20 character, so becoming somewhat superhuman does kind of make sense in the world of DnD, I guess.

This raises the question: At what point in the game can human adventurers become superhuman without using magic? This is of course a more vague and general question (one could ask the same e.g. in the context of lifting strength), but let’s stick to running speed for the moment. So, my question in precise terms is:

What is the minimum level at which a human character can run 100m in less than 9.58 (or: 9.4) seconds and thus break the current world record (or: become superhuman)?

Constraints:

  • No magic.
  • No epic boons.
  • No UA (but any official rule book).

Let’s use the same approach as above, i.e. Mobile Feat + k squares Unarmored Movement + Action Surge + Step of the Wind. Since a round is 6 seconds long and a square corresponds to 1,5m, this strategy lets you run 100m in

$ $ t(k)=6+\frac{100-(48+6k)}{6+\frac34 k}$ $

seconds. Plugging in the possible values of k yields

$ $ t(2)\approx 11.333, \quad t(3)\approx 10.121, \quad t(4)\approx 9.111, \quad t(5)\approx 8.256, \quad t(6)\approx 7.524.$ $

Hence, a Monk 9 / Figher 2 is still more than half a second away from beating the world record, while gaining another Monk Level already makes her superhuman at a total Character Level of 12. Did I miss something? Or can one even do better with an altogether different strategy?


PS: A quick comment on the tricky question about Ki being magic: Since Ki is only used for Step of the Wind, we could add two Rogue Levels and achieve the same by taking the Cunning Action instead. However, this would raise the current minimum level to 14.

TCNHosting – 3 Different VPS Plans on sale out of Dallas, TX! Lowest is $20 a year!

TCNHosting is back with a flash sale for the community. They have been featured here before, so we hope you enjoy what they are offering to us today! These are VPS Plans out of Dallas, TX.

As always we’re interested in hearing your feedback so feel free to comment in the comments section below.

You can find their ToS/Legal Docs here. They accept PayPal, Credit Cards, Debit Cards, Alipay, Bitcoin, Litecoin, and Ethereum as payment methods.

Here’s what they had to say: 

“Here at TCNHosting, we have built our hosting company based on our customer’s values. Since day one we kept our servers secure and reliable. We know how important it is for customer’s to keep their sites always available.
Whether you are facing issues with payments or require technical assistance we are always available to help you in the process.

You’ll also be pleased to know that all of our servers are powered by SSD technology, which means no spinning drives for better reliability and performance for your applications! We look forward to contributing more to the LowEndBox community in the future and hope you find one of our LEB specials below beneficial for your VPS hosting needs!”

Here are the offers: 

2GB VPS Special

  • 2 CPU Cores
  • 2GB RAM
  • 30GB SSD Storage
  • 2TB Monthly Transfer
  • 1Gbps Port
  • OpenVZ/SolusVM
  • 1 x IPv4 Address
  • $ 20 a year
  • [ORDER]

4GB VPS Special

  • 4 CPU Cores
  • 4GB RAM
  • 50GB SSD Storage
  • 5TB Bandwidth
  • 1Gbps Port
  • OpenVZ/SolusVM
  • 1 x IPv4 Address
  • $ 45 a year
  • [ORDER]

8GB VPS Special

  • 4 CPU Cores
  • 8GB RAM
  • 100GB SSD Storage
  • 6TB Bandwidth
  • 1Gbps Port
  • OpenVZ/SolusVM
  • 1 x IPv4 Address
  • $ 90 a year
  • [ORDER]

NETWORK INFO:

Dallas, Texas, USA

Test IPv4: 192.3.237.150
Test file: http://192.3.237.150/100MB.test

VPS Nodes – Host Node Specifications:
– Intel Xeon E3 Series
– 32GB DDR3 RAM
– 4x 1TB Samsung Enterprise SSD’s
– Hardware RAID-10 powered by LSI MegaRAID
– Dual 1Gbps Network Uplinks

Please let us know if you have any questions/comments and enjoy!

The post TCNHosting – 3 Different VPS Plans on sale out of Dallas, TX! Lowest is $ 20 a year! appeared first on Low End Box.