Skip to main content

All Questions

1 vote
1 answer
44 views

find the number of ways to distribute 30 students into 6 classes where there is max 6 students per classroom

here is the full question: Use inclusion/exclusion to find the number of ways of distributing 30 students into six classrooms assuming that each classroom has a maximum capacity of six students. Let $...
sor3n's user avatar
  • 15
2 votes
2 answers
84 views

Analytic solution for number of paths with length $k$ on an $n \times n$ Chessboard allowing Self-Intersecting?

Consider an $n \times n$ chessboard where the journey begins at the bottom-left corner $(1, 1)$ and concludes at the top-right corner $(n, n)$. How many distinct paths are available that necessitate ...
maplemaple's user avatar
  • 1,231
4 votes
1 answer
283 views

Printing neatly

I'm working on the following problem (which is not my actual question) Consider the problem of neatly printing a paragraph with a monospaced font (all characters having the same width). The input ...
C.C.'s user avatar
  • 910
3 votes
0 answers
461 views

Count number of m-subsets with xor = 0 [closed]

Given positive integers $n$ and $m$, count the $m$-subsets $S\subseteq[2^n - 1]$ such that the bitwise XOR of the members of $S$ is $0$, where as usual for any positive integer $k$ we let $[k]=\{1,2,\...
sooobus's user avatar
  • 740
0 votes
2 answers
313 views

Sum of roots of binary search trees of height $\le H$ with $N$ nodes

Consider all Binary Search Trees of height $\le H$ that can be created using the first $N$ natural numbers. Find the sum of the roots of those Binary Search Trees. For example, for $N$ = 3, $H$ = 3: ...
rayu's user avatar
  • 412
1 vote
1 answer
492 views

Select $k$ non overlapping segments from $n$ points

We have $n$ points , say labeled from $1$ to $n$. We have to select $k$ segments from it so that no $2$ overlap. One possible solution would be by using a recurrence relation $f(k,n)=\sum i*f(k-1,n-...
evil999man's user avatar
  • 6,038
1 vote
0 answers
44 views

What does "combining the solutions in O(n) time" mean?

Algorithm $X$ proceeds by recursively solving $5$ subproblems of one-half the size, then combining the solutions in $O(n\log n)$ time. Algorithm $Y$ makes $9$ recursively calls on subproblems ...
Bob Jonas's user avatar
0 votes
1 answer
70 views

How to quickly determine running time of such recurrence relations?

$$T(n)=5T(\frac{n}{2})+n\log n$$ $$T(n)=9T(\frac{n}{3})+n^2$$ $$T(n)=2T(\frac{2n}{3})+n^{1.5}$$ What are the running times of each $T(n)$? Each one looks like the form of the Master Theorem, but only ...
Lisa Ann's user avatar
0 votes
2 answers
1k views

Solve the recurrence $T(n)=3T(n/3)+\log n$, $T(1)=1$

So $T(n)=3T(n/3)+\log n$ and $T(1)=1$. I tried to solve this by expanding it out to see a pattern, but I don't really see the pattern: $T(n/3) = 3T(n/9)+\log (n/3)$ $T(n) = 3[3T(n/9)+\log (n/3)]+\...
Stephanie's user avatar
1 vote
1 answer
2k views

How many binary string are there such that there are no k consecutive characters are the same?

Given number $n$ and $k$. Count the number of string with length $n$ such that there are no $k$ consecutive characters are the same. Example with $n = 3, k = 3$, the answer is $6$. ($110, 001, 101, ...
Xeing's user avatar
  • 2,977
1 vote
1 answer
230 views

Algorithm for retrieving all the permutations (randomized) for a vector sequence 1...N with only unique values

Here is the problem: I have a vector of $N$ elements long (containing only unique values from $1...N$). I am searching for an algorithm to obtain all the (randomized) combinations possible, where ...
WJA's user avatar
  • 149
1 vote
1 answer
208 views

Arrange blocks to form matrix of $N \times 3$

Given are the blocks of 3 different colors (Red,Green and Blue). Red colored block of size $1 \times 3.$ Green colored block of size $1 \times 2.$ Blue colored block of size $1 \times 1.$ We ...
user3923257's user avatar
0 votes
1 answer
398 views

number of ways to fill a 2D grid

We have a 2D grid with n rows and m columns, we can fill it with numbers between 1 and k (both inclusive). Only condition is that for each r such that 1<=r<=k ,no two rows must have exactly the ...
user103260's user avatar
3 votes
1 answer
808 views

number of derangements

In the normal derangement problem we have to count the number of derangement when each counter has just one correct house,what if some counters have shared houses. A derangement of n numbers is a ...
user103260's user avatar
3 votes
2 answers
194 views

Google Question: Number of ways to select sets such that n is pure

Consider a subset $S$ of positive integers. A number in $S$ is considered pure with respect to $S$ if, starting from it, you can continue taking its rank in $S$, and get a number that is also in $S$, ...
user103260's user avatar

15 30 50 per page