This preview has intentionally blurred sections. Sign up to view the full version.
View Full Document
Unformatted text preview: Lecture 3: Algorithms and Programming Languages â€¢ Algorithms â€¢ Review of Programming Languages Algorithms and Bioinformatics Â§ An Algorithm is a precise description of a procedure that will accomplish a task. Â§ Correctness : proof that the algorithm correctly solves the given problem or task Â§ Efficiency : speed at which the algorithm arrives at the solution to the task or problem. Â§ An algorithmâ€™s efficiency is usually expressed in terms of the number of calculations or operations required for a task of size n â€¢ Big Oh notation: approximate number of operations required by algorithm to operate on a data set of size n â€¢ For Insertion Sort algorithm ~ O(n 2 ) â€¢ For n = 200 items, Insertion Sort requires ~40,000 operations Algorithm Example: Protein Name search Â§ Have a file containing a list of protein names (IDs) and the corresponding protein sequences. Â§ Example : ID Protein Name: Protein Sequence: 1 Tubulin MRECISIHVGQAGV... 2 p53 MEEPQSDPSVEPP... 3 GroEL MAAKDVKFGNDAR... N Actin MCDEEVAALVVDN... Â§ Task : Devise a search algorithm that will find the protein sequence for the userspecified protein. Naive Search Algorithm Â§ Strategy : (1) Obtain protein name from user (user_name). (2) Use Naive Search Algorithm to scan through list of protein names (protein_name) to find match. (3) Output corresponding protein sequence (or error message if no match is found). Â§ Implementation of step 2 in pseudocode : For each protein_name in list { if (protein_name is same as user_name) { print corresponding protein sequence } } Analysis of Naive Search Algorithm Â§ Correctness: the algorithm checks each protein name for a match, and outputs the protein sequence of a correct match. Â§ Efficiency: How many comparisons are made on average using this algorithm? â€¢ For a list of N protein names, the average search will make N/2 comparisons (more if protein names not on list are frequently chosen) â€¢ O(n) efficiency Â§ Can we find a more efficient algorithm to search for protein names? Binary Search Algorithm Â§ Strategy : (1) Sort protein name (and sequence) entries in alphabetical order....
View
Full Document
 Fall '11
 Staff
 LG, Binary search algorithm, protein sequence

Click to edit the document details