Some Basics Algorithms

written in algorithms, javascript

Hello,

In my journey in development world I learned some algorithms so useful and so older…

All these algorithms are referents the formant data and data structures. It can facilitate your job and make your code faster and robust.

In the article I’ll approach these algorithms:

Linked Lists

Basically linked lists are a data structure more complex and flexible than an array. Array works with values ​​in absolute positions, already works with the linked list nodes each of which always indicates which is the next element, so if it does not indicate what the next he is the last on the list.

Hash Tables

Hash tables are data structures much more complex based on an array of hashes of the stored values​​. The data are in estrturas buckets so you qnd uses a hash table value of the algorithm finds the key and get the value inside the bucket.

Bubble Sort

Bubble sort is the most basic way to sort a collection. It works by sequentially going through your array and comparing two values at a time, swapping them if necessary. It then repeats the process until no changes are required.

Insertion Sort

Where a bubble sort relies on a number of small swaps, insertion sort relies on inserting a single element in the right for a given iteration. Every iteration through the collection leaves a greater segment sorted.

Linear Search

The linear search is the most basic search engine that has seen. He goes through his collection through all the items until you find the corresponding item. He may be the most long to do a search. This method does not require an ordered list.

Binary Search

The Binary Search is a search always looking for the center’s collection and looking for a center, half of the collection, to find the corresponding item. He may be the fastest search method of everyone, but for that you need a list, or collection, orderly.

Ok, thats all folks. All of these examples are coded in java script, but you can use in all existents languages to code this. I just wanted to show the logic and algorithms of each technique.

Thanks and don’t forget to follow me on twitter and github.

Source: algorithms.openmymind.net


Comments