# 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.

9,020 questions
Filter by
Sorted by
Tagged with
5 views

### data structure Q with priotry queue which allow us to find the median in $O(1)$ and the data structure need to support the following operations

I've got this question from an exercise and i'm not sure if it is possible to do so Think of new data structure Q with priotry queue which allow us to find the median in $O(1)$ and the data structure ...
12 views

### PRECISE DPLL algorithm definition

I am confused about the precise definition of the DPLL algorithm. Various sources tend to define DPLL differently: In pages 110-114 of the book Handbook of Satisfiability(Editors: Biere, A., Heule, M....
7 views

### Find sets of weighted objects to maximize number of sets with weight >= X

I have N objects, each of which has a weight. I need to form combinations of the objects to maximize how many sets of objects add up to at least x total weight. Combinations can consist of any number ...
23 views

### Minimum cost problem of breaking containers in O(nlogn)

Can anyone kindly give me some hint on solving this? There are $n$ water containers placed on the top of each other ($container_1$ on top of $container_2$, $container_2$ on top of $container_3$, ...), ...
8 views

### How can I shove that L is not regular in the language [duplicate]

How can I show that the language 𝐿 = {𝑎 𝑛, 𝑛 𝑖𝑠 𝑎 𝑝𝑒𝑟𝑓𝑒𝑐𝑡 𝑠𝑞𝑢𝑎𝑟𝑒} is not regular
24 views

31 views

### oone exmple in hash topics?

Example: Suppose $H:${$1,...,n$} $\rightarrow${$1,..,n$} be a uniform hash function. for input $x$, $z$ is equal to number of trailing zero in the right side of $H(x)$. for $0 \leq c \leq 1$ what is ...
60 views

### Two-Sum - Pre-sort Optimization Algorithm Design

🧩 Is it possible to optimize the runtime of a two-sum solution by receiving a pre-sorted input either in ascending or descending order? 🚀 Original Two-Sum Determine whether there are two items whose ...
13 views

...
32 views

### How can I make the variance of a multiple sum of set of fixed number of variables minimum?

Here is the problem: There are $MN$ people, where there are $M>1$ seeds and $N>0$ people are in each seed. We have to make $N$ teams of $M$ people where everyone in the team have different seeds....
24 views

### Finding an algorithm that minimizes vertex weight sum of a subgraph that satisfies several constraints

I have a vertex-weighted undirected graph $(V,E)$ with root vertices $R = {r1, ..., rn}$. I need to find the subset $V'⊂V$ such that $R⊂V'$, $N[V']=V$, $∀v'∈V '[∃r∈R ($path($r', v'$)$)]$ that ...
48 views

### Optimal algorithm to distinguish given black box access

This is a variant of this question. Consider two probability distributions $D$ and $U$, over $n$-bit strings, where $U$ is the uniform distribution. Assume that $D$ and $U$ are far apart in total ...
41 views

### Minimum sum of squared Euclidean distance between two arrays

Question: Given two sorted sequences in increasing order, $X$ and $Y$. $Y$ is of size $k$ and $X$ is of size $m$. I would like to find a subset of $X$, $i.e$, $X'$ of size $k$, and considering the ...
817 views

### Exact definition of average time complexity?

Now I'm from a mathematical background, and I found CS people's definition of average time complexity a bit... confusing, to say the least. Here is a definition that I feel comfortable with: Consider ...
24 views

### Does the existence of a matroid structure imply that the greedy algorithm is optimal?

I was going through the topic of matroid structures for the problems like Activity selection ,minimum spanning tree. I also came to know how to solve if a problem exhibits matroid structure. The ...
66 views

### Right most set bit O(log N)

I tried to do the problem Find first set bit in Geeks for Geeks, and this is the code I used. ...
15 views

### How can I create the table and solve the error, why did the error happened? [closed]

import world_population.csv population = Table.with_columns( "Population", population_amounts, "Year", years ) population No module named 'world_population'
26 views

### What is your approach to writing code? [closed]

I've took on computer science school, now I mainly want to work in IT but I have to go through two years in which I have to study and pass programming. Now first semester, I got a C (because I couldn'...
23 views

### SMO, Random forest and Bayes net algorithms: why does Random forest perform better?

I analyzed a dataset using those 3 different algorithms. As I can see, Random forest performs better in most cases. My dataset is composed of 4000 instances of two classes (class A 2000 elements, ...
15 views

### How to avoid drawing dense maps?

The problem I have in hand is like drawing Google Maps by myself, in particular, roads. When my map scale is huge, I face no problem, but when I zoom out there are too many things to draw -- sure, I ...
11 views

### How to find the “center” of a subset of vertices in a graph? [closed]

Cross-post from StackOverflow. I have an undirected, positive-weighted, connected graph with vertices V and edges E. I also have ...
Consider two probability distributions $D$ and $U$, over $n$-bit strings, where $U$ is the uniform distribution. We are not given an explicit description of $D$: we are only given black-box access, ie,...