Блог пользователя TheCreator

Автор TheCreator, история, 11 дней назад, По-английски

Given an undirected connected graph with N vertices and M edges, and a set S of K nodes of this graph.

Find the maximum number of edges that we can remove from the graph such that all these K nodes still remains connected (i.e there exist one component which has all these K nodes )

eg -: edges -:[[1 2], [1 3],[2 4],[3 4]] S = [1, 2, 4]

We can remove maximum of 3 edges [1, 3] and [3, 4] and [1, 4], removing any other edges makes given set of nodes disconnected.

How to solve this ?

I can only think of trying all 2^m subset of edges.

Полный текст и комментарии »

  • Проголосовать: нравится
  • 0
  • Проголосовать: не нравится

Автор TheCreator, история, 4 недели назад, По-английски

Given a connected undirected graph consisting of N N nodes, determine how many connected components the graph will break into if each node is removed.

For example, consider a graph with the following undirected edges:

1-2, 1-3, 1-4, 4-5, 5-6, 4-6.

If we remove node 1, there will be 3 connected components. If we remove node 2, there will be 1 connected component. If we remove node 3, there will be 1 connected component. If we remove node 4, there will be 2 connected components. If we remove node 5, there will be 1 connected component. If we remove node 6, there will be 1 connected component.

Полный текст и комментарии »

  • Проголосовать: нравится
  • +3
  • Проголосовать: не нравится

Автор TheCreator, история, 5 лет назад, По-английски

Given two integer array of size $$$n$$$, $$$m$$$, you need to merge these two arrays into one such that order of element in each array doesn't change and size of their Longest Increasing Subsequence become maximum.

we need to find maximum possible length of longest increasing subsequence. Assume $$$n, m < 100$$$.

Полный текст и комментарии »

Теги #dp
  • Проголосовать: нравится
  • +8
  • Проголосовать: не нравится