Docsity
Docsity

Prepare for your exams
Prepare for your exams

Study with the several resources on Docsity


Earn points to download
Earn points to download

Earn points by helping other students or get them with a premium plan


Guidelines and tips
Guidelines and tips

Slide on Brute-Force Sequential Search | CSCE 350, Study notes of Computer Science

Material Type: Notes; Professor: Huang; Class: DATA STRUCTR&ALGORITHMS; Subject: Computer Science & Engineering; University: University of South Carolina - Columbia; Term: Spring 2009;

Typology: Study notes

Pre 2010

Uploaded on 09/02/2009

koofers-user-o61
koofers-user-o61 🇺🇸

10 documents

1 / 2

Toggle sidebar

Related documents


Partial preview of the text

Download Slide on Brute-Force Sequential Search | CSCE 350 and more Study notes Computer Science in PDF only on Docsity! 1 CSCE 350: Data Structures and Algorithms Chin-Tser Huang huangct@cse.sc.edu University of South Carolina 02/06/2009 2 Announcement Reading assignment: Chapter 3.3 Homework 2 due on Monday, February 9 in class Midterm Exam study guide is posted on class website HW score has been updated at CSE dropbox https://dropbox.cse.sc.edu 02/06/2009 3 Bonus Question Can we solve the problem of computing an in time? ALGORITHM IntExp(n) if n = 0 return 1 else if n mod 2 = 0 return (IntExp(n/2))2 else return (IntExp((n-1)/2))2 × a )(lognΘ 02/06/2009 4 Brute-Force Sequential Search Efficiency: Problem: find a search key in a given list 02/06/2009 5 Brute-Force Sequential Search Efficiency: An enhancement to remove the check on i’s value ← No need to check i<n in every iteration! 02/06/2009 6 Brute-Force String Matching Problem: find a substring in the text that matches the pattern pattern: a string of m characters to search for text: a (longer) string of n characters to search in Brute-force algorithm Step 1 Align pattern at beginning of text Step 2 Moving from left to right, compare each character of pattern to the corresponding character in text until all characters are found to match (successful search); or a mismatch is detected Step 3 While pattern is not found and the text is not yet exhausted, realign pattern one position to the right and repeat Step 2
Docsity logo



Copyright © 2024 Ladybird Srl - Via Leonardo da Vinci 16, 10126, Torino, Italy - VAT 10816460017 - All rights reserved