problem-solving

How to analyze a problem to match it with suitable design patterns?

Hi, I am wondering what should be the step by step analyzing approach to a well defined problem for figuring out the possible Design Patterns that can fit in the solution. Any guidance you can recommend? thanks ...

Is there any site/resource/book to practice and solve OO-design related problems?

Looking for some reference material where i can get some OO designing problems and solution to practice and improve designing skills. Thanks for your interest. EDIT: I have read: - Refactoring by Martin Fowler - Headfirst Design Patterns (It had problem-solution approach but very limited to a pattern in context). and have fare idea abo...

Routines for suggesting alternatives

Hi, I have been tasked with coming up with a routine that will suggest alternative domain names to register if the customers original requested domain name is already registered. The first step I think would be to split the requested domain back in to bits so that I could work out alternatives to try. eg. mybigredtruck.com would be b...

Need help with credit expiration algorithm

So I'm stuck. I am working on a credit system with expirations. Similar to credit card miles but not exactly. By the way I am sorry for the book ahead but I needed to add enough detail to help get the whole picture. What I need is a system where a user accumulates credits for doing activities. But they can also spend these credits on ac...

Best book with only programming exercises and solutions

I want to improve my programming skills for a future job interview (and for myself) and I am looking for some book or text that has only problems and solutions (in some general language like C or in pseudo code) that illustrate basic algorithms and data structures. Problems that I expect to find are for example: find sub string in a ...

Array List Problem

How do I check for null in a array list and remove them? It keeps giving me a error of "ArgumentOutOfRange was handled" or if I change the SMTPException to just Exception it says "Index out of range". Looking at the debugger and taking a look specifically at mails.Count it gives me Count = 4. I originally gave it 3 emails to check. The l...

The “pattern-filling with tiles” puzzle

I've encountered an interesting problem while programming a random level generator for a tile-based game. I've implemented a brute-force solver for it but it is exponentially slow and definitely unfit for my use case. I'm not necessarily looking for a perfect solution, I'll be satisfied with a “good enough” solution that performs well. ...

Anyone know where I can find some good MATLAB exercises with solutions?

I've been looking around and I can find plenty of tutorials and videos, but I find that the best way to learn something is by working through practise problems. Even better when there are solutions. Something like projecteuler.net is good, but I need something which is more specific to MATLAB and will allow me to master all the basics o...

Delete files with AJAX/PHP

The problem I want to delete a file with AJAX/PHP. But the php says that the file name what I send with AJAX is not a file, but when I go directly to the link I can delete the files. Check out my current PHP, i've put in the IF/ELSE statement to check if the string is a file with: is_file, the result is false. Without is_file says t...

Possible "boat loads" question

You know the river-crossing problems. Here is a sort description: Once upon a time, three cannibals were guiding three missionaries through a jungle. They were on their way to the nearest mission station. After some time, they arrived at a wide river, filled with deadly snakes and fish. There was no way to cross the river without a b...

Obtaining this information properly and efficiently.

Hello, I was wonder how I should record this information: # num: material: type: geo: light: tex: extralight: verts: 0: 13 0x0000 4 3 0 0.0000 3 0, 0 1, 1 2, 2 1: 13 0x0000 4 3 0 0.0000 3 2, 2 3, 3 4, 4 2: 13 0x00...

Mauritus national flag problem

I've made a solution for the Dutch national flag problem already. But this time, I want to try something more difficult: the Mauritus national flag problem - 4 colours, instead of 3. Any suggestions for an effective algorithm? Basically, The Mauritius National Flag Problem focuses on how you would be able to sort the given list of pair...

Would like to spend time in a good mind blowing problem solving discussion

Am in the preparation for an interview. I guess that there will definitely be around one hour to spend in discussing about a problem which the interviewer will present to me... So what i would like to do is, prepare for such a thing right now. If i get such programming problems, i will start to discuss with my friends and get practiced...

Practicing programming : solving crescent difficulty problems

Hello there. As everyone knows, real life problems when it comes to programming are numerous and often unexpected. Sometimes, those problems even are hard to solve, and without being trained to recognize them, you can quickly get stuck. I like challenge, because the more you get confronted to a recurrent situation, the less time you nee...

Flipping bits in python

Hello, Given an integer n , i want to toggle all bits in the binary representation of that number in the range say lower to upper. To do this i do the following [bit_string is a string containing 1's and 0's and is a binary representation of n] for i in range(lower,upper+1): n ^= (1 << len(bit_string)-1-i) #Toggle the ith bit Then...

In Pacman do the ghosts choose paths independently for finding pacman?

So I have been playing a lot of pacman on my cell lately and am wondering how do the ghosts seem to work independent of each other. I was thinking about how it would have been programmed. One option that I thought of was threads. All 4 ghosts are running in their own threads and somehow find pacman's position. But it seems a bit to muc...

Looking for a model to represent this problem, which I suspect may be NP-complete.

(I've changed the details of this question to avoid NDA issues. I'm aware that if taken literally, there are better ways to run this theoretical company.) There is a group of warehouses, each of which are capable of storing and distributing 200 different products, out of a possible 1000 total products that Company A manufactures. Each w...

Help Identifying If Specific Problem is a Classical Comp Science Problem

Hi All, I have a manufacturing-process issue I tackled ages ago in VBA, and it's held up for some time now although it's progressively running slower and slower as more data gets into the file. I think it's finally time to rewrite a more elegant solution in a different language, outside of VBA, but am curious if anyone knows of this be...

A problem from a programming competition... Digit Sums.

I need help solving problem N from this earlier competition: Problem N: Digit Sums Given 3 positive integers A, B and C, find how many positive integers less than or equal to A, when expressed in base B, have digits which sum to C. Input will consist of a series of lines, each containing three integers, A, B and C, 2 ...

How to programatically solve the 15 (moving numbers) puzzle?

Hi, all of you have probably seen the moving number/picture puzzle. The one where you have numbers from 1 to 15 in a 4x4 grid, and are trying to get them from random starting position to 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 My girlfriend or some of my non-programmer friends can solve this with some mumbo-jumbo magic, that th...