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.

learn more… | top users | synonyms (1)

4
votes
2answers
243 views

Deduplication of complex records / Similarity Detection

I'm working on a project that involves records with fairly large numbers of fields (~15-20) and I'm trying to figure out a good way to implement deduplication. Essentially the records are people along ...
3
votes
1answer
186 views

How to solve binary labeling with graph cut?

Many literature references suggest that the binary labeling problem can be converted into a graph cut problem and solved with the max flow/min cut algorithm. I'm trying to understand the formulation ...
2
votes
3answers
664 views

Architecture strategies for a complex competition scoring system

Competition description: There are about 10 teams competing against each other over a 6-week period. Each team's total score (out of a 1000 total available points) is based on the total of its ...
-1
votes
3answers
1k views

Why are algorithms and data structures important? [duplicate]

It seems like a lot of university-level computer science programs and programmer job interviews focus heavily on algorithms and data structures. I'm curious as to why universities and employers put so ...
1
vote
1answer
101 views

Algorithm for determining the order of property resolution

I have a list of properties, that are bound to some string expression: property z, expression '[x] + [y]' property x, expression '[y] + 1' property y, expression '1' So to solve z, I need ...
2
votes
0answers
152 views

Generate complex (non-convex) polyhedron UV mapping

I need to find an approach to the problem of generating texture maps for non-convex polyhedrons without using a design tool like Maya. Specifically, I am mapping simulation results data onto a 3D ...
3
votes
2answers
516 views

Which of these two shuffle algorithms is more random?

