How to find costants to demonstrate f(x)=Theta(g(x))? - algorithm

I have this equation:
I proceeded find the ration limit:
Now the exercise asks me to find two constants. How can I find the other one?
I just thought I should derivate the ration limit and solve a system with two equations (denumerator and numerator) and by that I can find the other constant. It is like find the maximum and the minimum.
Am I wrong? How can I approach this?
EDIT: I solved my own problem. This previous question: how to find out the constant in "Big theta" notation helped me.

Related

Precalculate Result of A*

Currently learning about the A* search algorithm and using it to find the quickest solution to the N-Puzzle. For some random seed of the initial starting state, the puzzle may be unsolvable which would result in extremely long wait times until the algorithm has search the entire search-space and determined there is not solution to the give start state.
I was wondering if there is a method of precalculating whether the A* algorithm will fail to avoid such a scenario. I've read a bit about how it is possible but can't find a direct answer as to a method in which to do it.
Any guidance or options are appreciated.
I think A* does not offer you a mechanism to know whether or not a problem is solvable. Specifically for N-Puzzle, I think this could help you to check if it can be solved or not:
http://www.geeksforgeeks.org/check-instance-8-puzzle-solvable/
It seems that if you are in a state where you have an odd amount inversion, you know for sure the problem for that permutation is infeasible.
For the N-puzzle specifically, there are only two possible parities, so you just need to check which parity the current puzzle is.
There is an in-depth explanation on how to do this on the math stackexchange
For general A* problems, no, there is no way to pre-compute if the graph is solvable.

How to solve non-linear equation iteratively (using Math.NET Numerics)

I have a specific non-linear equation of type:
a(1+cos(b))^2 = 4x * exp(-2c*(a-x)^2)
Can Math.NET Numerics solve this equation iteratively to get x when a,b and c are given?
The Documentation only talks about linear equations.
Thanks in advance.
Remember you can always put everything to the right hand side of this equation and find the root. Even if it's a bissection. It'll only take more time to solve.

What is the correct approach to solve SPOJ BALNUM?

I am trying to solve BALNUM problem on SPOJ. However I am unable to find approach to solve it. I am understanding that this is a dynamic programming problem but I am not able to find the recurrence function since number of occurrence of all digits(0-9) matter here.
Can someone please give me a hint. Whole algorithm or code is not required. Just a hint as how can I find the recurrence function for it?
Can you calculate the ammount of balanced numbers of given length?
Try to think about it that way - knowing how many balanced numbers have length 0, 1, 2, ... n how can you calculate how many balanced numbers have length n+1

Finding optimum path through graph search

I am currently working on Euler 411 https://projecteuler.net/problem=411.
I have figured out the mod exponentiation simplification to find all the coordinates in a reasonable amount of time and store the coordinates in files (70-200MB).
I also can plot coordinates and possible solutions. This is not the optimal solution. The optimal solution for this problem hits the maximum amount of stations.
Here's an image of N = 10000, PE reports 48 is the correct answer. The red line approximator gets 36. 504 coordinates.
N = 7**5 (16807) (actual from problem). Red line gets 159 points, 14406 unique coordinates.
This is a search problem right? Am I missing something? I have tried greedy search with a density heuristic to get an approximate search, but it is not good enough to approximate the solution to the biggest problems. It would take days to finish. I have not tried an exact search like A* because it would be slower than greedy. BFS is out of the question.
Any hints? NO SPOILERS PLEASE!! There must be a way to eliminate nodes from this massive search space I am missing.
Have you considered that there may be a pattern in where the points occur...and hence the function value? You should solve small cases (of k) by hand! Also check that there is nothing special about S(k^5). Finally, the second to last line of the problem statement seems a little suspicious, giving you particular information about S(123) and S(10000). If S(10000) is so low at forty-eight, it seems certain you are missing something and the search space need not be diabolical. So to my first reading, it does not appear to be a brute force search problem.

Create a sum of 1000, 2000, etc. from set of numers

Ok, so here's the problem:
I need to find any number of intem groups from 50-100 item set that add up to 1000, 2000, ..., 10000.
Input: list of integers
Integer can be on one list only.
Any ideas on algorithm?
Googling for "Knapsack problem" should get you quite a few hits (though they're not likely to be very encouraging -- this is quite a well known NP-complete problem).
Edit: if you want to get technical, what you're describing seems to really be the subset sum problem -- which is a special case of the knapsack problem. Of course, that's assuming I'm understanding your description correctly, which I'll admit may be open to some question.
You might find Algorithm 3.94 in The Handbook of Applied Cryptography helpful.
I'm not 100% on what you are asking, but I've used backtracking searches for something like this before. This is a brute force algorithm that is the slowest possible solution, but it will work. The wiki article on Backtracking Search may help you. Basically, you can use a recursive algorithm to examine every possible combination.
This is the knapsack problem. Are there any constraints on the integers you can choose from? Are they divisible? Are they all less than some given value? There may be ways to solve the problem in polynomial time given such constraints - Google will provide you with answers.

Resources