Saturday, January 25, 2025

Week 5 - Interactive Assignment

 An Overview of Algorithmic Design and Data Structures


Algorithmic Design: An algorithm is a set of operations to be performed in order. Algorithmic design is how one defines steps that should be taken to resolve an issue. Good algorithmic design guarantees ease of use and efficiency alongside clarity.


Data Structures: These are the ways of putting data together for storage in a computer so that it can be retrieved and modified easily. Data structures that are very common include arrays, trees, linked lists, hash tables, stacks, and queues.


Why Some Designs Are Better Than Others


Some algorithms and data structures have their specific advantages when used for specific assignments because of the following features:


Time Complexity: This is a metric of the amount of time an algorithm takes to run as a function of the length of the input. People tend to use algorithms with lower time complexities.


Space Complexity: This is a metric that determines the amount of memory space an algorithm uses in relation to the input size.


Simplicity and Readability: For algorithms to be effective, they also need to be so considerate that non-specialists will be able to understand them.


Examples


Data Search:


Linear Search: Simply put, it uses all possible search candidates until a match is found which does not make it efficient for big datasets (O(n) complexity). 


Binary Search: Is considers more efficient than the former as it does not require sorted data (O(log n) complexity).


In using very large sets of data, a hash table can provide O(1) sorting complexities on average for search operations.


Sorting:


Bubble Sort is the simplest way to sort data but can get tricky when dealing with large lists because it has O(n^2) complexities.


Merge sort on the other hand is more complicated to implement but is much more efficient in dealing with larger sets of data as it has O(n log n) complexities.


Applying The Sorting Techniques  


Whenever you are developing structured programs, makes sure to follow these steps in a precise manner:


Understand the Problem: Identify what exactly needs to be solved and be as specific as possible.


Choose the Right Data Structure: Based on the operations you need (e.g., if you need fast to moderate insertions and deletions, use an array).


Need to manage the data dynamically? Use linked lists or trees.


Once you have selected the data structure, move on to designing the algorithm: Identify all steps required and make sure they are coherent and efficient.


The steps can be implemented through iteration or recursion.


Make sure optimizations for time and space complexity is made.


Implement and Test: Write the code out and ensure that it works with whatever inputs are required to perform the bespoke tasks.


In Brief  


As discussed good algorithms and proper selection of a data structure enables an efficient program to be developed. This is mainly the reason why every algorithm and data structure has its own pros and cons which makes one more suitable than the other. Lastly, always aim for efficiency, clarity, and maintainability in the code.