Thursday, February 29, 2024

Newbie to Another Newbie

Applying Algorithmic Design and Data Structure Techniques 

in Developing Structured Programs (in Java)


In the introductory phases of programming and coding, algorithms and data structures will rarely be used. However, once you begin storing, collecting, altering and sorting data, knowing the best way to do so for the situation at hand will make your code more readable and easily alterable, not just for yourself but for others you may be collaborating on a project with. 

The size and intensity of a project, the speed that the calculations must be performed, and how much space (memory) is available will help you determine which data structure is best for the situation at hand.

Another important factor to consider is whether or not the data will be sorted or not. If you're designing a new program to collect or organize data, you can code your program to sort it for you. If you'll be working with preexisting sorted data, you can code it to work with the data at hand. If the preexisting data is unsorted, there are still plenty of efficient ways to track down the exact data you want.

In Java, some popular techniques for organizing data are arrays, linked lists, graphs, stacks, and queues. You can use one or more of these to create the storage and alteration method that will fit the project. Java actually provides built-in libraries for most of these basic techniques. 

Arrays might be perfect for when the amount of data is already known and won't change.

Array Lists might be perfect for when the amount of data is subject to change and needs to be accessed quickly.

Stacks are useful for quick operations using the last-in, first-out method. This is common in undo and redo operations, and works similarly to a visual short-term memory. 

Trees are useful for when most of the data is already known, needs to be accessed quickly, and the data needs to connect or be relatable to other data.

Queues can be useful for exactly what their name is. Like an order management program for an online service, a doctors office waiting room, or a to-do list. This follows the first-in, first-out method.

Some more complex data structures like Priority Queues can be useful for backlogs, email sorting, or tackling tasks that may be easier to complete or affect more people.

This blog post will only cover a few of these techniques, and only scratching the surface on each. Combining techniques and methods will allow you to tackle any project, for almost any situation. This can help to perform operations more efficiently, keep large amounts of data sorted and updated, or where large amounts of information need to be bound to a single key, string, phrase, or code.

Understanding the characteristics and performance of every data structure is necessary for working with Java, and understanding how the structures interact with each other will allow you to tailor the program to best fit your project's needs.

No comments:

Post a Comment

Newbie to Another Newbie

Applying Algorithmic Design and Data Structure Techniques  in Developing Structured Programs (in Java) In the introductory phases of program...