Anna CS 123 - Algorithms and Data Structures
School name Anna University
Course Cs 123-
Pages 2

Unformatted text preview:

Algorithms and Data Structures We will learn these concepts by using well known algorithms in this course we will also be writing code This course is less about specific algorithms and more about the tools you will need to evaluate algorithms An algorithm is a set of steps or instructions for completing a task The field of computer science has identified several that do the job well for a given task Understanding algorithms is not just knowing that an algorithm exists but understanding when to apply it requires properly understanding the problem at hand Learning about algorithms gives you a deeper understanding about complexity and efficiency in programming The course will focus on some of the tools and concepts you ll need to be aware of before we can dive into the topic of algorithms if you re ready we re going to try and cultivate together as we work through our content John and britney took the same amount of turns to find the answer to the number they were looking for When the answer was three they both took the same number of turns this is important when the number was larger but not much larger 10 in this case we start to see that britney strategy did better she took four tries while john took 10 John and brittany took turns to find the answer when the number was 5 When the answer was 100 it took him 20 times the amount of tries to get that answer compared to britney The speed at which the result was obtained differed between john and brittany and britney in the game The two strategies britney and john used were examples of search more specifically these are search algorithms The strategy john took where he started at the beginning of the range and just counted one number after the other is a type of search called linear search linear search is a search algorithm and we can use it in the real world for example i could tell you to walk into a bookstore and find me a particular book using the linear search algorithm An algorithm definition must contain a specific set of instructions in a particular order Each step must not be a complex one and needs to be explicitly clear The last guideline is that the algorithm should actually complete and can not take an infinite amount of time When using a search algorithm the end result can actually be nothing which indicates that the value was n t found The guidelines help us define what an algorithm is but also helps us verify that the algorithm is correct executing the steps in an algorithm for a given input must result in the same output every time The same set of guidelines makes for good algorithmic thinking which is one of the most important skills we want to cultivate when we encounter a problem before rushing into thinking about solutions Algorithm correctness is proved by mathematical induction which is a form of reasoning used in mathematics to verify that a statement is correct Algorithms are used in the sequencing of dna and more efficient sequencing algorithms allow us to research and understand diseases better and faster but let s not get ahead of ourselves we ll start simple by evaluating john s linear search algorithm in terms of its efficiency The running time of an algorithm is a good indicator of how long the algorithm runs for a given set of values this measurement is called the running time On paper it s hard to gauge anything about this performance when it comes to anything with numbers though i like to put it up on a graph and compare visually on the vertical or y axis The algorithm John used is the first 40 of the alphabet and thought okay on average linear search serves us well but what about the rest of those whose names start with the letter after j in the alphabet searching for my name would take longer than the average and much longer for someone whose name starts with letter z The number of tries a proxy for running time of the algorithm against the number of values in the range which will shorten to n n Britney uses binary search algorithm to find the answer in just a few turns With every value she evaluates she can discard half of the current range on her second turn The beauty of this strategy and the reason why britney was able to find out the answer is that with each turn the algorithm is much more efficient Thank you


View Full Document

Anna CS 123 - Algorithms and Data Structures

Course: Cs 123-
Pages: 2
Documents in this Course
Load more
Download Algorithms and Data Structures
Our administrator received your request to download this document. We will send you the file to your email shortly.
Loading Unlocking...
Login

Join to view Algorithms and Data Structures and access 3M+ class-specific study document.

or
We will never post anything without your permission.
Don't have an account?
Sign Up

Join to view Algorithms and Data Structures 2 2 and access 3M+ class-specific study document.

or

By creating an account you agree to our Privacy Policy and Terms Of Use

Already a member?