Questions tagged [algorithms]

An algorithm is a sequence of well-defined steps that defines an abstract solution to a problem. Use this tag when your issue is related to design and analysis of algorithms.

10,229 questions
Filter by
Sorted by
Tagged with
9 views

Finding a greedy algorithm to maximize the total energy subject to constraints

This problem is based off of the following problem on stack overflow: https://stackoverflow.com/questions/64797299/greedy-algorithm-to-maximize-score. The second answer is incorrect because the ...
15 views

Solve the recurrence equation $T\left(n\right)\:=\:n\:+\:\sum _{i=1}^{n-1}\left(T\left(i\right)\right)$

I am trying to find the runtime of: $T\left(n\right)\:=\:n\:+\:\sum _{i=1}^{n-1}\left(T\left(i\right)\right)$ $T(1)= 1$ What is the way to solve this kind of problems?
72 views

Find all n bit numbers with k ones and unique under circular shift

I am trying to traverse through all uint64_t with k 1s. Then I find that if x and y are circular shifts of each other, they will output the same result. So I'm trying to optimize my code. The problem ...
32 views

Find a maximum matching in linear time - How to prove it?

Let B be an undirected tree with |V| nodes given as adjacency list. I want to develop a greedy algorithm using pseudo code to find a maximal matching in runtime O(|V|). I understand that the solution ...
13 views

Algorithm to compare two live changing sets

I have two databases that are updated from asynchronous events, those updates should perform the same changes on both. both database have different structures a common id exists between "...
22 views

How to detect if a CFG can cause the parser ends up looping forever?

For example, the following grammar will never stop deriving a complete sentence: S -> A b A -> a A Some other CFGs can derive a complete sentence, but it ...
12 views

Optimal text/code formatting with alignment constraints

Formatting code or things like TeX have some interesting problems. For instance in auto-formatting code you want to use up as much line space as possible but not go over a certain limit if possible. ...
20 views

Finding all integer solutions of an equality

I want to generate all solutions of $x_1+x_2+\ldots+x_{100}=6$ where $x_i$s are non-negative integers. Finding the number of such solutions is not difficult. But is there any easy way to get all ...
25 views

Dynamic programming: weighted interval scheduling with two types of intervals

I am trying to come up with a dynamic programming approach to solve the following problem, but I am stuck as to how to go about an additional added constraint. Input: a set of intervals on a number ...
21 views

an introduction to bioinformatics algorithms solution manual pdf [closed]

I'm looking for exercise solutions for "An Introduction to Bioinformatics Algorithms" book. Can anyone help me and send it to me if they have it? The above book is written by the following ...
30 views

greedy algorithm proof involving maximizing total energy subject to constraints [closed]

This problem is based off of the following problem on stack overflow: https://stackoverflow.com/questions/64797299/greedy-algorithm-to-maximize-score. The second answer is incorrect because the ...
21 views

Why is the input of the algorithm in "Linear-Time Self Attention with Codeword Histogram for Efficient Recommendation" a matrix?

My question is about the algorithm in the article Linear-Time Self Attention with Codeword Histogram for Efficient Recommendation, as described in the picture below. It is written at beginning ...
15 views

I have a practice problem I have been working through in an effort to understand processor time calculation and CPI calculation. The problem is given as such: Two machines are given: In machine A the ...