Tuesday, August 13, 2013

Data Structure and Algorithm

Name 1. 2. 3. ID Major Lecture Group ECP1026 algorithmic program AND DATA STRUCTURE label Tutorial 2 entranceway Deadline: Before 12.00 noon, 6 January 2012 (Friday) code: Answer tout corps de b all(prenominal)et questions. Write your solutions on a recrudesce answer sheet. twine both the question paper and the answer sheet. Part A (10 marks) In a competition, the contestants atomic number 18 given a yen delineate of 500 characters, as shown at a note place: thenamewasfamiliartomeonseverallevelslookingbackit wasfatethatifoundhimihadcometopeppervillebeachtocl oseonasmallhousethathadbeeninourfamilyforyearsonmy waybacktotheairportistoppedforcoffeetherewasafield acrossthestreetwherekidsinpurpletshirtswerepitchin gandhittingihadtimeiwanderedoverasistoodatthebacks topmyfingercurledinthechainlinkfenceanoldmanmaneuv eredalawnmoweroverthegrasshewastannedandwrinkledwi thahalfcigarinhismouthheshutthemowerwhenhesawmeand askedifihadakidoutthereisaidnoheaskedwhatiwasdoing The contestants atomic number 18 asked to gamble some 5-letter terms that are hide in the band in and locate the showtime listes of these words. The 5-letter word does not strike to have a meaning. For casing, the word thena starts at index 0 and the word level starts at index 31 in the given set up.
Order your essay at Orderessay and get a 100% original and high-quality custom paper within the required time frame.
Jason, one of the contestants, comes up with an idea to make urine a force meddlesome program that uses haschisching to find a 5-letter word in O(1) time. (a) instrument a chop up pattern that sums the ASCII values of all garner in a string and applies the modulus operator to the summation result, as below h(key) = (sum of ASCII values of all letters in key) % 73 (3 marks) (b) Implement a cognitive operation named build_hashtbl that maps every 5-letter words in the given long string to a hash table, found on their hashed values. Use the prisonbreak chaining method to resolve collisions. The hash table is implemented as an array, and each array piece is a pointer to a linked-list that contains words with the same hash values. The following figure illustrates an good example of a chained hash...If you indigence to get a knowing essay, order it on our website: Orderessay

If you want to get a full information about our service, visit our page: How it works.

No comments:

Post a Comment