- #1
devilazy
- 15
- 0
1. Explain how to find a shortest path between any given pair of vertices, given the length of edges connecting the vertices and the shortest distance between vertices (after doing the shortest-path calculation)
So I am given a two matrices, as said one with length of edges connecting and the other with shortest distance after calculation (they both have a total of 15 vertices). So I looked at the first matrix and since I see no infinity signs I concluded that all the vertices are connected and there is no directions. I then look at the second matrix and concluded that the if the shortest path is the same as the other matrix, then the shortest path is a direct path between the vertices. Now as to how to find the shortest path for vertices that are not direct, here's my "educated" gues, by testing out different combination. Let's say we want to find the shortest path for x to y (assuming that the direct path x to y is not the shortest path). So with the second matrix I know what the shortest distance between x and y is, so then I look at the first matrix and remove and paths that are greater than the shortest distance. From then just test out like from x to a (a different vertex) is blah, and from a to y is blah. IF they both add up to the shortest distance then x>a>y is the shortest path. So that's my guess and I think it's dumb, because it takes too much time to work out but at the same time I can't figure out what else I can do. So just a little pointer or two to which direction I should look at would be great.
2. Given f(x) = 10(x-1)(x-2) and h(x)= x!
Prove that f(x)=O(h(x))based on the definition of the big O notation.
My try: first I put the equations out straight.
10(x-1)(x-2)= O(x!)
So next I just try to simplify the equation (I think this step is completely wrong.)
10(x-1)(x-2)=O(x(x-1)(x-2)(x-3)!)
10(x-1)(x-2)=O(x-1)(x-2)(x(x-3)!)
10=O(x(x-3)!)
And I conclude that since 10 being a constant will never change, while x(x-3)! will constantly increase and be greater than 10 eventually. Therefore, f(x) is bounded by h(x).
3. Using proof by contradiction, show that any tree with 2 or more vertices must have at least 2 vertices of degree 1. In other words, show that it is contradictory in any tree with 2 or more vertices if at most one of the vertices has a degree of 1 while others have degrees of 2 or more.
First off, I have to let you know my that my English is not very good, this question took me a while to understand and I am still uncertain what exactly it's asking for. First I figured out I should prove that a tree with 2 or more vertices can't have only 1 vertex with degree of 1. So I pointed out with example that the smallest tree to be made with this context is one with 2 vertices, and they must be connected to be a tree. So in this case both vertices would have a degree of just 1, since they can't have paths going to nowhere. But then I looked at a tree with 3 vertices, all connected together. This tree has 3 vertices which all have 2 degrees then. Now I'm just confused in general if the question wants me to prove it's true or false.
That's mainly the questions I have, so if you can help me out with the questions, even if it's just one or two of them, please do. Thank you.
So I am given a two matrices, as said one with length of edges connecting and the other with shortest distance after calculation (they both have a total of 15 vertices). So I looked at the first matrix and since I see no infinity signs I concluded that all the vertices are connected and there is no directions. I then look at the second matrix and concluded that the if the shortest path is the same as the other matrix, then the shortest path is a direct path between the vertices. Now as to how to find the shortest path for vertices that are not direct, here's my "educated" gues, by testing out different combination. Let's say we want to find the shortest path for x to y (assuming that the direct path x to y is not the shortest path). So with the second matrix I know what the shortest distance between x and y is, so then I look at the first matrix and remove and paths that are greater than the shortest distance. From then just test out like from x to a (a different vertex) is blah, and from a to y is blah. IF they both add up to the shortest distance then x>a>y is the shortest path. So that's my guess and I think it's dumb, because it takes too much time to work out but at the same time I can't figure out what else I can do. So just a little pointer or two to which direction I should look at would be great.
2. Given f(x) = 10(x-1)(x-2) and h(x)= x!
Prove that f(x)=O(h(x))based on the definition of the big O notation.
My try: first I put the equations out straight.
10(x-1)(x-2)= O(x!)
So next I just try to simplify the equation (I think this step is completely wrong.)
10(x-1)(x-2)=O(x(x-1)(x-2)(x-3)!)
10(x-1)(x-2)=O(x-1)(x-2)(x(x-3)!)
10=O(x(x-3)!)
And I conclude that since 10 being a constant will never change, while x(x-3)! will constantly increase and be greater than 10 eventually. Therefore, f(x) is bounded by h(x).
3. Using proof by contradiction, show that any tree with 2 or more vertices must have at least 2 vertices of degree 1. In other words, show that it is contradictory in any tree with 2 or more vertices if at most one of the vertices has a degree of 1 while others have degrees of 2 or more.
First off, I have to let you know my that my English is not very good, this question took me a while to understand and I am still uncertain what exactly it's asking for. First I figured out I should prove that a tree with 2 or more vertices can't have only 1 vertex with degree of 1. So I pointed out with example that the smallest tree to be made with this context is one with 2 vertices, and they must be connected to be a tree. So in this case both vertices would have a degree of just 1, since they can't have paths going to nowhere. But then I looked at a tree with 3 vertices, all connected together. This tree has 3 vertices which all have 2 degrees then. Now I'm just confused in general if the question wants me to prove it's true or false.
That's mainly the questions I have, so if you can help me out with the questions, even if it's just one or two of them, please do. Thank you.