Algorithmic Design
When developing a program, having a clear idea of how you
want it to perform is crucial; that is where algorithmic design comes into
play. "An algorithm is a method or a process followed to solve a
problem" (Shaffer, 2013). There are many different algorithms to choose
from, to search and sort, but the complexity of the design will depend on what
you want to accomplish. However, no matter which algorithm you choose, it must
perform as intended, have concise steps to perform without ambiguity, and be
limited to the least number of steps possible to allow proper execution. You
must always keep in mind that the computer running your program will not have
an unlimited amount of memory. Time Complexity and Space Complexity are two key
concepts to remember. "The time complexity of an algorithm quantifies the
amount of time taken by an algorithm to run as a function of the length of the
input" (Time Complexity and Space Complexity, 2021). Although it is not
the same as how quickly a computer may execute the task. Space Complexity is
the "amount of memory required by the algorithm to solve given
problem" (Time Complexity and Space Complexity, 2021). To get more
information about these concepts, click here. Two standard search
algorithms are linear search and binary search. A linear search algorithm is a
good option for smaller datasets, requiring iteration through the entire
dataset until the designated value is found. However, a binary search algorithm
is a better option for larger datasets. A binary search will break the dataset
into sections by locating the middle value, then shifting left or right
depending on where the designated value would fall. The process continues until
the value is found while also cutting down on time to complete the task by not
iterating through unnecessary values.
Data Structure
Data structures are essential to program performance and can make or break a program. A “data structure is any data representation and its associated operations (Shaffer, 2013). Data structure examples are linked lists, queues, trees, arrays, and stacks. Like algorithmic design, the type of data structure used depends on the task at hand. Linked lists and stacks are two data structures I have had the most success with. Each class allows for adding or removing elements easily with simple methods like add() and remove(). Queues I found a bit confusing using the poll(), peek(), and element() methods. However, practice and repetition will help the concepts stick as with anything new. One thing to note is if you have data likely to change, use a linked list and not an array. Data within an array is fixed, and linked list data is not.
Going Beyond
When the time comes for me to develop a structured program,
I’ll start by figuring out what problem needs solving. From there, I will
compare algorithmic design methods while keeping time complexity and space complexity
in mind to ensure the program I create suits the task. Lastly, I will determine
the best data structure to make my program efficient.
References:
Shaffer, C. A. (2013). Data structures and algorithm analysisLinks
to an external site. (Edition
3.2). Retrieved from http://people.cs.vt.edu/~shaffer/Book/JAVA3elatest.pdf
Time Complexity and Space Complexity. (2021,
July 11). GeeksforGeeks. https://www.geeksforgeeks.org/time-complexity-and-space-complexity/