Skip to main content

Posts

Showing posts from February, 2015

Binary Search

You have a big list of numbers and you want to search an element from it, how to do it? Simplest approach would be to compare this number with all the elements from the list. In this case, if the element is the last element then we have to go through all the elements till we reach the element we want and what if it doesn't exist. There are many searching algorithms to get it done efficiently, one of them is Binary Search. In binary search : Step 1. Sort the list of elements in ascending order Step 2. Check the value of element that needs to be search (lets call this 'x') with the middle element (midElement) in the list. Step 3. If the value of x is greater than midElement then the value is present in the right half of the array or else it is present in the left half of the array. Step 4. Depending on the right or left half of the array, x will be compared. Lets assume it is present in left half, then the leftMidElement is compared with x and then Step 3 is repeated until w

Hashing

Consider a use case of Electronic health record where you have a unique key for every record and you have some data associated with it like persons name, address etc. then how can you handle this data. Some ways to store this information would be to use array, linked list, trees or may be direct access table. But all these also have some problems as below : In case of array and linked list if you want to search for a record you have to search linearly. We can keeps them sorted so we can apply some searching algorithm and can get faster search results but this will create another problem of inserting  and deleting. In this case every time you insert/delete a record you must also check for the order of the array/linked list. If we consider a balanced tree then we can get the results for search/insert/delete in moderate amount of time. O(Logn) time. Out of all these, Direct Access Table shows some promising results. Direct Access Table is nothing but a huge array where the index of

Everything you need to know about ShellShock.

Shellshock was a security threat that was identified by Stéphane Chazelas on 12 September 2014 and was disclosed and announced to the public on 24 th September 2014 with the fix ready for distribution. It was assigned the identifier as CVE-2014-6271 . By the way, this is another security bug with cool logo after Heartbleed. 1. What is Shellshock? Shellshock is a name given to a vulnerability in Bash which allows an attacker to execute remote commands on vulnerable system. Bash is a command-line interpreter available on most of the operating systems like Apple’s OSx, windows and present on many versions of Linux. Bash also acts as a parser for the functions given to it.  2. Why is it harmful? Shellshock is significantly harmful for the servers connected to internet. Since, it lets attacker to escalate their privileges and potentially they can gain access to root. This gives access to the attacker as if they are the actual user and they can perform any ope