Thursday, April 23, 2020

Algorithms and Data Structure Designs


Programmers must come up with steps to accomplish a specific task, which is also known as an algorithmTasks such as add, remove, insert, sort, and search are all crucial for a programmer to code using programming languages like Java. Time and space are relative to constructing algorithms to achieve the desired task. Time complexity is a function describing the amount of time required to run an algorithm in terms of the size of the input.   Space complexity is a function describing the amount of memory an algorithm takes in terms of the size of input to the algorithm. An algorithm with lesser run time requires more memory (space) and lesser memory requires longer run time. These two concepts are vital to whether the results of your program will finish in a few hours versus a few weeks.


Some algorithms are better than others.  For example, a binary search is better than a linear, because a linear search searches each element until the element is found.  A binary search sorts the elements, then begins the search from the middle to reduce the search space by half. 


Linear Search Animation


Basic code constructs like loops (do, for, while) and flow-control (if-else) statements are common in writing algorithms for structured programs like calculating sales orders or maintaining databases for a company.

The particular data structure chosen completely depends on the frequency of the operation that needs to be performed on the data structure.  One can use a list, stack, tree, graph, or queue in personal or professional programming tasks.  I would apply algorithmic design and data structure techniques in my role as a junior software developer. The team lead has tasked me with developing a Java program that uses a linked list to insert and remove items.  I will utilize the Java syntax and techniques learned while reviewing the Java – The LinkedList Class tutorial.  You can choose to add anything to a list abstract data type (ADT) including sports players, ingredients for a recipe, car makes/models, etc.  The processes of printing, adding, and removing items to said list are simple which does not require any looping.  The simpler the better. 






Happy Coding!


References:

Lysecky, R., Vahid, F., Lysecky, S., & Givargis, T. (2015). Data structures essentials. Retrieved from https://zybooks.zyante.com/#/zybook/DataStructuresEssentialsR25/chapter/1/section/3
Shaffer, C. A. (2013). Data structures and algorithm analysis (Edition 3.2). Retrieved from http://people.cs.vt.edu/~shaffer/Book/JAVA3elatest.pdf

Tutorials Point. (2016). Data Structures and Algorithms Linear Search. Retrieved from https://www.tutorialspoint.com/data_structures_algorithms/linear_search_algorithm.htm

Tutorials Point. (2020). Data Structures and Algorithms Basic Concepts. Retrieved from https://www.tutorialspoint.com/data_structures_algorithms.htm


No comments:

Post a Comment

Algorithms and Data Structure Designs

Programmers must come up with steps to accomplish a specific task, which is also known as an algorithm .  Tasks such as add, remove, insert...