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 algorithm design.

learn more… | top users | synonyms (2)

0
votes
0answers
19 views

Make the paths and possible solution for puzzle game like mahjong

I want to ask if there are easier step by step to make the path and possible solution for a game like this I've already search pathfinding algorithm like A* and Djikstra. I have read the article. ...
-4
votes
0answers
11 views

program algorithm: Assign orders to vendors to match target distribution [on hold]

I have a target order distribution %age for 5 vendors (based on vendor's previous performance) and a list of new orders to place. I am looking for an algorithm to place these orders to vendors so ...
0
votes
1answer
20 views

Determine the div that contains the product price on different product pages [on hold]

I'm looking for a general method of defining the product price containing div when only the HTML and CSS source code is provided. On Amazon for example, the product price is always contained in a div ...
-3
votes
1answer
30 views

Ways to compare keys from json dump with python

I am newbie to programming ,need some inputs/direction to build a smart code. I have 10 ec2 instances, each instance have a Tag which contains a dictionary of 3 key/val pairs. Some instances have ...
-2
votes
0answers
19 views

what client-sever architecture and tools I can use to implement this? [on hold]

I have large point data set collected by volunteers/cloud and want to visualize on web mash-up/web mapping. is client side clustering applicable to this problem? or -can apply the Google maps ...
0
votes
1answer
25 views

Travelling Salesman: Using Matrix Routing API (HERE Maps)

My company recently purchased an Enterprise Licence for the HERE Platform. In the application I'm working on, I need to solve the Travelling Salesman Problem, which means that given a starting point, ...
0
votes
0answers
16 views

How can I use the GJK (Gilbert–Johnson–Keerthi) algorithm to determine if one object is inside another? [on hold]

How can I use the GJK algorithm to check if an object is completely inside another one?
1
vote
3answers
42 views

Determine whether the direction of a line segment is clockwise or anti clockwise

I have a list of 2D points (x1,y1),(x2,y2)......(Xn,Yn) representing a curved segment, is there any formula to determine whether the direction of drawing that segment is clockwise or anti clockwise ? ...
-2
votes
2answers
40 views

In a BST, find count of nodes smaller/greater than a given node in O(log N)?

Given a BST (Binary Search Tree), how to count number of nodes smaller/larger than a given node in O(log N). Assume you can modify the Node to add more variables into it, and while you are building ...
1
vote
0answers
32 views

Enumerate All Cycles Passing Through Vertices at Most k times

I have to write an algorithm to produce all cycles in an undirected graph passing through vertices at most k times. I have a Python implementation of such an algorithm for the case k=1 using a ...
1
vote
3answers
39 views

Python: Determine whether each step in path across n arrays falls below threshold value

Given n arrays of integers, is there a good algorithm with which to determine whether there is a path across those arrays such that the minimum (Euclidean) distance of each "step" along that path ...
0
votes
0answers
20 views

Edge cases for doing ctrl / shift selection

I'm currently trying to create shift / ctrl selection in a list for a web application (you can see a demo here). What I currently have is basic item selection for ctrl/shift with some very naïve ...
1
vote
1answer
77 views

Is the fastest algorithm for collision of 2D dynamic objects O(n^2)? [duplicate]

Let there be o objects, and p projectiles. When testing for collision between any projectile and any object, is the fastest algorithm going to be order of n-squared? Here's my pseudocode: (I'm ...
-2
votes
0answers
17 views

android matrix 2D - bfs algorithm error if there are too many nodes [on hold]

Question: I want to know whether 2 nodes are connected in 2D matrix.. so I use bfs algorithm to handle this. The matrix has size 11x9, which is if all nodes are 0 then I add all possible nodes ...
2
votes
1answer
47 views

Searching in large memory mapped files

I have a large data structure stored in memory mapped file. Data structure is very simple: struct Header { ...some metadata... uint32_t index_size; uint64_t index[] }; This header is ...
2
votes
1answer
31 views

How could d-heap perform insert and delete in O(log n)?

I'm studing priority queue and d-heap to implement this data structure. I've found this data type definition: class DHeap implements PriorityQueue: data: a d-heap T containing n nodes; each ...
-3
votes
0answers
29 views

How to best determine heuristic function

if two poeple from different cities are to meet at the closest city they might both get to same time. using straight line distance sdl(i,j) how can you determine hueristics. i have gone all over the ...
-7
votes
0answers
38 views

sorting discrete data using Genetic Algorithm (GA) or Artificial Neural Networks (ANN) [on hold]

What will be appropriate technique to sort 2 billion records of sales data. How Genetic Algorithm (GA) or Artificial Neural Networks (ANN) can I use to sort discrete data?
0
votes
1answer
61 views

right way to get the correct element from array

I have the following two arrays: var nodes = new Array(); var arr = [{ name:"abc1", type:"blue" }, { name:"abc2", type:"red" }, { name:"abc3", ...
1
vote
1answer
31 views

Counting top repeated lines in log

Reading the title will lead you to think, I saw this question a hundred times, and you did, but I'm looking for something different: The common answer is sort <input> | uniq -c | sort -nr ...
1
vote
2answers
78 views

signed and unsigned arithmetic implementation on x86

C language has signed and unsigned types like char and int. I am not sure, how it is implemented on assembly level, for example it seems to me that multiplication of signed and unsigned would bring ...
0
votes
1answer
44 views

Why is it called topological sort?

From where does it derive its meaning: 1) Topography, as in region, geography etc. OR 2) From one of its mathematical meanings: the set of all open subsets of a topological ...
-2
votes
0answers
24 views

Algorithm efficiency and Turing machine [on hold]

Why an evaluation of Turing machine efficiency is equal to the algorithm which is implemented by this machine and vise versa? For example, we can say that efficiency of merge sorting algorithm is ...
1
vote
2answers
45 views

Python Weird Return Issue

I'm trying to implement a function that takes two root nodes (Binary Tree) and traverses and checks if they're identical. Here is how I got so far; def inorder(p, q): if p and q: ...
-1
votes
0answers
39 views

Simple encryption/decrytpion (integer to string) with constant length

I want to encrypt (hide in simple way) integers on my website, but it doesn't have to be a strong encryption. It should contain: constant length of output public-key (for encrypt and decrypt) ...
0
votes
1answer
31 views

Detect bad acceleration deceleration of car: Aggressive Driving Behavior [on hold]

I am working on aggressive driving behavior android application. This will be implemented via supervised learning, wrong actions will be recognized and added while driving the car. To check aggressive ...
0
votes
0answers
44 views

Which algorithm should I use to classify these two image? [on hold]

Hi I'm trying to use Opencv to detect defects on power cables. White lines are the laser on it.My question is which algorithm I should use to detect these defects, as shown in the second picture. I ...
0
votes
1answer
33 views

splitting trapezoid in given proportion

I need to split trapezoid in 2 part of given size with line, parallel basement. I need to get new h1 of new trapezoid. For example I have trapezoid of area S and I want to split it in 2 trapezoids of ...
2
votes
1answer
36 views

Error correction with small data

I'm reading some noisy images, and getting a few bits from it (21 bits). I only need to use 15 of them, leaving me 21 - 15 = 6 bits to work with. What I intend to do, is use it for both Checksum and ...
2
votes
1answer
97 views

Efficient way of finding the number of equivalence classes in C++

Suppose we're given an array of integers. A[n], for instance A[11]={10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20} and a list of prime numbers, B[k], for instance B[2]={3, 5} For each element, ...
0
votes
0answers
43 views

OpenCV image inpainting

I want to write a function to implement inpainting by myself. I know that there is already an implementation for inpainting in the OpenCV library. The relevant article is the following: ...
1
vote
5answers
71 views

Generate random integers from random bit sequence

Very basic question but I can't seem to find the answer on Google. A standard PRNG will generate a sequence of random bits. How would I use this to produce a sequence of random integers with a uniform ...
1
vote
2answers
31 views

Overlaying a superset array onto a subset array where order/sequence matters (in Javascript)

I have a set of arrays of the form A= [1,2,3,4,5,6] B= [7,8,9] C= [5,6] D= [9] I want to "overlay" the right-sided (suffix) supersets (strictly speaking, super-sequences) on the subsets ...
2
votes
2answers
43 views

What's time complexity of this Algorithm for breaking words? (Dynamic Programming)

Word Break(with Dynamic Programming: Top->Down) Given a string s and a dictionary of words dict, add spaces in s to construct a sentence where each word is a valid dictionary word. Return ...
-5
votes
0answers
17 views

prove that scheduling with release time and deadline is np-complete [on hold]

suppose we are given a set of jobs that must be run on a single machine. each job i has a release time ri when it is first available for processing;a deadline di by which it must be completed; and a ...
2
votes
1answer
76 views

how to find weather a graph is tree or not?

i am trying to solve a SPOJ problem is it a tree ? in which i have to check weather a graph is tree or not?? in this problem i am using DFS to detect weather the graph has cycle or not.. my code is.. ...
-2
votes
0answers
16 views

Software to display angorythms [on hold]

Please help me to move this topic to the appropriate site in case if it is needed. I'm looking for a software or online service that helps me to draw something similar to what is displayed on the ...
0
votes
0answers
53 views

Parsing Hierarchy defined by codes

I'm working on parsing a plain text file with a sort of hierarchical structure. I know that some sort of recursive descendant algorithm should be able to help with this. But I have no experience on ...
1
vote
3answers
64 views

Efficiency of Breadth First Search

What would be the most efficient way to compute the fewest hops it takes to get from x1, y1 to x2, y2 on an unbounded/infinite chess board? Assume that from x1, y1 we can always generate a set of ...
1
vote
1answer
57 views

How to find the optimal grid placement for least distance between nodes of a network?

If I wanted to display the nodes of a network on a 2D grid, but also I wanted to ensure the least amount of manhattan distance between any two directly connected nodes (where there is a maximum of one ...
-1
votes
3answers
71 views

Efficient string concatenation algorithm

This is a follow up question to : Concatenation by += slower than that by using StringBuilder() where I found out that string1+=string2 is much slower than string1.append(string2) where string1 is now ...
8
votes
2answers
197 views

Why is Java List traversal slower than file readline?

I had this piece of code: while((line=br.readLine())!=null) { String Words[]= line.split(" "); outputLine = SomeAlgorithm(Words); output.write(outputLine); ...
1
vote
1answer
36 views

How to implement Efficient Test for a Point to Be in a Convex Polygon algorithm in C#?

Simple problem - find if a point is inside a convex Polygon. There is algorithm described yet due to be beeng an in Wolfram language and I ve got something wrong. This is what I have: private static ...
1
vote
1answer
31 views

which is the cost of the average case?

According to my notes,we find the cost of the average case of the quicksort,like that: We suppose that we are lucky-unlucky alternately. L: lucky U:Unlucky Then,these two relations: ...
-1
votes
0answers
34 views

Programmatically determine the associativity of an L1 cache

I searched for similar questions; one was similar but there wasn't a definitive answer. I can write a C program to determine both the line length and size of a cache but I can't think of a way to ...
3
votes
1answer
42 views

Shortest path between two vertices when exactly one edge weight can be reduced by 50%?

This is an interview question I came across: You are given a the map of airplanes between the cities in a country, basically a directed graph was given with weights as the cost of planes between the ...
1
vote
1answer
29 views

Using BFS for topological sort

Can Breadth first Search be used for finding topological sorting of vertices and strongly connected components in a graph? If yes how to do that? and If not why not? we generally use Depth first ...
0
votes
0answers
18 views

algorithm for catching trends and notify [on hold]

I am trying to create a system that will track our company sales, and it will see the hourly/daily/weekly trends, and if the current check is below or above the trends it could know something is ...
0
votes
0answers
18 views

Optimal Lat/Lon API call Algorithm with Radius as Parameter

Following Question: There is an API, which gives information within a radius r around a lat/lon coordinate. Because coordinates are rectangular and a circle around a point isn't, there is an optimal ...
0
votes
1answer
41 views

“Rotating” a ArrayList<Integer>

I have an ArrayList in the board game-like game I am developing in Java, I format this ArrayList as a square, as so (numbers being indexs); /* * |0 |1 |2 |3 | * |4 |5 |6 |7 | * |8 |9 |10|11| * ...