I need help for Q11
Please if you can, answer this question too. I need B
11) According to Dirac's theorem a simple graph with 3(n>=3) or more vertices is Hamiltonian, if every vertex on the graph has a degree >= n/2.
Now in a complete graph with n vertices, the degree of each vertex is (n-1).
For n>=3 (n-1) will be always greater than n/2.
Hence the theorem holds and any complete graph with n>=3 contains a Hamiltonian path.
The number of Hamiltonian paths in a complete graph with n vertice is n! because, every vertex of the complete graph can be a starting point of the path and can reach every other vertex.
1) b) 31:
h(31) = (31*3 - 5)mod13 = (93-5)mod13 = 88mod13 = 10
13 will be mapped to 10.
45:
h(45) = (45*3 - 5)mod13 = (135-5)mod13 = 130mod13 = 0
45 will be mapped to 0.
14:
h(14) = (14*3 - 5)mod13 = (42-5)mod13 = 37mod13 = 11
14 will be mapped to 11.
89:
h(89) = (89*3 - 5)mod13 = (267-5)mod13 = 262mod13 = 2
89 will be mapped to 2.
24:
h(24) = (24*3 - 5)mod13 = (72-5)mod13 = 67mod13 = 2
As there is a collision we will do double hashing.
(h(24) + 1*h'(24))mod13 = (2 + (7 - (24mod7)))mod13 = (2 + 7 - 3)mod13 = 6mod13=6
So, 24 will be mapped to 6.
95:
h(95) = (95*3 - 5)mod13 = (285-5)mod13 = 280mod13 = 7
95 will be mapped to 7.
12:
h(12) = (12*3 - 5)mod13 = (36-5)mod13 = 31mod13 = 5
12 will be mapped to 5.
38:
h(38) = (38*3 - 5)mod13 = (114-5)mod13 = 109mod13 = 5
As there is a collision we will do double hashing.
(h(38) + 1*h'(38))mod13 = (5 + (7 - (38mod7)))mod13 = (5 + 7 - 3)mod13 = 9mod13=9
So, 38 will be mapped to 9.
27:
h(27) = (27*3 - 5)mod13 = (81-5)mod13 = 76mod13 = 11
As there is a collision we will do double hashing.
(h(27) + 1*h'(27))mod13 = (11 + (7 - (27mod7)))mod13 = (11 + 7 - 6)mod13 = 12mod13=12
So, 27 will be mapped to 12.
27:
h(27) = (27*3 - 5)mod13 = (81-5)mod13 = 76mod13 = 11
As there is a collision we will do double hashing.
(h(27) + 1*h'(27))mod13 = (11 + (7 - (27mod7)))mod13 = (11 + 7 - 6)mod13 = 12mod13=12
So, 27 will be mapped to 12.
16:
h(16) = (16*3 - 5)mod13 = (48-5)mod13 = 43mod13 = 4
So, 16 will be mapped to 4.
25:
h(25) = (25*3 - 5)mod13 = (75-5)mod13 = 70mod13 = 5
As there is a collision we will do double hashing.
(h(25) + 1*h'(25))mod13 = (5 + (7 - (25mod7)))mod13 = (11 + 7 - 3)mod13 = 15mod13=2
As there is again collision so we go for second round of double hashing.
(h(25) + 2*h'(25))mod13 = (5 + 2*(7 - (25mod7)))mod13 = (11 + 2*(7 - 3))mod13 = 19mod13=6.
As there is again collision so we go for third round of double hashing.
(h(25) + 3*h'(25))mod13 = (5 + 3*(7 - (25mod7)))mod13 = (11 + 3*(7 - 3))mod13 = 23mod13=10.
As there is again collision so we go for fourth round of double hashing.
(h(25) + 4*h'(25))mod13 = (5 + 4*(7 - (25mod7)))mod13 = (11 + 4*(7 - 3))mod13 = 27mod13=1.
Finally, 25 will be mapped to 1.
45 |
25 |
89 |
16 |
12 |
24 |
95 |
38 |
31 |
14 |
27 |
I need help for Q11 Please if you can, answer this question too. I need B...
please help fast, this is for practice will not upvote if you take too long For the input 49, 20, 56, 75, 89, 87, 65 and hash function h(k)=k mod 11, construct the closed hash table using linear probing.
5. Hashing (a) Consider a hash table with separate chaining of size M = 5 and the hash function h(x) = x mod 5. i. (1) Pick 8 random numbers in the range of 10 to 99 and write the numbers in the picked sequence. Marks will only be given for proper random numbers (e.g., 11, 12, 13, 14 ... or 10, 20, 30, 40, .. are not acceptable random sequences). ii. (2) Draw a sketch of the hash table...
Need help with algorithm homework, please answer with complete steps. Will give thumbs up to correct and complete answer, thanks! Given a hash function h(x) = x mod 10 with inputs: 4491, 1443, 6293, 4319, 4464, 9799, 2109. Do the following: (a) Hash table with quadratic probing (b) Given new hash function h(x) = x mod 19, rehash part a, with order following the old hash table order, not original order at the beginning
Please Answer as soon as possible. Thank you so much. 5. Below is an array with 15 positions, which is used as a hash table to keep some IDs. The key to each record is the 3-digit customer's ID. The hash function h gives the index of the slot in the array for the key k: h(k)=%15. The method of collision resolution is double hashing. Hence, if collision happens, we repeatedly compute (h(key) + iha(key)) mod 15, for i from...
For this question, you need to provide your handwritten answer on the given answer sheet. A. Explain the Collision term in a Hash Table. B. Use the following hash function to build a hash table of array size (12) hashFunction(s) s s.toUpperCase(); ( 'A' hash (s. charAt(2) s.charAtC0) ) / 2 - 'A' ) MOD 12 return hash Use the hash function and the table below to build insert the following strings in the hash table using separate hash chaining...
Hi,. the question is below: Help if you can.. Here is some background information/ an example: 9. Let k-Color be the following problem. Input: An undirected graph G. Question: Can the vertices of G be colored using k distinct colors, so that every pair of adjacent vertices are colored differently? Suppose that you were given a polynomial time algorithm for (k + 1)-Color. Use it to give a polynomial algorithm for k-Color. This means that you need to provide a...
10. Submission In this question you will work with a hash table that uses double hashing. The hash table is size 11, the primary hash function is h(K)-K mod 11, and the secondary hash function is hp(K)-(K mod9) +1 Take an empty hash table. Take your student number and split it into 4 2-digit integers. Insert each of these 2-digit numbers in the order in which they appear in your student number into the empty heap. Then insert the values...
in C++ Code should work for all cases In this assignment you are requested to implement insert, search, and delete operations for an open-addressing hash table with double hashing. Create an empty hash table of size m= 13. Each integer of the input will be a key that you should insert into the hash table. Use the double hashing function h{k, i) = (hı(k) + ih2(k)) mod 13 where hi(k)= k mod 13 and h2(k) = 1+(k mod 11). The...
I need help to solve this. A5CompanyA.txt A5CompanyB.txt continues this are tables 13.3 and 13.4 Question 1: Graphs This question is similar to the question seen in Exercise 5. It is recommended that you complete Exercise 5 prior to attempting this question. For each of the two graphs given below, complete the following four items. No code is required for this question. 1. Draw the graph corresponding to the given adjaceney matrix (graph 1) or adjacency list (graph 2). 2....
please help me make this into a contradiction or a direct proof please. i put the question, my answer, and the textbook i used. thank you also please write neatly proof 2.5 Prove har a Simple sraph and 13 cdges cannot be bipartite CHint ercattne gr apn in to ertex Sets and Court tne忤of edges Claim Splitting the graph into two vertex, Sets ves you a 8 Ver ices So if we Change tne书 apn and an A bipartite graph...