Questions tagged [data-structure]

For questions about mathematical background of data structures, including analysis and proofs and for questions based on some data structure properties. Data structures aim to allow efficient processing of particular queries on the data they contain.

147 questions
4
votes
0 answers

Understanding nearest neighbors in high-dimensional data

Let's have a random sample of points in an euclidean $n$-space: assume a iid sample from a standard normal distribution. To each point $p$, I assign the number $N(p)$ defined as "how many times does $p$ occur in $10$ nearest neighbors of some other…
4
votes
1 answer

How to prove that total number of non-isomorphic labelled trees of order $n$ is $n^{n-2}$?

I predicted the formula by finding total number of non-isomorphic labelled trees of order 1 is 1 , order 2 is 1,order 3 is 3,order 4 is 16,order 5 is 125.But how do i prove it ? I am beginner in graph theory so i will be very thankful if i get some…
user614557
3
votes
0 answers

What are the possible levels of the $k$th largest element in a max-heap of $n$ distinct elements? [CLRS]

I'm interested in solving Exercise 6.1-5 from the fourth edition of CLRS: At which levels in a max-heap might the $k$th largest element reside for $2 \leq k \leq \lfloor n/2 \rfloor$, assuming that all elements are distinct? My Attempt: I tried…
user1337
  • 24,859
3
votes
0 answers

K-Medoid Clustering

The question I am trying to answer is: (k-medoids clustering) What are the resulting clusters when the k-medoids algorithm is used with $k = 2$ and initial random medoids $\{(1, 2), (2, 1)\}$ on the above dataset $S$? The dataset $S$: \begin{array}…
3
votes
0 answers

Computing the false positives for repeated Bloom filter queries

Suppose I have two sets, $A$ and $B$. I wish to compute the containment of $A$ in $B$ by checking what proportion of $A$'s elements are in $B$ (i.e $\epsilon = {|A \cap B| \over |B|}$). I do this by inserting the elements of $B$ into a Bloom filter…
Dianne
  • 51
3
votes
0 answers

$n! \leq O(n^{n/2})$?

I was deliberately trying to solve this problem for the last 2 hours. I tried solving it using substitution, different notations, etc. but that did not lead me to an answer. Could someone please help me? Thanks in advance!
3
votes
0 answers

How to a use the kernel trick on a XOR dataset to transform the dataset into a linearly separable dataset?

Let's say that I have the following data: I want to find a transformation of this dataset that will make it linearly separable. My thought was to bring the data around the origin and then multiply $X_1$ by $X_2$ to get the blue data on one side and…
3
votes
0 answers

What is the Eilenberg-Moore Category of the List monad on Set?

The List Monad is defined as a triple $< L , \mu, \eta >$. $L: Set \rightarrow Set$ $L$ takes a set to the set of all lists on that set. $\mu : L \cdot L \rightarrow L$ $\mu$ takes a list of lists to a list by just concatenating all the internal…
Ben Sprott
  • 1,359
3
votes
1 answer

How do you find the number of contiguous subarrays of size $k$ in a given array?

For example: Given the array $[1,2,3,4,5,6,7,8,9]$ where $N$ is the length of the array and $k$ is the subarray size. Here $N = 9$ and given $k = 5$, we find that $N-k+1$ contiguous subarrays of size $k$ can be found. How can we prove $N-k+1$ as the…
3
votes
1 answer

How to represent subset using 5-bit binary code?

For the set $V=\{a, e, i, o, u\}$, give the $5$-bit binary string that codes each of the following subsets: $\{a, i,o\}; \{e\}; V; \emptyset$; Which subset is represented by the $5$-bit string $10001$? Can I know how do you get the 5-bit binary…
3
votes
1 answer

Finding number of pairs of vertices in a graph such that the path between them has only one vertex common with a different given path

Given a tree with N vertices and N-1 undirected edges. 1<=N<=250000 There are certain queries to be performed. 1<=Q<=10^5 In each query we will be given two vertices,say a and b. We have to tell the number of pairs of vertices such that the path…
Learner
  • 31
3
votes
1 answer

Sort an array given the number of inversions

Given an array $A$ with $n$ integers in it, one way of measuring the distance of the array from a sorted array is by counting inversions. A pair of indices $i,j ∈ {0,...,n−1}$ is called an inversion if $i < j$ and $A[i] > A[j]$. If the number of…
3
votes
0 answers

How to interpret the zipper of a set?

A set with elements of type $a$ typically is represented in type theory by $Set \ a: a \to bool$ or, as an algebraic expression $Set \ a: 2^a$. The idea is that, for each element of the type $a$, you ask whether it is a member of your set. $2^a$…
kram1032
  • 1,153
2
votes
2 answers

Menu items that change size according to hits

This might at first seem as a computer science question, but it is actually a mathematical question, since I am searching for a (particular?) function. Let me phrase the problem I am trying to solve: Suppose, as the title suggests, that we have a…
Jason
  • 662
2
votes
1 answer

How to represent and compare 'subsets of a group with modulo'?

For a group $G$ with operation $+$, I'm interested in the set $\mathscr H$ of its subsets that can be constructed using only the following two rules: $\{g\}$ (so a singleton set) is in $\mathscr H$ for $g \in G$; for any $H \in \mathscr H$ and any…
1
2 3
9 10