If the algorithm finds a site that contains the string (that is, Lenovo X200), assume that it then stores all data or all the text on that particular site into a storage area. To understand this problem fully, answer the following questions:
1. What is data mining?
2. What is a character string?
3. What is the worst case run time of this algorithm in terms of p, m, t, n (that is, what is O)?
4. How long do you think it will take this algorithm to run? Note the time complexity as O (run time in terms of n).
5. Assume that each Web site, on average, has character strings of length 10,000 and that the length of the character string "Lenovo X200" is 11. How many computations will the algorithm need to make per site?
6. Why is speed and the analysis of algorithm speed so important?
Inpurt: p(indexed from 1 to m), t (indexed from 1 to n), n
Ouput: i
text_search(p,m, t, n)
{ for i=1 to n−m+1 {
j=1
// i is the index in t of the first character of the substring
// to compare with p, and j is the index in p
// the while loop compares ti⋯ti+m−1 and p1⋯pm while (ti+j−1==pj) {
j=j+1
if (j>m)
return i }
}
return 0
}
1. What is data mining?
Data mining is the way toward dissecting concealed examples of data as indicated by alternate points of view for arrangement into helpful data, which is gathered and collected in like
manner zones, for example, data stockrooms, for productive examination, data mining calculations, encouraging business basic leadership and other data prerequisites to eventually cut expenses and increment income.
Data mining is otherwise called data revelation and information disclosure.
The real advances engaged with a data mining procedure are:
Concentrate, change and burden data into a data distribution center
Give data access to business investigators utilizing application programming
Present examined data in effectively reasonable structures, for example, charts
The initial phase in data mining is gathering pertinent data basic for business.
Value-based data manage everyday activities like deals, stock and cost and so forth.
Non-operational data is typically gauged, while metadata is worried about sensible database plan.
Examples and connections among data components render pertinent data, which may increment authoritative income.
Associations with a solid shopper center arrangement with data mining strategies giving clear pictures of items sold, value, rivalry, and client socioeconomics.
2. What is a character string?
A character string is a progression of characters spoken to by bits of code and sorted out into a solitary variable.
This string variable holding characters can be set to a particular length or investigated by a program to recognize its length.
In numerous sorts of PC programs, character strings are set apart by explicit grammar, which regularly incorporates quotes, and are set up or dimensioned by different programming directions.
These are then used to house various sorts of information that speak to ASCII characters.
Much of the time, a solitary byte speaks to one character by putting away a particular worth comparing to that character.
Distinctive coding shows can utilize Unicode or UTF conventions or "octet" conventions recognizing bytes as the units of activity.
A character string can assume numerous jobs in a PC program.
For instance, a software engineer can make an uninhabited character string with an order in the heap capacity of a program.
A client occasion can enter information into that character string.
In the event that the client types in a word or expression, for example, "hi world," the program can then later peruse that character string and print it, show
it on the screen, hold it for capacity, and so on.
3. What is the worst case run time of this algorithm in terms of p, m, t, n (that is, what is O)?
Finding a site that contains string Lenovo X200 is a quite hard thing, the worst case run time of this algorithm in terms of p,m,t,n
Assume that the search engine crawling the web for String "Lenovo X200". first of all the search engine search for Lenovo x200 and check all the sites which contain the term "Lenovo x200". so the worst case is checking websites one after one.
worst case= O(n)
4. How long do you think it will take this algorithm to run? Note the time complexity as O (run time in terms of n).
To run this algorithm, it takes more and more time(time complexity) because searching in web is not an simple task, it takes more time comlexity
In terms of O, the time complexity is O(n).
5. Assume that each Web site, on average, has character strings of length 10,000 and that the length of the character string "Lenovo X200" is 11. How many computations will the algorithm need to make per site?
"Lenovo X200" is 11, on and average the term taking 6 characters. So, in my opinion 1990 to 2000 computations.
it take nearly 2000 computations on average.
6. Why is speed and the analysis of algorithm speed so important?
In Assessing, we discussed evaluating things, for example, to what extent it goes for to stroll crosswise over town, or to what extent a task will take to wrap up.
In any case, there is another sort of assessing that Logical Software engineers utilize practically every day: evaluating the assets that algorithms use—time, processor, memory, etc.
Given a decision between two different ways of accomplishing something, which do you pick?
You realize to what extent your program keeps running with 1,000 records, however by what method will it scale to 1,000,000?
Incidentally, these inquiries can regularly be addressed utilizing sound judgment, some examination, and a method for composing approximations called the "enormous O" notation.
If the algorithm finds a site that contains the string (that is, Lenovo X200), assume that...
32. (6 points) Trace the Text Search Algorithm for the input t"0101001' and p "001 Input: p( indexed from 1 to m),m, t (indexed from 1 to n),n Output: i text search(p,m,t,n) f For i= 1 to n-m+1( while (ti+/-1-= pj){ jj+1 If (j> m) Return i return 0
32. (6 points) Trace the Text Search Algorithm for the input t"0101001' and p "001 Input: p( indexed from 1 to m),m, t (indexed from 1 to n),n Output: i text...
Debug following methods(longestRun(finds how many times a character got repeated), findLastP(finds last p in a string), findFirstP(finds first p in a string)) in java language. public class simpleLoops { /** * @param args */ public static void main(String[] args) { System.out.println(longestRun("aabbbccd")); System.out.println("Expected 3"); System.out.println(longestRun("aaa")); System.out.println("Expected 3"); System.out.println(longestRun("aabbbb")); System.out.println("Expected 4"); int count = countP("Mississippi"); System.out.println(count); int result = findLastP("Mississippi"); System.out.println(result); result = findFirstP("stop"); System.out.println(result); result = findFirstP("xxxyyyzzz"); System.out.println(result); } /** *...
Exercise 7.3.5: Worst-case time complexity - mystery algorithm. The algorithm below makes some changes to an input sequence of numbers. MysteryAlgorithm Input: a1, a2....,an n, the length of the sequence. p, a number Output: ?? i != 1 j:=n While (i < j) While (i <j and a < p) i:= i + 1 End-while While (i <j and a 2 p) j:=j-1 End-while If (i < j), swap a, and a End-while Return( aj, a2,...,an) (a) Describe in English...
Algorithm Analysis: Study the following sorting algorithm. SORT( A[1...n]) bound <- Length(A) -1 for i <- 1 to Length(A) newbound <- 0 for j <- 0 to bound if A[j] > A[j + 1] swap( A[j], A[j + 1] ) newbound = j -1 bound <- newbound (a) Use the longer approach described in lecture 3 week 1 that we used in analyzing Insertion-Sort to compute the running time T(n) of the above SORT algorithm. You may...
Create an algorithm for a program that reads a string with a maximum length of 30 from the keyboard. The algorithm should then copy the characters from that string into a second character array in order but only if the character is a vowel (a, e, i, o, u). Once copied, the algorithm should output these values in order. The algorithm should then count and display the number of times each vowel appears in the array. Finally, the algorithm should...
public static int countCharacter(String str, char c) { // This recursive method takes a String and a char as parameters and // returns the number of times the char appears in the String. You may // use the function charAt(int i) described below to test if a single // character of the input String matches the input char. // For example, countCharacter(“bobbie”, ‘b’) would return back 3, while // countCharacter(“xyzzy”, ‘y’) would return back 2. // Must be a RECURSIVE...
Create a C++ Header Function with DYNAMIC programing with the following details: longest common subsequence input: a string a of length m and a string b of length n output: the longest string ssuch that s is a subsequence of both a and b; in the case of ties, use the substring that comes first alphabetically The dynamic programming algorithm for subsequences is similar to the one for substrings. Both involve a 2D array of strings, base cases, and a...
Create an algorithm for a program that reads a string with a maximum length of 30 from the keyboard. The algorithm should then copy the characters from that string into a second character array in order but only if the character is a vowel (a, e, i, o, u). Once copied, the algorithm should output these values in order. The algorithm should then count and display the number of times each vowel appears in the array. Finally, the algorithm should...
Write a Java program for all items in Question Use System.out.println() for each resulting string. Let s1 be " Welcome " and s2 be " welcome ". Write the code for the following statements: a. Check whether s1 is equal to s2 and assign the result to a Boolean variable isEqual. b. Check whether s1 is equal to s2, ignoring case, and assign the result to a Boolean variable isEqual. c. Compare s1 with s2 and assign the result to...
Problem 2: A palindrome is a string of characters that is the same when reversed (e.g., ‘affa’). Single characters are palindromes. Suppose you are given a string S of N characters, and wish to produce an N-by-N matrix P, where Pij = 1 if i ≤ j and S[i, ..., j] is a palindrome, and Pij = 0 otherwise. Part a: Matrix P can be computed using brute force by separately examining each substring of S and determining whether it...