algorithm

inventory, supply chain, procurement management and computer science- General, high-level question

Hello, I would like to ask a rather, general, high-level introductory kind of question regarding inventory management. So, I was wondering if anyone on SO had any experience/knowledge, or worked with in the past in inventory, supply chain, procurement management settings. What typical problems or challenges one might find in this field...

Leader Election Algorithm - Comparison functions are not allowed

Suppose a network graph as a synchronous directed ring and some nodes over this network. I am trying to construct an algorithm that solves the Leader Election problem, but this without using any comparison except the equals(==) and non-equals(!=) functions. After a bunch of thoughts crossing my mind i wonder if there is no solution at a...

How do Mel Frequency Cepstrum Coefficients work?

I allready have FFT and pitch + absolute frequency calculated in real-time from input of microphone. Now I want to calculate the timbre. I saw Mel Frequency Cepstrum Coefficients - MFCCs but I didn't understand it very well. Can someone give me some tips on this.. ...

Asymptotic Notation - does n (log n) (log n) simplify?

If I have an algorithm that takes n log n steps (e.g. heapsort), where the steps take log n time (e.g. comparison/exchange of "big" integers in the range 0 to n-1), what is the asymptotic bound for the whole process. Obviously we can say "n (log n) (log n)", but I'm having a hard time trying to convince myself that I cannot simplify thi...

How to implement max/min without comparation operations(if,<,> and so on)?

SHould be implemented in PHP. ...

Question about return statements.

import java.util.Scanner; public class GregorianYear { private int year; public GregorianYear(int a) { year = a; } public void SetYear() { System.out.println( "The year is: " ); Scanner kbd = new Scanner( System.in ); year = kbd.nextInt(); } public int getYear() { ...

How to find largest triangle in convex hull aside from brute force search

Given a convex polygon, how do I find the 3 points that define a triangle with the greatest area. Related: Is it true that the circumcircle of that triangle would also define the minimum bounding circle of the polygon? ...

CodeGolf: Brothers

Hi guys, I just finished participating in the 2009 ACM ICPC Programming Conest in the Latinamerican Finals. These questions were for Brazil, Bolivia, Chile, etc. My team and I could only finish two questions out of the eleven (not bad I think for the first try). Here's one we could finish. I'm curious to seeing any variations to the co...

I want to move from web dev into something more math-based. Any suggestions?

I've been doing Rails for some time now, and, as the title suggests, I'm pretty bored with it. In the mean time, I've been very much attracted to mathematics, particularly logic, but also geometry, abstract algebra, combinatorics and graph theory, differential equations.. I enjoy pretty much all of it.. My main goal is to read lots of ...

Mel Frequency Cepstrum Coefficients algorithm

I want to get the timbre of some audio. To use that I will make the Mel Frequency Cepstrum Coefficients algorithm. The implementation looks simples (I allready made step 1): 1. Take the Fourier transform of (a windowed excerpt of) a signal. 2. Map the powers of the spectrum obtained above onto the mel scale, using triangular overla...

Simple Java List Question

I am supposed to create an iterative method stretch that takes a positive number n as a parameter and returns a new ListItem beginning a list in which each of the numbers in the original list is repeated n times. For example, if the original list is ( 6 7 6 9 ) and the parameter value is 2, then the new list returned is ( 6 6 7 7 6 6 9 9...

Algorithm to find next greater permutation of a given string.

Hello all, I want an efficient algorithm to find the next greater permutation of the given string. ...

Writing your own square root function.

How do you write your own function for finding the most accurate square root of an integer? After googling it, I found this, but firstly, I didn't get it completely, and secondly, it is approximate too. Assume square root as nearest integer (to the actual root) or a float. ...

help writing an algorithm

i need to write algo for this problem. i have never written an algo before . please correct me. there is a list which contains four collumns each with numbers with upto 5 digits and about 10 rows in total. we have to remove the rows containng any number with less than 3 digits. here is how i have tried read list into multi-dimensiona...

Advanced chroma key code samples

I'm working on an application that needs to key out the background from an image taken by a webcam in front of a green screen. I figured this would be a very common task, but to my surprise i'm having trouble finding code samples for anything more advanced than a simple color-threshold and those do not quite cut it quality wise. I've f...

C# Normal Random Number

I would like to create a function that accepts Double mean, Double deviation and returns a random number with a normal distribution. Example: if I pass in 5.00 as the mean and 2.00 as the deviation, 68% of the time I will get a number between 3.00 and 7.00 My statistics is a little weak…. Anyone have an idea how I should approach thi...

Trying to build algorithm for optimal tower placement in a game

This is going to be a long post and just for fun, so if you don't have much time better go help folks with more important questions instead :) There is a game called "Tower Bloxx" recently released on xbox. One part of the game is to place different colored towers on a field in a most optimal way in order to maximize number of most valu...

Algorithm- minimizing total tardiness

Hi, I am trying to implement an exact algorithm of minimizing total tardiness for single machine. I was searching in the web to get an idea how I can implement it using dynamic programming. I read the paper of Lawler who proposed a PSEUDOPOLYNOMIAL algorithm back in 77. However, still could not able to map it in java or c# code. Could...

Simple Algorithm time complexity Question

Hi, I am working on an assignment for an intro Datamining course. I am trying to figure out the time complexity of an algorithm (see below)? Is it linear/exponential/log/quadratic/polynominal? Any tips on how to approach a question like this would be much appreciated Consider the following algorithm for finding the third smallest elem...

Algorithm to find words spelled out by a number

I'm trying to find a way to determine all possible words that can be spelled out by a given number, given a mapping of alphabets to values. I eventually want to find a solution that works for any 1- or 2- digit value mapping for a letter, but for illustration, assume A=1, B=2, ... Z=26. Example: 12322 can be equal to abcbb (1,2,3,2,2)...