## data structures – ICPC Live Archive- Islands

I have been trying to solve this problem Islands, I made with Union Find but the walk-through that I make of all array is too late because for each year I through the array completely, for that is cuadratic. I think the through could be in linear time if I sort the array but after I don’t know how to continue.

I feel stuck.

## data structures – Container with findNthSmallest in O(1)

Consider the following problem: we want to implement ADT SpecialContainer which stores integer numbers and is similar to a PriorityQueue. This containter should support the following operatios:

-init(sc, n) – create a new, empty SpecialContainer sc. n is a positive integer number(will be used later – Theta(1) total complexity

-push(sc, x) – adds the integer number x to the SpecialContainer – O(log n) total complexity

-findNthSmallest(sc) – returns the nth smallest element from sc, where n is the number given to the init function – Theta(1) total complexity

-popNthSmallest(sc) – removes and returns the nth smallest element from sc – O(log n) total complexity

1. Which data structure or combination of data stuctures would you use as representation for the SpecialContainer and how?

2. Explain in short how would you implement each operation of the SpecialContainer and why the implementation fits the complexity requirement.

I was thinking about a combination of a heap and a hash map, but I don’t think if it works. Can somebody help me, please?

## data structures – Algorithm for Estimating Number of Unique Monthly Visitors

Is there a way to estimate the number of unique monthly visitors to a site based on a sample of, say, one week of data? This isn’t as simple as just multiplying the number of unique visitors the first week by 4, due to the hotel problem. If 10 people visit your site the first week and the same people are the only visitors to your site the second, third, and fourth week, the total number of monthly unique visitors to your site is only 10.

I know you can use HLL to estimate the number of unique visitors to a site in O(1) space. I’m wondering if there’s a similar approach to estimate how many unique visitors there will be after a month.

## data structures – Why are these BVH split heuristic formulas different?

I’ve been doing some research into changing the split heuristic I use for a work project comprised of a BVH binary tree.

The heuristic I currently use is centroid median as described here, but I seek to use the surface area heuristic (SAH) now. Several papers denote the cost function for determining the split as:

$$c(A, B) = t_{trav} + p_{A}sum_{i=1}^{N_{A}}t_{isect}(a_{i}) + p_{B}sum_{i=1}^{N_{B}}t_{isect}(b_{i})$$

Notionally it is described in detail here, but to summarize, it is the cost of a ray intersect of primitives at this split.

However, I’ve seen an optimization technique, described as “binning”, where $$K$$ pre-determined bins are computed and therefore the cost function for determining the split is:

$$c(A, B) = A_{a}N_{a} + A_{b}N_{b}$$

This is outlined here in Section 3.1, as well is several other documents (1, 2, 3).

What’s the rational/reasoning behind these two different cost models?

## Why does symmetric starting patterns end up in symmetric ending structures?

Why every symmetric starting structures in the "game of life" end up to be symmetric as well / disappear completely?

For example:

Becomes:

A lot of examples can be made …

## identify this – What are those structures in Sudan?

While flying back from La Réunion to Paris, we flew over those well defined structures:

I think it corresponds to this location the map:

https://goo.gl/maps/Wz1paAFsGGQjULYa7

At 13.991611°N, 35.959694°E.

Do you know what those are? Is this a refugee camp? There are refugee camps a few km away (Shagarab Refugees camp) but they look much less structured.

Reverse image search didn’t bring anything interesting.

## ag.algebraic geometry – Period domain closure and mixed Hodge structures

The moduli space of Hodge structures is the period domain
$$D = coprod_{V,psi} text{Hom}_{mathbf{R}text{ alg.gp.}}(mathbf{C}^*,G_mathbf{R})/G_mathbf{Z}$$
where $$Gsubseteq text{GL}(V)$$ are the linear maps preserving a given (skew)symmetric form $$psi$$ on vector space $$V$$. An alternative definition is that a map
$$X longrightarrow D$$
is the same thing as a variation of Hodge structures on $$X$$.

There are two other similar objects:

1. The compactification $$overline{D}$$ of $$D$$: the period domain is a variety, so this exists by a theorem of Nagata.
2. The moduli space/stack $$D_M$$ of mixed Hodge structures.

Question A: what is the relation between 1 and 2? What are they both for the component $$mathbf{H}^g/text{Sp}(2g,mathbf{Z})$$ of $$D$$?

My guess is that $$overline{D}subseteq D_M$$ because of limiting mixed Hodge stuctures. If they are not the same, then

Question B: what is $$overline{D}_M$$?

## data structures – Bloom filter alternative supporting deletion without false negatives

There are several alternatives to bloom filters that support deletion from the set, for example Cuckoo filters or Counting Bloom filters.

However, deleting an element from these data structures assumes that the element really is in the set. Deleting an element that is actually not in the set might introduce false negatives.

Is there a data structure that avoids this problem, trading it off against something else?

## data structures – Need help on stack related question

Thanks for contributing an answer to Computer Science Stack Exchange!

• Please be sure to answer the question. Provide details and share your research!

But avoid

• Asking for help, clarification, or responding to other answers.
• Making statements based on opinion; back them up with references or personal experience.

Use MathJax to format equations. MathJax reference.

To learn more, see our tips on writing great answers.

## data structures – Going through all the cases in a rule list

So, I want to have explainable equations derived from replacement rules.

I made a Mathematica function that does the following, it takes a list of rules, and it applies them (using ReplaceAll), then it gives a list of the rules being taken step by step.

FormattedRules({r -> 3, z -> 5,
y -> 3, <|"rule" -> x -> Sqrt((z + y)/r), "numeric" -> True|>})
(*
{HoldForm(r == 3), HoldForm(z == 5), HoldForm(y == 3),
HoldForm(x == Sqrt((y + z)/r) == 2*Sqrt(2/3) == 1.632993161855452)}
*)


This works pretty well, however, there might be a rule with multiple cases, say {{z->5},{z->-5}}. This of course, produces a branch, of a tree, since I’m saving all the intermediary steps, that means that all intermediary steps should be saved as well.
So, I want to convert for example the following:

{y->5,{x->y^2,x->y+3},z->2x}


into

{{y->5,x->y^2,z->2x},{y->5,x->y+3,z->2x}}


Or for example a more nested example

{{y->5,y->1},{x->y^2,x->y+3},z->2x}


into

{{{y->5,x->y^2,z->2x},{y->5,x->y+3,z->2x}},{{y->1,x->y^2,z->2x},{y->1,x->y+3,z->2x}}}


In order to do this I thought about using a tree, but I discovered that trees are not implemented in mathematica, natively. So before creating my own custom functions I figured out, maybe someone knows a less error prone way to approach the problem?