
 Ricky
 Moderator
Lower Bound Proofs
As started here with the Tower of Hanoi, this thread will be for lower bounds proofs. Lower bounds are used to tell how difficult a problem is. The solution to the TOH was in the form of 2^n meaning that no matter what you do, you can't solve it faster than 2^n steps. If, for example, you could solve it in n steps, we would say this is a much easier problem.
So the question is where to go from here. Most lower bounds proofs have to do with things in computer science: insert, sort, search, etc on different data structures. For example, proving that (with a few basic and almost trivial assumptions) you can't sort any faster than n*log(n).
So the question is do you want to look at computer science related questions, or should we keep this more general? In the mean time, here is a problem to keep you busy while we decide.
You have a robot in an infinitely long hallway and your task is to find a door in the wall. You may walk how ever far you wish to your left or right, and turn around whenever you please. Each time you take a step, you check to see if the door is in your new location. The door is an unknown (but finite) number of steps away. What is the minimum number of steps you must take? That is, using the best algorithm, what is the most number of steps you will ever possibly have to take?
a. You know the door is to your left. b. You don't know what direction the door is, but you do know it is n steps away. c. You don't know where the door is, but it is within n steps away. d. You neither know where the door is, nor how far away it is.
"In the real world, this would be a problem. But in mathematics, we can just define a place where this problem doesn't exist. So we'll go ahead and do that now..."
 mikau
 Super Member
Re: Lower Bound Proofs
cool stuff, ricky.
For anyone who does this, please use the hide tag as not to spoil it for others.
A logarithm is just a misspelled algorithm.
 mikau
 Super Member
Re: Lower Bound Proofs
Okay, here is and still thinking on c and d. again i don't know much about how non mathematical proofs are done so i apologize for any noobishness. If i'm making some assumptions on a and b, please tell me and give me a hint or two, ricky. Hopefully it will help me get the hang of these.
Last edited by mikau (20070713 15:32:45)
A logarithm is just a misspelled algorithm.
Re: Lower Bound Proofs
Ricky wrote:The solution to the TOH was in the form of 2^n meaning that no matter what you do, you can't solve it faster than 2^n steps.
I can do it in (2^n)1.
For the robotdoor problem, do the steps have to be one wide? For example, if you make the robot walk a distance of 2 but don't care about whether or not there is a door at the intermediate position, then would that count as one step or 2 steps?
Also, does the robot need to be next to the door to finish or is it enough for you to just know where the door is?
Why did the vector cross the road? It wanted to be normal.
 Ricky
 Moderator
Re: Lower Bound Proofs
You know the door is a finite distance away, so it might make sense to let the door be d steps away, then express your answer in terms of d. So far you're 1/2 mikau. I would have said 2/2, but in light of mathsyperson's question below, b is wrong.
I was writing in bigtheta notation...
For the robotdoor problem, do the steps have to be one wide? For example, if you make the robot walk a distance of 2 but don't care about whether or not there is a door at the intermediate position, then would that count as one step or 2 steps?
Nope, every step you take is one step, and on that step you always check.
Also, does the robot need to be next to the door to finish or is it enough for you to just know where the door is?
Wow! I'll accept knowing where the door is. Never thought of that one, great job. Of course, you can only use it on one of them.
"In the real world, this would be a problem. But in mathematics, we can just define a place where this problem doesn't exist. So we'll go ahead and do that now..."
 mikau
 Super Member
Re: Lower Bound Proofs
are you saying b is wrong because we now want how many steps to find the door instead of how many to reach the door?
Last edited by mikau (20070714 04:57:29)
A logarithm is just a misspelled algorithm.
 Ricky
 Moderator
Re: Lower Bound Proofs
No answers to (c) or (d)?
"In the real world, this would be a problem. But in mathematics, we can just define a place where this problem doesn't exist. So we'll go ahead and do that now..."
Re: Lower Bound Proofs
Why did the vector cross the road? It wanted to be normal.
 mikau
 Super Member
Re: Lower Bound Proofs
I was away all weekend, and haven't had much time to think on this one.
is this right, ricky? edit: I'll work on C tommorow.
Last edited by mikau (20070716 12:10:57)
A logarithm is just a misspelled algorithm.
 Ricky
 Moderator
Re: Lower Bound Proofs
"In the real world, this would be a problem. But in mathematics, we can just define a place where this problem doesn't exist. So we'll go ahead and do that now..."
 mikau
 Super Member
Re: Lower Bound Proofs
Thanks, Ricky!
Last edited by mikau (20070717 12:51:23)
A logarithm is just a misspelled algorithm.
 Ricky
 Moderator