Which of below two shuffle algorithms (shuffle1 and shuffle2) is more random? public final class Shuffle { private static Random random; public static void shuffle1(final Object[] array) { ...
51
votes
11answers
3k views

Writing my problem solving approach on paper?

I'm a freshman Computer Science student and we just started doing some actual projects in Python. I have found I'm very efficient when I use the pen and paper method that my professor suggested in ...
2
votes
1answer
220 views

Programming puzzle with constant selection

THE QUESTION: There is an event where there are N contestants. There are three tasks in the event: A,B,C (say). Each participant takes part in the events in the listed order: i.e a contestant must ...
2
votes
1answer
89 views

How to indicate reliability when reporting availability of competencies

We have employees with competencies: Pete Welder Carpenter Melissa Carpenter Assume they both work 40 hours/week, and have not yet been assigned work. We need to report the ...
0
votes
1answer
319 views

help in theory regarding prefix_suffix_set

I found this question at codility.com, but I don't understand the question. Can you help me figure out what do they want? I am more interested in the theory than a code. A non-empty zero-indexed ...
2
votes
1answer
112 views

Storing different algorithms and using them for demonstration

I have an app for creating simple graphs (the kind with vertices and edges) and then using different algorithms on them (BFS, DFS, topsort, Prim's etc) for demonstrating how they work. I'm now ...
3
votes
2answers
328 views

Breadth-first graph search problem

I thought I was doing breadth-first graph search correctly, but my instructor's grading script is telling me that my answer is incorrect. From the instructions: Consider a breadth-first graph ...
0
votes
1answer
113 views

Algorithm for compression of a dictionary (words and definitions)

The theoretical situation is this: Let's say that we have a digital dictionary (by which I mean a traditional list of words and definitions, not an associative array). For the sake of simplicity, ...
3
votes
3answers
500 views

Finding an object on an infinite line

Question: There is an infinite line. You are standing at a particular point you can either move 1 step forward or 1 step backward. You have to search for an object in that infinite line. Your object ...
0
votes
0answers
68 views

Smallest set of objects that add up to a certain value

I’m trying to write an algorithm that, given a number of credits and a set of objects that have different values, calculates: 1) The smallest set of objects which values add up to the number of ...
0
votes
0answers
74 views

why the time complexity of Quick sort is better than heap sort and merging sort? [duplicate]

the heap sort\Merging sort\Quick sort all have the same time complexity nlogn. why the quick sort is better than others?
2
votes
2answers
218 views

When is a code considered tight and how does it increase efficiency of the code?

I have read many times that insertion sort has tight code and hence the hidden constant factor in its asymptotic complexity is smaller. I just read yesterday that quick sort has tight code just like ...
3
votes
1answer
142 views

Algorithm to arrange objects so that the total length of edges between them is minimized?

We are given a list of edges between a set of N vertices. There are atmost three edges joining a vertex. We have to arrange all the vertices on a straight line with the positions numbered from 1 to N ...
4
votes
1answer
261 views

Hashing Algorithm: Deleting an element in linear probing

While using Linear probing method to implement hashing, when we delete and element, the position of the deleted element is declared as a tombstone/ mark it as deleted. Why can't we just shift all the ...
0
votes
2answers
149 views

Application qos involving priority and bandwidth

Our manager wants us to do applicaiton qos which is quite different from the well-known system qos. We have many services of three types, they have priorites, the manager wants to suspend low priority ...
2
votes
1answer
95 views

Sorting with continous input

I'm designing (not writing, yet) a task scheduler system for a complex video game. The rest of the program passes it objects containing a function and some metadata including an estimation of how much ...
5
votes
3answers
276 views

Algorithm to pick user

I need an algorithm for picking a user. Users are identified by letter {A, B, C, ...} and are ranked by number {1, 2, 3, ...}. Rank is the degree of likelihood to be picked, so a rank 2 user is ...
5
votes
1answer
149 views

Problem in Understanding Algorithm from TAOCP “Multiply Permutations in Cycle Form”

I am not able to understand one algorithm discussed in TAOCP Volume 1; Section 1.3.3 named as "Algorithm A" stated as "Multiply permutations in cycle form" while compared with the stated example in ...
3
votes
1answer
206 views

How does Mercurial determine which changesets I need when I pull?

This is a question about the internal workings of Mercurial. I vaguely remember a fellow programmer explaining to me how mercurial works out which changesets differ between two repositories and that ...
-5
votes
2answers
109 views

Calculate transfer time while accounting for loss of conductivity and speed over circuits [closed]

So based on my limited understand of how computers work I derived the following question. As you transfer things over circuits the circuits heat up. As they heat up they lose conductivity and ...
1
vote
2answers
193 views

How fast should a Python factoring script be?

Just how efficient is "good enough" for all intents and purposes? I wrote a script to simply list off all numbers that divide into an input, x, as pairs (i, n//i) and was just curious how efficient I ...
1
vote
1answer
202 views

What are some algorithms that can assist with reservation time scheduling?

Here's the gist of the problem: There are multiple service providers who each have their own schedules of availability. There are multiple customers who seek their services. Customers need to be able ...
2
votes
1answer
155 views

Strategy for normalising and interpreting location data

I'm a bit stuck with a problem involving the normalisation of location input data from the user (which comes from a third party). Aim To logically breakdown and interpret the user location input ...
5
votes
2answers
413 views

difference between accounting and potential methods in Amortized Analysis

I was going through the Introduction to Algorithms by Cormen et al.In the chapter titled Amortized Analysis,the difference between accounting and potential methods is given like this The ...
8
votes
1answer
207 views

Match two strings but allow for a degree of error

How can I match two strings, but at the same time allow for X number of characters to be incorrect in the match. The number of errors should be a controllable variable. While X number of characters ...
1
vote
3answers
467 views

Sort an array in a specific order - not ascending/descending

I'm working on an algorithm that works best if the inputs are passed to it in a particular order, so I want to sort them that way. The difference is drastic enough for me to consider re-sorting the ...
0
votes
0answers
115 views

Karger's algorithm for bin-packing?

I first came across that algorithm as the "Random minimum cut" algorithm. And recently a colleague was trying to pack a big quantity of small textures into one image file. Then it clicked - why not ...
27
votes
8answers
2k views

What is beautiful code? [closed]

I often read that developers must write beautiful code, but for a beginner as I am it remains obscure of what is beautiful code and how do you recognize it? The corollary question is: How to write ...
0
votes
1answer
179 views

Finding all points that are located in one line in 2D coordinate system

I have an array of points. Each point has two members - x and y. I want to get any 3 points and check, are they located in single line in 2D coordinate system. For example - 1x2, 2x3, 5x6: If ...
8
votes
1answer
369 views

longest list of words with matching start and end letters

My friend gave me a problem that he says is easy, but I can't figure out a good algorithm to use to do it. You are given an input of 100 random English words. You have to find the longest string of ...
0
votes
1answer
617 views

Convert Algebraic Expression directly into Binary Tree Structure (sans prefix / postfix)

I am looking all over internet to find a logic to convert an Algebraic Expression into a Binary Tree. I could only find ones where you first convert the algebra expression to postfix or prefix and ...
3
votes
2answers
78 views

Quickly prune and create valid data combinations

I am really struggling with a problem where I need to "prune" down available scenarios to those that a user has defined as valid. Below is a small example of the problem I am trying to solve in .Net ...
0
votes
1answer
188 views

Why no gender recognition studies are performed yet to recognize gender without seeing (based on behavior)? [closed]

Each website has visitors, and each visitor might be a potential customer (lead), thus it's really good to do whatever a marketer can do to attract that lead and turn it into a real customer. ...
1
vote
1answer
471 views

Find index of item closest to value, but is also less than value

Let's say I have a sorted array of ints like so: int[] numbers = new[] { 10, 20, 27, 30, 55, 70 }; What is the most efficient way, given a value, to find the value in that array (or the index of ...
4
votes
2answers
143 views

Accurate calculation of a raster image's boundary length

I have a rasterized image that contains two colors: white and black. The black portion is entirely connected and looks like a big blob. Is there a good way to estimate the length of the boundary ...
2
votes
5answers
345 views

Find pattern in a string

How would one approach the following question: We have two strings: a normal alphanumeric string and a pattern string. the pattern string can be composed by alphanumeric chars plus the char "?" and ...
4
votes
1answer
254 views

British royal succession algorithm

I was reading about the rules for royal succession of the British monarchy and thought the easiest way I could understand it is with code (or pseudo-code). I came up with this (in a C# like ...
0
votes
1answer
168 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 ...
0
votes
4answers
105 views

Big-O of this algorithm?

How can I describe the growth function in terms of n for the following algorithm? What is the bounding function (the Big-O)? Is it O(n^3)? for(i = 0 to n - 1) { c = i + 1 for(j = c to n) ...
14
votes
10answers
1k views

Find out whose turn it is to buy the croissants, accounting for possible absences

A team has decided that every morning someone should bring croissants for everybody. It shouldn't be the same person every time, so there should be a system to determine whose turn it is next. The ...
5
votes
3answers
918 views

random unique pair numbers from two range

I want to write a function that return random unique pair numbers every time call it from a range until resetting it. Something like this: function randomUniquePairs($ranges, $reset = false){ if ...
0
votes
0answers
95 views

Algorithm to analyse and predict

I'm having a set of data's, say Question, Question's Main Category,Main Category followers, Question's Related Categories,Each Related Categories followers, Whether it got answer in 24hrs [Yes/No] ...
0
votes
0answers
142 views

Performance of a Skip-List algorithm

Here is a simple code for a randomized skip-list: Coin_Side flip() { if ( random() % 2 == 0 ) return HEADS; else return TAILS; } Note: random() returns an integer that uses ...
0
votes
0answers
77 views

data stored in dbase (application result dd.mm.yyyy)

I have a .dbf file (dbase) with data of type "date" to read directly via php. I have the application result (format: dd.mm.yyyy) and the stored hex code. I can't interpret the hex data to get the same ...