DA18 - Algorithm Design Techniques Brute force...

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

View Full Document Right Arrow Icon
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
Background image of page 1

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

View Full DocumentRight Arrow Icon
B.B. Karki, LSU 0.2 CSC 3102 Space-and-Time Tradeoffs
Background image of page 2
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
Background image of page 3

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

View Full DocumentRight Arrow Icon
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.
Background image of page 4
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
Background image of page 5

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

View Full DocumentRight Arrow Icon
Image of page 6
This is the end of the preview. Sign up to access the rest of the document.

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 Right Arrow Icon
Ask a homework question - tutors are online