Re: Lower Bound Proofs
"In the real world, this would be a problem. But in mathematics, we can just define a place where this problem doesn't exist. So we'll go ahead and do that now..."
 Ricky
 Moderator
Re: Lower Bound Proofs
The previous problem asked you to do a worstcase analysis of an algorithm for a problem. In this, you are simply looking at what the worst possible situation for your algorithm is and how much it "costs". It is very useful because as it is the worst case, any time you are asked to solve the problem, it must cost less than this.
However, there are other types of analysis. Best case cost is what it will cost in the best case for a given problem. This isn't quite as useful, but it can be used to compare two different algorithm. Again, remember that best case cost is algorithm specific. What is best for one algorithm need not be best for another.
Then of course, there is the average case cost. Typically, the average is hard to compute, even for simple problems, until you get used to summation notation and evaluation. Like worstcase cost, it can be extremely useful in determining if one algorithm is "better" than another.
Do the robot problem above, but instead, for best cost with the algorithm you've used. Then do average cost for parts (a), (b), and (c). You can try (d) if you wish, but I'm fairly certain it won't be easy. When doing this, can you think of a better algorithm in each part? Note by better, I'm referring to in the best and then average case only.
"In the real world, this would be a problem. But in mathematics, we can just define a place where this problem doesn't exist. So we'll go ahead and do that now..."
 mikau
 Super Member
Re: Lower Bound Proofs
A logarithm is just a misspelled algorithm.
 Ricky
 Moderator
Re: Lower Bound Proofs
Too much? Want to move on to a different problem and away from robots? Just say the word.
"In the real world, this would be a problem. But in mathematics, we can just define a place where this problem doesn't exist. So we'll go ahead and do that now..."
 mikau
 Super Member
Re: Lower Bound Proofs
Mmmm... I would like to see something different now actually. I'll think about those later I guess. The reason they frighten me is they obviously involve probability and permutations. Things I haven't done since precalc and i don't know much beyond what you'd learn at that level.
Last edited by mikau (20070718 15:20:59)
A logarithm is just a misspelled algorithm.
 Ricky
 Moderator
Re: Lower Bound Proofs
Not exactly. Assume the door occurs in position n. f(n) is the cost of finding the door there. Then the average cost is:
But I'll post another problem dealing with this in the morning. Computer science related questions are ok, I take it?
"In the real world, this would be a problem. But in mathematics, we can just define a place where this problem doesn't exist. So we'll go ahead and do that now..."
 mikau
 Super Member
Re: Lower Bound Proofs
A logarithm is just a misspelled algorithm.
 Ricky
 Moderator
Re: Lower Bound Proofs
Here is some code for bubble sort:
Find out what the best and worst case are for this sort, and find the cost in number of comparisons between list elements. I'll be attempting to work out the average case, so feel free to do that as well if you want to give it a shot.
"In the real world, this would be a problem. But in mathematics, we can just define a place where this problem doesn't exist. So we'll go ahead and do that now..."
 mikau
 Super Member
Re: Lower Bound Proofs
the old bubble sort, eh?
Well i'll work on it when i get some time. I've been teaching myself linnear algebra and C++ over the summer and its consuming a lot of my freetime. I'll tackle this next chance I get.
Question, i'm not sure what language you are using. Do I need to consider that a for loop makes a comparison for the entry condition on every itteration of the loop?
A logarithm is just a misspelled algorithm.
 Ricky
 Moderator
Re: Lower Bound Proofs
Nope, it's only comparisons between list elements. Note my comment on line 4.
"In the real world, this would be a problem. But in mathematics, we can just define a place where this problem doesn't exist. So we'll go ahead and do that now..."
Re: Lower Bound Proofs
Read MeEditted also Just one more thing Ricky... Subtract one more at the end of the inner loop so when the comparison is made on the last two elements, you don't overstep the array boundary. Isn't it neat the way items get moved along and dropped when a more significant value is found and then that is moved along and dropped off?? Pretty cool and easy to write.
Last edited by John E. Franklin (20070722 01:16:30)
igloo myrtilles fourmis
 Ricky
 Moderator
Re: Lower Bound Proofs
Actually, best to take out the outer loop and change it to a while. Changes made.
"In the real world, this would be a problem. But in mathematics, we can just define a place where this problem doesn't exist. So we'll go ahead and do that now..."
 mikau
 Super Member
Re: Lower Bound Proofs
hey, Ricky! I finally got a chance to work on this. here are my solutions
A logarithm is just a misspelled algorithm.
 Ricky
 Moderator
Re: Lower Bound Proofs
Your worst case is right, but what happened with your best case? You talk about swapping, but I need a number of comparisons.
"In the real world, this would be a problem. But in mathematics, we can just define a place where this problem doesn't exist. So we'll go ahead and do that now..."
