Showing posts with label algorithm. Show all posts
Showing posts with label algorithm. Show all posts

Sunday, 22 June 2014

Algorithms: Linear Search

Let's get started with the most basic of searching algorithms, the linear search. It basically involves searching a particular element in a linear array of elements by looking at each of its indices.
Let us suppose an array of integers A contain elements 1,3,4,6,2 and the element to be searched be 4. This is done by looking at each index of A ie. A[0], A[1],..,A[n] and checking if the value contained is equal to the search element 6. Here, n is the number of elements in the array.


Pseudocode:

Tuesday, 31 December 2013

Algorithms #1 : Getting started.

What is an algorithm?

 An algorithm is a procedure to accomplish a specific task in a finite number of steps. An algorithm is the idea behind any reasonable computer program.


To be interesting, an algorithm must solve a general, well-specified problem.
After all, everything in this world follows a procedure and algorithms literally shape the world around us. So, studying algorithms, I believe, is important for everybody. Computer algorithms are very interesting and enable us to solve huge number of problems with computer programs with least complexity. I personally feel that many of these algorithms like the divide and conquer algorithm are very much applicable in many real life situations as well. So, I thought we'll get started with learning about new algorithms (one every day if possible). 

This is a video from TEDed that gives you an idea of what an algorithm is in its simplest sense. So, what are you waiting for? Lets jump right in!