Skip to main content

Posts

Showing posts from December, 2016

Why study Algorithms?

So what is an algorithm anyways?


 Basically it's a set of well defined rules, a recipe in effect for solving some computational problem.  Maybe you have a bunch of numbers and you want to rearrange them so that they're in sorted order. Maybe you have a roadmap and an origin and a destination and you want to compute the shortest path from that origin to that destination. May be you face a number of different tasks that need to be completed by certain deadlines and you want to know in what order you should accomplish the task.  So that you complete them all by their respective deadlines.  
So why study algorithms?  Well first of all, understanding the basics of algorithms and the related field of data structures is essential for doing serious work in pretty much any branch of computer science.  To give you a few examples, routing and communication networks piggybacks on classical shortest path algorithms.  The effectiveness of public key cryptography relies on that of number-theore…

ArrayList and its underlying concept

ArrayList
pic source: Google

While an array has a fixed size (meaning you can't add more elements to the end once it's full), an ArrayList (sometimes called a resizable or dynamic array) will grow as needed. If you need to add, or additional elements, an ArrayList expands to accommodate this.
We use an ArrayList when we want the benefits of an array (constant-time access to elements at particular indices) but don't know up front how many elements we'll need to store. Additionally, different languages handle arrays and ArrayLists in different ways. In Java, we use both arrays and ArrayLists (depending on our needs):

//An array of Person objects Person[] peopleArray = new Person[numberOfPeople];
// An ArrayList of Person objects ArrayList<Person> peopleArrayList = new ArrayList<Person>();
In Python, there isn't really a true array but rather we use lists that are essentially an implementation of an ArrayList. We use the following syntax to declare lists in Python…

Modules in Python

We, ‘pygrammers’ (python programmers) knew about the great python interpreter. We also know that whatever we type into the interpreter vanishes as soon as we close the interpreter.
 So if you want to use some of the definitions and statements in other programs without rewriting the definition, we use a special type of container called the ‘MODULE’.
The process of creating definitions and saving it in a file is called “writing a script”.
A module is a python file ( filename.py) which contains statements and some definitions.
Why Modules?
Imagine that you want to build an application which consists of a million lines of code. As  an efficient programmer you must use the concept of ‘re-use’ because unnecessarily writing the same code multiple times will not only lead to increase in the length of the program but also effects the program's efficiency.
To support this, Python has a way to put definitions in a file and use them in a script or in an interactive instance of the interpreter. Suc…

What is Computer Vision ? - Part 2

(This is continuation to the first part of computer vision)
Sets of neurons excite one another if there is contrast along a line at a certain direction. Higher-level networks aggregate these patterns into meta-patterns: a circle moving upwards. Another network chimes in: the circle is white, with red lines.
Another: it is growing in size. A picture begins to emerge from these crude but completely descriptions.
For a few objects in controlled situations, this worked well, but imagine trying to describe every object around you, from every angle, with variations for lighting and motion and a hundred other things. It became clear that to achieve even toddler like levels of recognition would require impractically large sets of data.
A bottom-up approach mimicking what is found in the brain is more promising. A computer can apply a series of transformations to an image and discover edges, the objects they imply, perspective and movement when presented with multiple pictures, and so on.
The proc…

What is Computer Vision ?

Someone across the room throws you a ball and you catch it. Simple right?
Actually, this is one of the most complex processes we have ever attempted to comprehend-let alone recreate. Inventing a machine that sees like we do is a deceptively difficult task, not just because it's hard to make computers do it, but because we are not entirely sure how do it in the first place.
What actually happens is this:
 The image of the ball passes through your eye retina, which does some elementary analysis and sends it along to the brain, where the visual cortex more thoroughly analyses the image. It then sends it out to the rest of the cortex, which compares it to everything it already knows, classifies the objects and dimensions, and finally decides on something to do: raise your hand and catch the ball.
This takes place in a tiny fraction of a second, with almost no conscious effort, and almost never fails. So recreating human vision is not just a hard problem, it is a set of them, each of whic…