Newbie to Newbie

 



An algorithm is a set of rules or instructions that calculates operations and functions for computers to solve problems. Data structures are also, known as abstract data types that organize and store data in a format that enables it to be access and modified in an efficient way. Throughout this article I will share with you multiple types of algorithms and data structure designs. All of which have both their pros and their cons.  In addition, I will outline how to use these techniques to develop a structured program. Let’s get started.

When determining the most appropriate algorithm to use in developing a structured program you should consider the time complexity. The time complexity is the relationship between the growth of an input size and the growth of the operations executed. The Big O Notation will classify the algorithm based on run time and space requirements.

Examples of Algorithms:

Binary Search: The binary search is an algorithm that finds a value within an array that has been sorted from low to high. We begin by looking at the middle element to determine if the desired value falls to the right or the left of it. The side that does not contain the element is eliminated and the side that does contain the element continues to be split in half until the element is found. Let’s use the WhitePages for example. Let’s say you wanted to locate James Williams. The white pages are sorted already by alphabetical order. The letter ‘M’ is the 13th letter of the alphabet and therefore is the middle. We know that ‘W’ comes after ‘M’ so the first half of the array would be eliminated, and we would continue to split the second half until we arrive as the desired value. A program can be built that would help identify where James Williams falls in the white pages more efficiently that flipping through each page.

Merge Sort: Merge Sort is a more efficient algorithm than the linear sort. In this algorithm the data splits the collection in half into sub-collections until they can be sorted in constant time, at which point the entire collect is sorted and merged back together. The time complexity of this algorithm is O (N Log N) which is the most efficient of its kind.

Examples of Data Structures:

Array: An array is an indexable amount of memory. Arrays are fixed in size. If the array was meant for five elements the data structure could not hold six elements. Unless of course the array is appended.

Linked List: The linked list on the other hand is more flexible and the data can be packaged into nodes that holds the data and points to the next node. Nodes can continue to push the user to the next node until it hits null. Only when it hits null will it come to a stop.

Programmer, you are off to a great start. Learning data structures and algorithms will assist you in simplifying ways to solve computer-based problems. Be sure to join us for our next article .


Lysecky, R., Vahid, F., Lysecky, S., & Givargis, T. (2015). Data structures essentials. Retrieved from https://zybooks.zyante.com/#/zybook/DataStructuresEssentialsR25/chapter/1/section/3

Comments

Popular posts from this blog

Week 5 Final Project - Theory Concept Map

Object-Oriented Programming and Java