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

8,900 questions
Filter by
Sorted by
Tagged with
17 views

### Multi-Interval Discretization of Continuous-Valued Attributes for Classification Learning

I'm trying to figure out Fayyad and Irani (1993) MDLP discretization of continuous variables (here is link to the original paper). I understand how algorithm works, but I have some doubts about first ...
100 views

### minimum travel from point to point with incremental steps

It's my first time to make a question here. I have a curious problem about algorithm, in the center of Cartesian plane (0,0) I need to go to another point (x,y) -x and y are belong to Z numbers - but ...
23 views

### Recording a histogram in a tree exhibits strange best case

The task is to record a histogram from a streaming data source. One data point is, say, a 16 bit integer. The maximum multiple of one data point before the stream ends, is < 2^32. The main ...
51 views

### Cotree Generation

Given a co-graph like the one attached as an input what are the steps that I have to follow in order to generate its co-tree? Is there a step-by-step algorithm to do that?
140 views

### Find the length of the longest subarray having sum greater than k

I tried to solve this problem but could not do it better than $O(n^2)$. My Algorithm: ...
45 views

### CSES Range Query Question: Index Compression and Updates [closed]

I'm trying to solve this problem: https://cses.fi/problemset/task/1144/ Given an array of up to 200000 elements, my task is to process up to ...
19 views

### Algorithm to count number of overlapping rectangles of the same colour?

Say you have a grid of pixels. And there are 20 overlapping red rectangles on a blue background. I want to find an algorithm to count the minimum number of rectangles that are needed to form the image....
14 views

### Algorithm for drawing the horizon given the current coordinates, elevation and field of view

I have a large database containing coordinates along with an elevation number. If I am a person looking in some direction (0-360) with an n degree field of view, and located at some coordinate and at ...
36 views

### How to know if time complexity is O(n+m) or O(n*m)

I'm having difficulty understanding when can we know if the time complexity of an algorithm is n+m or n*m Is the time complexity of the following algo O(n+m) or O(n*m) Can you please point me to a ...
62 views

### Remove vertices until no edges are left

Given an undirected graph G(V,E), find the minimum number of vertices to remove so that the Edge Set of the graph becomes empty. In other words: If we remove one vertex we remove that vertex along ...
21 views

### Extending a solution in backtracking

Steven Skiena's "Algorithm Design Manual" has the following code for the backtracking algorithm: ...
47 views

### Potential Example of an algorithm failure

I was looking an algorithm to solve a problem of finding whether and array contains a quadruple with sum = k,(k is input) mentioned at GeeksforGeeks. In one solution the approach mentioned is below,...
22 views

### Range Query Question: Removing Items from a List

My task is to input a given list of size N, then process N queries that remove an item from the list and then print it to the ...
40 views

### Universal Turing Machine algorithm

First, I learned this based on these facts: Turing machine (TM) will be define with 7-tuple Notation, $M=\langle Q,G,b,S,d,q_0,F\rangle$. Any computation rules that can use to simulate any possible ...
44 views

### Algorithm for summation with lowest maximum temporary sum

I've got this problem on my last exam, which I struggle to deal with. Let's say we have array of $N$ integers (it can be float too, but let's say integers for sake of simplicity. We need to sum those ...
65 views

### Minimum number of nodes to select such that every node is at most k nodes away

I received this problem on an exam a few months ago, and have kept thinking about how to solve it with no luck. Given a binary tree where each node in the tree can either be selected or unselected, ...
42 views

### Schedule Optimization With Priority and Weighted Costs

I need an algorithm to determine the best itinerary for a series of events. Each event has a time, location, and reward. Arriving at an event in time yields the reward; too late means no reward. Each ...
29 views

### How do we sort the chunk in the first pass of external merge sort?

Referring to the 9th page of a slide, when we use multi-pass multi-way external merge sort on a file with $N$ pages using $B$ buffer pages, in "pass 0" we'll read a chunk of $B$ pages into ...
32 views

### Approximation factor preserving reduction

The definition of approximation factor preserving reduction from the book by Vijay V. Vazirani, page 365: Let $\Pi_1$ and $\Pi_2$ be two minimization problems, an approximation factor preserving ...
22 views

### What is the most efficient way to turn a list of directory path strings into a tree?

I'm trying to find out the most efficient way of turning a list of path strings into a hierarchical list of hash maps tree using these rules: Node labels are delimited/split by '/' Hash maps have the ...
30 views

### Median of distribution with memory constraint

Task I want to approximate the median of a given distribution $D$ that I can sample from. A simple algorithm for this, using $n$ samples, is: ...
48 views

### Dynamic Programming - Tiling Question

I came across the following question while practising for my final algorithms exam, but I am unsure how to get a linear time complexity for this problem. I assumed it would require checking which ...
72 views