I'm looking for some pointers about a dynamic programming problem. I cannot find any relevant information about how to solve this kind of problem. The only kind of problem I know how to solve using dynamic programming is when I have two sequences and create a matrix of those sequences. But I don't see how I can apply that to the followin...
basically, I have the
map<std::string, int>
so if i have
foo 5
bar 10
jack 3
in the map, I want to display it (notice the reverse order)
bar 10
foo 5
jack 3
And every time it is updated, I want iterate through all the elements, cout them, sorted by value. What is the good way to implement that? should I provide a comparat...
I'd like to be able to write something like the following. Can someone show me how to write a clean WordReader class in C#. (a word is [a-zA-Z]+)
public List<string> GetSpecialWords(string text)
{
string word;
List<string> specialWords = new List<string>();
using (WordReader wr = new WordReader(text))
...
Hi,
Design an algorithm to find all pairs of integers within an array which sum to a specified value ?
It was not an assignment question. I had tried this problem using Hash table to store entry for sum of array elements but it is not the efficient solution and so want to know what are thoughts of other stackoverflow readers on it.
T...
I'm using SQL Server 2000, and given a a set of data (with unique ID's), I want to figure out the diffs with rows in the database, matching on the unique IDs. I'm also trying to keep it as flexible as possible.
I can use C#/VB in the front end to take the parameters, or even return things. Maybe passing in XML and getting XML in ret...
I would like to display a percentage with three decimal places unless it's greater than 99%. Then, I'd like to display the number with all the available nines plus 3 non-nine characters.
How can I write this in Python? The "%.8f" string formatting works decently, but I need to keep the last three characters after the last string of nine...
Hi,
I was thinking about ways to improve my ability to find algorithmic solutions to a problem.I have thought of solving math problems from various math sectors such as discrete mathematics or linear algebra.After "googling" a bit I have read an article that claimed the need of learning game programming in order to achieve this and it s...
Interesting programming puzzle:
If the integers from 1 to 999,999,999
are written as words, sorted
alphabetically, and concatenated, what
is the 51 billionth letter?
To be precise: if the integers from 1
to 999,999,999 are expressed in words
(omitting spaces, ‘and’, and
punctuation - see note below for format), and s...
Greetings!
The idea is simple. Let's say that I have a service wherein people can walk up to a kiosk and "pair their phone" with a bluetooth device on that kiosk. We'll ignore why people would do this, but let's say that they have an incentive to do so.
Let's say that I have convinced thousands (if not millions) of people to do this ...
This is more of an algorithms question, but hopefully someone can help me with this. I have a line made of of latitude/longitude points and I want to create a polygon from it with some predefined thickness. So basically the polygon would have edges that run parallel to the original polyline on either side. Any thoughts on the best approa...
Hi,
Now i m Working on 3d . In that I need to find intersection of triangle with other triangle. How to find it. Please Help.
...
Hi all,
I know some algorithm judge online system, but few of them have the solution attached. Most of the time after I deliever my own answer on those system, I can seen other people's solution have fewer memory usage and shorter CPU time cost which after refactories my code can not achieve. Is there any problem set have elegant soluti...
Hello,
In my free time I like polishing my algorithm / programming skills (well, my skills suck and I try to improve them) by solving problems on pages like topcoder.com or uva.onlinejudge.com. Usually I can write and code correct algorithm for simpler problems - I understand most of the basic concepts regarding things like recursion or...
Hi,
I have a task to match multiple events(facts) with each other by some their properties.
As a result of events matching some action should be generated. Action can be generated when events of all exists types were matched.
Is there any algorithm which could be used for such task? Or any direction?
Thanks
Example:
We have several e...
I know that I can use a KD-Tree to store points and iterate quickly over a fraction of them that are close to another given point. I'm wondering whether there is something similar for lines.
Given a set of lines L in 3D (to be stored in that data structure) and another "query line" q, I'd like to be able to quickly iterate through all l...
Hi,
Recently I have been interviewing for quite a few Software Development Engineering position and almost every interview I have faced have been concentrated heavily on Algorithm and Data Structures, am wondering how could it be possible to face an unknown problem and design an algorithm for it using appropriate data structures that to...
I am currently in the process of working on an scheduling application and have run into a small snag. Because the field is heavily regulated for safety reasons the software is required to check a number of interdependent conditions to ensure a trip is possible. Instead of a nice tree of conditions - which would be simple to implement - I...
Hi,Is there a form of legal restriction(s) from using Pagerank o HITS Algorithm?I am in the process of creating a geographical search engine,but i am wonder if i can use the pagerank Algorithm or that of HITS.
If there are restrictions,will those restrictions still apply if i modify the implementation of the algorithm?
Thanks in advanc...
I'm implementing a password + password hint code I and want to prevent the user from making the password hint reveal the actual password right away.
Here are the scenario that I want to prevent:
Lets say that the password is: foobar123
Then the password hint can't be:
"foobar123"
"The password is: foobar123"
"f-o-o-b-a-r-1-2-3"...
Can someone give me an idea of an efficient algorithm for large n (say 10^10) to find the sum of above series?
Mycode is getting klilled for n= 100000 and m=200000
#include<stdio.h>
int main() {
int n,m,i,j,sum,t;
scanf("%d%d",&n,&m);
sum=0;
for(i=1;i<=n;i++) {
t=1;
for(j=1;j<=i;j++)
t=((long long)t*i)%...