Tagged Questions

In mathematics and computer science, an algorithm is an effective method expressed as a finite list of well-defined instructions for calculating a function. Algorithms are used for calculation, data processing, and automated reasoning.

237 views

Matrices calculations on partial shape matching

I'm working in a shape recognition project where it is supposed for me to develop an application that receives two images: an original one and a sketch made by a user. I am supposed to detect contours ...
96 views

Does multiple Bloom filters make sense?

In order to decrease the number of false positives, I came up with a couple of possible solutions. Create two different types of Bloom filters; eg. filter1 using 3 different hash algorithms, filter2 ...
122 views

Similar problem to word break

I have a list of strings say L and an array of words say A. I want to find a string from the list L that is a best match to a string created from the permutations of the words in the array. The ...
91 views

How to improve A* Algorithm where each child node costs marginally different

I have an A* algorithm with a heuristic to best guide the best path. The problem is that each node can have up to 240 children and each subsequent child also... So doing a breadth first approach is ...
127 views

What Algorithm can be use for task allocation based on location?

What algorithm can be use for task scheduling based on location? For example there are 100 students and 5 lecturers available. Each lecturer must get same amount of student using location allocation ...
395 views

Approach for packing 2D shapes while minimizing total enclosing area

Not sure on my tags for this question, but in short .... I need to solve a problem of packing industrial parts into crates while minimizing total containing area. These parts are motors, or pumps, ...
58 views

Stable, Hash Based Symmetrical Difference

A lot of thought went into the implementation of the set algorithms in LINQ: Distinct, Except, Intersect and Union. They guarantee that the items are returned in the same order that they appear in ...
834 views

Multidimensional multiple-choice knapsack problem: find a feasible solution

My assignment is to use local search heuristics to solve the Multidimensional multiple-choice knapsack problem, but to do so I first need to find a feasible solution to start with. Here is an example ...
72 views

Algorithm to Select Sequential Subarrays from an Array

I solved my problem by using simple nested loops and comparisons but I'm wondering if there is a well known Selection Algorithm to solve my problem. Let's say I have an array such as [1, 10, 250, 9, ...
133 views

Algorithm / working approach to get a random list of data

I am working on a android schedule app but that isn't matter , the problem is a algorithm / methodology so you are welcome to just write the pusedo code to answer. The data is like this Place =====...
32 views

Calculating combinations from categories

I'm trying to calculate every possible selection from different categories. 1 choice must be made from every category and the categories are always in the same order. I save a string where each ...
158 views

Difficulty implementing algorithms from abstract understanding [closed]

I've got decent programming experience for an undergraduate. I just started the study of algorithms. I read the description and saw visual examples that make perfect sense in my head. But when it ...
100 views

How to limit time period to another period?

For a project planning I have an initial period, lets call it PPStart-PPEnd. The planning is associated with a project. This also has a period PrjStart-PrjEnd. PrjStart and PrjEnd are fixed, and can ...
264 views

R* Tree work with dynamic data

I'm searching an algorithm to store my data (which are moving objects' coordinates) and allow me to query objects within a specific radius of a specific point. I came up with R* Tree which is said as ...
45 views

Designing online exam [duplicate]

I need to design an online exam server for an exam like GRE in which question difficulty increases if you answer correctly and decreases if you answer wrong. Questions are multiple choice ...
153 views

How to algorithmically add notes to an existing midi file relative to positions of existing notes in python

I have a midi file that I'd like to algorithmically add notes to relative to other notes that already exist in the midi file using python, or if it's easier using a different language I'm open to that ...
105 views

Optimal group room division algorithm with weights

I hope someone can help me with this, as I'm thoroughly stuck. I'm working with a group at my university, on a first semester research report that should end up as a finished program, solving the ...
121 views

Permission Management Algorithm

I have 3 levels of permission to see the product: Brand -> Allow/Deny Category -> Allow/Deny Product -> Allow/Deny For example, product A has: Category: Allow Product: Deny => product A cannot ...
197 views

Should an algorithm handle invalid inputs and can it have hard-coded paths for certain input data? [duplicate]

I have certain preconditions on input data and I need to design an algorithm for that data. Should I also handle invalid preconditions? Also is it normal that my algorithm will work only for a ...
265 views

How important is maths depending on what your coding? [duplicate]

Possible Duplicate: What does mathematics have to do with programming? How often do you have to solve pure mathematical or algorithmical problems? I heard that math can be very important in ...
268 views

Find 'Connected Components' in undirected, unweighted graph coded as a 2d array

