algorithm

Can Dancing Links be applied to this CSP?

Can the Dancing Links implementation of Knuth's Algorithm X be used to solve this CSP? In this game the first and last number are always already in the board and I belive there's only one solution to each well formulated problem. ...

Finding a fuzzy match with bitap algorithm

Reciently I've looked through several implementation of bitap algorithm but what all of them do is finding the beginning point of fuzzy match. What I need is to find a match. There's an example: Say we have following text: abcdefg and a pattern: bzde and we want to find all occurence of a pattern in text with at most 1 error (Edit d...

big integers in c++

I know this question has probably been asked in this forum many times and in the web as well. I am asked to create an implementation of a big integer in c++, however there is a constraint that one of my constructor should take an int as an argument... so I am guessing there will be more than one non-default constructor... so my question ...

Random playlist algorithm

I need to create a list of numbers from a range (for example from x to y) in a random order so that every order has an equal chance. I need this for a music player I write in C#, to create play lists in a random order. Any ideas? Thanks. EDIT: I'm not interested in changing the original list, just pick up random indexes from a range ...

How do I get a flood fill algorithm to cope with closed circles?

I have an application that accepts images as input and removes the background on which the image was taken. For example, if you pass in an image of a book on a blanket, the resulting image will be just the book with a transparent background. The problem I have is when you input an image that has a large empty space in it, e.g. an elast...

upper bound, lower bound

What does it mean to prove an upper bound or lower bound to an algorithm? ...

partition a sequence of 2n real numbers so that...

Hey there, I'm currently reading The Algorithm Design Manual and I'm stuck on this exercise. Could you help me out please? Take a sequence of 2n real numbers as input. Design an O(n log n) algorithm that partitions the numbers into n pairs, with the property that the partition minimizes the maximum sum of a pair. For example, say w...

best algorithm to determine which friends are also using an application on Facebook and appengine?

On a Facebook application (working under appengine) I need to tell the user which of his friends are already using the application. When a user uses a Facebook application, Facebook handles the user's friend list to the application. This list might have up to 5000 friends, so checking them one by one might be too slow. What's the best...

Tech Interview Question-Is my approach correct?

Recently I was interviewed by a Software Company. I didnt make it through the first round itself. Maybe I was too slow in forming ideas or solving problems and wasnt good enough for the company that i interviewed for. I would like to have a second opinion about my interview and I cant find anyone better than the stackoverflow community...

How to add "weights" to a MySQL table and select random values according to these?

Hello, I want to create a table, with each row containing some sort of weight. Then I want to select random values with the probability equal to (weight of that row)/(weight of all rows). For example, having 5 rows with weights 1,2,3,4,5 out of 1000 I'd get approximately 1/15*1000=67 times first row and so on. The table is to be filled ...

How can I generate this pattern of numbers?

Given inputs 1-32 how can I generate the below output? in. out 1 1 1 1 2 2 2 2 1 1 1 1 2 2 2 2 ... Edit Not Homework.. just lack of sleep. I am working in C#, but I was looking for a language agnostic algorithm. Edit 2 To provide a bit more background... I have an array of 32 items that represents a two dimensional checkerboard. I...

Process for handling expiring airline miles

I am working on an application that needs to handle expiring airline miles. The miles can be used, but if they are not used by a certain date, they will expire. I want to make sure I expire the proper amount of miles but don't expire them if they have been used. Therefore, I have to check if enough miles have been used in a given date...

Information about the complexity of recursive algorithms

hi guys does anyone know about some good sources about counting complexity of recursive algorithms? somehow recurrent equation isn't really popular title for web page or what, I just couldn't google out anything reasonable... ...

String search algorithms

I have a project on benchmarking String Matching Algorithms and I would like to know if there is a standard for every algorithm so that I would be able to get fair results with my experimentation. I am planning to use java's system.nanotime in getting the running time of every algorithm. Any comment or reactions regarding my problem is v...

Simultaneous connections, excel

Hi everyone, I have a list of session start and stop times, in format like so: 23/11/09 15:18:32, 23/11/09 15:18:40 23/11/09 15:20:02, 23/11/09 15:20:32 23/11/09 15:20:10, 23/11/09 15:20:40 This is in excel at the moment, start datetime in one column end datetime in the other. Basically what I want to do is some post processing on t...

which is a better language (C++ or Python) for complex problem solving exercises (ex. Graphs) ?

I am trying to work on some problems and algorithms. I know C++ but a friend told me that it would be better if done with Python.As it would be much faster to develop and less time is spent in programming details which does not actually earn anything solution wise. EDIT 2: I plan to use python-graph lib from Google-codes, Please provide...

A good algorithm for generating an order number

As much as I like using GUIDs as the unique identifiers in my system, it is not very user-friendly for fields like an order number where a customer may have to repeat that to a customer service representative. What's a good algorithm to use to generate order number so that it is: Unique Not sequential Numeric values only < 10 digits C...

DSP Algorithms Book

I'm looking for a book similar to "Introduction to Algorithms" by Thomas Cormen geared towards DSP algorithms. Is there anything as thorough as Cormen on the DSP market? EDIT I should say I'm looking for a book that's analogous to The Joy of Cooking. ...

how to partition the 2d arrays among the processes for "The Game of Life"

I am doing an assignment using MPI to implement Game of Life. I was wondering if I should use a block-row partitioning, a cyclic row partitioning or a block-checkerboard partitioning? ...

preorder an array based binary search tree

I am trying to preorder a BST I am not sure how to do it. ...