Skip to main content

Applying Data Structures and Algorithms - Newbie to Newbie


Why DSA? And How?

    I have nearly completed an intensive five-week college course detailing the preliminary and general concepts of data structures and algorithms (DSA). We discussed arrays, searches, sorts, abstract data types (ADT), binary trees, and efficiency metrics, and implemented them in Java. When DSA is used, a relevant inquiry is made about whether some algorithms and data structures are better. The short answer is yes. In many cases, the more information is stored and manipulated, the more efficiency can be disrupted by inefficient algorithms. How do we choose between them? Shaffer teaches that an algorithm should be simplistic and designed for easier comprehension by code readers and for debugging (Shaffer, 2013, p. 3). Additionally, efficient algorithms and data structures use the computer’s resources efficiently (Shaffer, 2013, p. 3). When these two characteristics of efficient code are achieved simultaneously, the program is said to be “elegant” (Shaffer, 2013, p. 4). Specific metrics for analyzing efficiency are time and space complexity. Time complexity refers to the amount of time a particular portion of an algorithm takes regarding input. In contrast, space complexity refers to the amount of memory being used, though space complexity is sometimes apparent or inconsequential and can be ignored (University of Texas, n.d.).

Applying DSA Techniques while Developing Structured Programs.

    As a newbie to DSA, there are some simple and complicated considerations to make when developing structured programs. Both complexity metrics discussed above focus on allowing asymptotic analysis, meaning the input is repeated until infinity. These metrics are imperative in the world of information technology and programming. Understanding the rules of Θ (theta), O (big-Oh), and Ω (omega) in complexity analysis is imperative in properly analyzing algorithms for efficiency. I have had exposure to Cliff Shaffer’s Data Structures and Algorithm Analysis, Edition 3.2 – Java Version, and I highly recommend getting a copy to get full exposure to these techniques. Here is a link to that resource → (https://people.cs.vt.edu/~shaffer/Book/JAVA3elatest.pdf)

    I also advise understanding the ADTs being used and applying them appropriately. For instance, class methods such as pop and peek should be applied carefully when using stacks and queues. If you have an empty stack or queue and use specific techniques to interact with them (such as peek or pop), you will have an exception thrown (Luthra, 2023). In that respect, knowing the difference between add and offer is helpful, or peek and element. Add and offer complete the same task, but the .offer() method does not throw exceptions if a queue is empty (Geeks for Geeks 2022). Similarly, the .peek() method will not throw an exception but return null (Tutorials Point, 2022). Stacks and queues are lists of items, but the stack ADT is LIFO (last in, first out), and the queue ADT is FIFO (first in, first out). “Stacks are one of the most widely used collection types in computer science. A tiny fraction of their known uses: page history in a browser, undo/redo, vending machines, navigating a maze, backtracking algorithms trying out different alternatives, and function calls in a running program” (Loyola Marymount University, n.d., Section: The Basics). In summary, understanding the tools of the language and, in general, object-oriented programming supplements DSA techniques.

 

 

References

Geeks for Geeks. (2022, November 17). Difference between add() and offer() methods in Queue in Java. https://www.geeksforgeeks.org/difference-between-add-and-offer-methods-in-queue-in-java/

Loyola Marymount University. (n.d.). Stacks. Retrieved from http://cs.lmu.edu/~ray/notes/stacks/

Luthra, T. (2023, October 2). Java stack peek() method with examples. Scaler Topics. https://www.scaler.com/topics/peek-in-stack/

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. (2022, May 06). Difference between peek(), poll() and remove() method of Queue interface in java? https://www.tutorialspoint.com/difference-between-peek-poll-and-remove-method-of-queue-interface-in-java

University of Texas. (n.d.) Complexity analysis. Retrieved from http://www.cs.utexas.edu/users/djimenez/utsa/cs1723/lecture2.html

Comments

Popular posts from this blog

Information Technology and Technology Literacy

  IT and Its Relation to Technology Literacy and Technology History Information Technology is a career field centered around technology literacy. IT involves computer hardware, software, programming, architecture, security, database, developers, network and system administration, and IT leadership (Aha!, n.d.). “Information Technology refers to the management and use of information using computer-based tools. It refers to both hardware and software. Mostly, it is the term used to refer to business applications of computer technology rather than scientific applications” (Mathew & Murugeshon, 2013, p. 15, para. 1). The need for IT could be said to have started in the 1990’s “The information age just began in the 1990's, with human activity shifting from traditional industry to creating/managing/using computerized information” (Vahid & Lysecky, 2019, Section 1.1, Para. 3). Considering that IT has fields that manage data such as a Big Data Engineer (a type of data considered to...

Using the Scratch Programming Language

  The Scratch Language Programming Experience Scratch is a building block for beginner programmers. It is considered a visual programming language and helps the programmer learn to use conditional logic, systematic reasoning, and program creativity (Integrating Computing, n.d., p. 1, para. 1). I created an interactive program that allows the user to manipulate multiple sprites simultaneously by using various inputs from the keyboard. The outcome was to enable the user to make a set of three cats appear to dance. Once I got used to the language, I had fun with it. Difficulties, Solutions, and Insight Gained from Using Scratch Learning any new language or platform is easier once the general idea of the layout is understood. Once I understood the layout of the IDE, the next difficulty was testing to see how connecting blocks, clicking on blocks, and editing blocks affected the sprites. There were some functions I would have to view the tutorials for, such as the if-then statements. Th...

The Necessity for Computer Literacy in the Workplace

The Functions of Computers in Manufacturing and My Personal Experience With Them. I have worked in the manufacturing industry for 18 years. For ten years, I compression molded fiber-reinforced thermoset polymers (fiberglass matting and thick liquid resin mixed with colors and other chemicals, then pressed them into shapes at high temps to cause the liquid resin to cure and harden). Then I switched to the CNC industry, where I found automation and was fascinated by the potential of some of the devices. Many of the devices that make automation possible are unique and have unique types of Operating Systems and IDEs that make implementation difficulty range from easy to moderate. We rely on Microsoft Windows-based products for PCs with a more common OS. A prominent program that we use on PC is called Plex. Plex allows information to be transferred around at all the computer stations, both plant-wide and from locations outside the plant. However, access from outside the plant is only grante...