Given an undirected, unweighted graph coded as a 2d array, how can I find the number of different connected components? Example There is the following 2d array (I'm not putting any brackets to ...
273 views

What is a lattice parser?

My friend asked me for help with his task: "Redeem a lattice parser with any programming language" - the problem is that he can't clearly explain me how the lattice parser should work. I've tried to ...
112 views

How to compute data for charting?

I'm building a charting component that displays data directly from the raw data records. It should be able to filter data (subset) and then perform some rudimentry maths on the data (sum, avg, etc). ...
1k views

Exercise 3.6: Skiena Algorithm Design Manual

I am preparing for interview and try to solve the exercise problems of the book. 3-6. [5] Describe how to modify any balanced tree data structure such that search, insert, delete, minimum, and ...
439 views

What is O(m+n) and O(m*n) in Big O notation? [duplicate]

I understand that O(n) describes an algorithm whose performance will grow linearly and in direct proportion to the size of the input data set. An example of this is a for loop: for n in 0.100 puts ...
2k views

Reverse subarray of an array with O(1)

I have an idea how to implement sub array reverse with O(1), not including precalculation such as reading the input. I will have many reverse operations, and I can't use the trivial solution of O(N). ...
1k views

Given known inputs and outputs, can we generate candidate functions that will map the inputs to outputs? [closed]

I've run into a problem where I have a set of inputs, as well as a couple known input-output pairs. I am interested in the output, but in order to get that, I need to figure out how the input is used ...
3k views

What is the simplest and universal algorithm for parsing C++ code? [closed]

I need to do some project specific automatic checking of source codes written in C++ Limitations: Algorithm and its implementation should be simple, easily maintainable, extendable and ...
207 views

Gödel's Incompleteness Theorem and Algorithms [closed]

According to Gödel's incompleteness theorem, not every problem can be solved using algorithms. How do we know if a problem can be solved using algorithm? How do we know that NP problems are ...
137 views

How to smooth out a diagram? [closed]

we have a data set that creates a graph, it works but the graph has many up and downs and looks really bad, what I like to know if there is a known technique or algorithm or even an API that can ...
373 views

Finding all subsets of a set running time

Given a set {1,2,3} output { {}, {1}, {2}, {3}, {1,2}, {1,3}, {2,3}, {1,2,3} } I have only been able to find as fast as O(2^n), is there any techniques for achieving faster results (besides ...
157 views

What algorithm would have the fastest average run time and least memory requirements for sorting a deck of playing cards?

Considering a deck of N playing cards with X different rankings and Y different suits (i.e. there are Y cards with X ranking, thus N=X*Y). What is the fastest algorithm to sort them assuming that X, Y,...
124 views

Merging Sorted Lists (with no comparison function)

I have a few lists of items (which will likely but not necessarily have common elements). The lists are known to be sorted, but don't have a comparison function (they were manually put into the system ...
652 views

Generate unique integer from two integers with algorithm

I am currently trying to come up with an algoritm which would take at least two numbers (say user IDs) and then come up with an unique number which is generated based on these two numbers. Each ...
944 views

Common and frequently used algorithms of Data structures? [closed]

I have been programming for a while, and the edge that I am missing over other programming is algorithms. I know what is linked-list and binary tree, but I dont know many more of them. I failed on 2 ...
111 views

creating a social trend algorithm [closed]

I want to try to create an algorithm that would rank links according to social trends. I've article links, I've their date of publishing. I also have data from Facebook: comments, shares, likes. My ...
117 views

Drawing the Line between Coding Style and Algorithm [closed]

Formatting with Indentations, White spaces, and New Lines obviously fit into the coding style category. if (a == b) { foo(); } // vs if (a == b) { foo(); } On the other hand, something ...
138 views

Looking to calculate break even price (minus fees) on an individual level without brute forcing

I am trying to calculate the break-even price on an individual product given a percent of the price I sold it for and the price I bought it for. For example: I buy an item for \$200 and the fees on the ...
1k views

Accuracy in calculating distance from Android Device using double integral? [closed]

Using TYPE_LINEAR_ACCELERATION suppose I found out that the device is moving at 4 m/s². a(t)=s"(t)=+4 v(t)=∫4tdt s(t)=2/3t³ s(3)=18m How much accurate it would be?
144 views

Balanced folder increment

I want to map an integer (let's say 32bits) to a valid path. The integer is an autoincrement value stored in the database. I also don't want at any case any folder to have more than N subfolders. ...
105 views

Sorting an array based on another array's order, quickly [closed]

There are two arrays of maps. The first array contains maps of ID values in a specific order (but not necessarily either pure ASC or DESC ordering): // pseudo code first := [ {"id": 1}, {"...
237 views

How to selecting Teams with Minimum Difference between Knowledge Levels

For the below challenge from a programming site, I am bit confused. Problem Statement: A Professor of Physics gave projects to the students of his class. The students have to form a team of two for ...
794 views

worst case comparisons for special case insertion sort [closed]

Consider an Insertion Sort with a Sentinel on n values, where every value occurs exactly twice in the input (so n must be even). So the best case input for comparisons is when the elements are ...
374 views

Unevenly distributed random number generation [duplicate]

Let's say I have to generate random number from 1 to 100, however, the probability of each number is not 1/100, but a predefined probability. How to generate that number? I use Ruby/Python.
108 views

Finding “spare time” in a day from within a list of events

I have a list of events which is always sorted chronologically. The start time is always followed by the end time. Times are strings formatted as 'HHmmss'. // list of events var events = [ '...
288 views

How to create a some kind of value for sentences? [closed]

I want to identify most matching sentence using some pattern. That means by using java algorithm I want to create identical value for each sentences.Each sentence when entering to that algorithm can ...
750 views

What is the best programming language to do crypto running time measurement? [closed]

I am trying to measure the running time of different crypto algorithm. e.g. how long it takes to encrypt/decrypt a block of plaintext. May I ask if C with OpenSSL is the best PL to do this?
321 views

Worth of Algorithm Challenges and event? [closed]

I'm interested in knowing whether it is advisable for computer science students to spend their major chunk of time on the online judges practising programming(like Topcoder and codeforces) or it's ...