Lecture3 - Lecture 3 Algorithms and Programming Languages...

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

View Full Document Right Arrow Icon

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

View Full Document Right Arrow Icon
This is the end of the preview. Sign up to access the rest of the 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 user-specified 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

{[ snackBarMessage ]}

Page1 / 6

Lecture3 - Lecture 3 Algorithms and Programming Languages...

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

View Full Document Right Arrow Icon
Ask a homework question - tutors are online