Abstract Syntax Tree with parent or not? [closed]
My question is as simple as the title says — should I implement AST with parent or not? Currently I implemented it with parent — the benefit of that approach is, that whatever I use, I can go up or...
View ArticleSum of squares of distances on a weighted graph O(n)
Given a weighted tree with n nodes. We have to find for each node sum of squares of distances towards every other node. Complexity should be O(n). I am looking for an algorithm to solve the problem. No...
View ArticleMinimal spanning trees in multigraphs with constraints
I have a multigraph G whose edges have three identities. Let’s say I have three colors of the edges red, blue and green and each two nodes may be connected by a red, blue and/or green edges. The graph...
View ArticleBST to AVL in O(n)
I found in different places on the internet how to turn a Binary Search Tree into an AVL tree in O(nlog(n)). I was wondering how can this be done in O(n) (as the worst case limit). It kinda seems...
View ArticleHow do I typeset this parsing tree for propositional logic formula with...
The following parsing tree is from Mathematical Logic published in 2007 and written by Ian Chiswell & Wilfrid Hodges. It looks like a forest tree, but I guess it could be typeset better by another...
View ArticleSuggestions for structuring complex json structures?
I can’t find many tips for how to design complex json structures beyond the obvious tips of not trying to nest too deeply, using defined data types, etc. For example, if I have a location that needs to...
View ArticleIs this Red-Black tree insertion pseudocode from Introduction to Algorithms...
For the Red-black tree insertion fixup the book distinguishes between 6 cases, 3 of which are symmetric. The cases are (z is the node being inserted): Case 1: z’s uncle is red Case 2: z’s uncle is...
View ArticleFundamental group of the sphere via triangulation
I know that the fundamental group of the sphere is zero, i.e. $pi(S^2)=0$ I want to show this by triangulation, i.e: Triangulate the sphere Draw maximal tree Draw maximal contractable subspace Consider...
View ArticleWeedy uneven lawn with tree stumps: grind, chip, till, roll and reseed?
My sister just bought a place and she’s asking for help getting her lawn back in order. I’m not sure the way we’ve come up with is the best way. Here’s my plan of attack. I would appreciate a sanity...
View ArticleProoftrees logic tree preamble for an example
The following example is out of the documentation of prooftrees (I suppose that an updated version of TeX Live is needed to make use of that package). The problem is that the documentation’s .tex file...
View Article