# DA18 - Algorithm Design Techniques Brute force...

This preview shows pages 1–6. Sign up to view the full content.

B.B. Karki, LSU 0.1 CSC 3102 Algorithm Design Techniques Brute force Divide-and-conquer Decrease-and-conquer Transform-and-conquer Space-and-time tradeoffs Dynamic programming Greedy techniques

This preview has intentionally blurred sections. Sign up to view the full version.

View Full Document
B.B. Karki, LSU 0.2 CSC 3102 Space-and-Time Tradeoffs
B.B. Karki, LSU 0.3 CSC 3102 Basics Trading space for time is much more prevalent than trading time for the space. Two variations: Input enhancement: Preprocesses the problem’s input, and store the additional information obtained in order to accelerate solving the problem afterward. Sorting by counting String matching Prestructuring: Exploits space-for-time tradeoffs and uses extra space to facilitate a faster and/or more flexible access to the data Hashing B-trees

This preview has intentionally blurred sections. Sign up to view the full version.

View Full Document
B.B. Karki, LSU 0.4 CSC 3102 String Matching String matching is a problem of finding an occurrence of a given pattern in a given text. Pattern - a string of m characters Text - a longer string of n characters. Better algorithms than the brute-force approach are based on input enhancement idea. Preprocess the pattern, and store the related information and use it during search process. Two types of algorithms: Knuth-Morris-Pratt algorithm compares characters of a pattern from left to right. Horspool’s and Boyer-Moore algorithms compare characters of a pattern from right to left.
B.B. Karki, LSU 0.5 CSC 3102 Horspool’s Algorithm The Horspool’s algorithm is a simplified version of the Boyer-Moore algorithm. Both algorithms start by aligning the pattern against the beginning characters of the text. If no matching string is found (that is, the first trial fails), shift the pattern to the right. They differ in deciding the shift size

This preview has intentionally blurred sections. Sign up to view the full version.

View Full Document
This is the end of the preview. Sign up to access the rest of the document.

{[ snackBarMessage ]}

### Page1 / 14

DA18 - Algorithm Design Techniques Brute force...

This preview shows document pages 1 - 6. Sign up to view the full document.

View Full Document
Ask a homework question - tutors are online