Unit 3 & 4: Design and Problem-Solving Techniques PDF

Summary

This document appears to be a set of notes on design and problem-solving techniques, possibly a university-level class or workshop. It covers various stages of a design process, problem-solving techniques in computer science, and provides practical applications for each technique.

Full Transcript

Unit 3 Stage 5 – Select: Making choices – one of the proposed design solutions is chosen for development. The key decision criterion is fitness for purpose: – does the design meet the needs and goals of the brief, – will it effectively communi...

Unit 3 Stage 5 – Select: Making choices – one of the proposed design solutions is chosen for development. The key decision criterion is fitness for purpose: – does the design meet the needs and goals of the brief, – will it effectively communicate to the target audience to achieve those aims? – The winning design is typically that which most closely meets the design brief – It may not be possible or desirable to meet all the requirements of a brief within a single design. – A studio may advance what it thinks are the best design solutions – the client knows its business, market and clients best and will make the final choice. – This could well be different to the designer’s preferred choice. – At the end of the selection process, the client will sign off the choice, thus initiating the next stage in the design process. Checklist: – Does the design meet the defined needs of the brief? – Does the design resonate with the target audience? – Can the design be produced on time and on budget? – Are there other factors to take into account? – Has the client signed off the design? Stage 6 – Implement: Delivering the solution to the design brief Delivering the solution to the design brief. – the designer passes the design artwork and format specifications – This moment provides a good opportunity to confirm the production specifications – By double-checking, everyone is clear about the level of expectation – The design team typically provides project management during this stage, in order to ensure that the end results meet design expectations, – testing functionality as well as the visual appearance – This stage ends with the final delivery to the client of the finished job. e.g Implementation of face detection system using python Checklist: – Has the client signed off the designs? – Have printers or other production professionals been booked? – Has the artwork been delivered to production professionals? – Has the job been proofed against the design? – Has the finished job been delivered? Stage 7 – Learn: Obtaining feedback Obtaining feedback – learning from what has happened throughout the design process. – The client and design agency might seek to identify what worked well and where there is room for improvement. – a learning opportunity for future projects. – It forms one of the sources of information for the define and research stages. – facilitate the production of increasingly optimal solutions in the future E.g- How whats app updated its features based on user feedback Checklist: – Has dialogue with the client about the success of implementation taken place? – How successful was the implementation? – What feedback has the client received or commissioned? – What aspects can be improved? Unit 4 Definition of problem-solving techniques in Computer Science The protocols, procedures, or methods employed to identify the root cause of a problem and construct an efficient solution. The methods used to find solutions to complex issues using algorithmic Can be systematic, analytical, or intuitive, encompassing traditional programming, machine learning, or artificial intelligence methods. Used data analysis, software development, network troubleshooting, and cybersecurity Importance of problem-solving techniques in Computer Science Mitigating runtime errors and system crashes: To identify and rectify coding mistakes effectively. Optimizing software: To improve the efficiency of software, leading to enhanced user experience and reduced resource consumption. Data analysis: To organize, evaluate, and interpret complex datasets to derive meaningful insights. Cybersecurity: To identify potential vulnerabilities and patch them before they can be exploited, thereby safeguarding digital assets. e.g At a software development company, the team notices that their mobile application crashes whenever a user tries to upload a profile picture. By employing problem-solving techniques such as testing, the team identifies that the crash occurs due to a buffer overflow when processing large images. Once identified, they solve this problem by modifying the code to handle large image sizes better. Introduction to basic problem-solving techniques and Practical Applications Divide and Conquer This technique involves breaking a larger problem into smaller, more manageable parts, solving each of them individually, and finally combining their solutions to get the overall answer. Consider an example in the context of sorting a list of numbers. Using a divide-and-conquer algorithm like Merge Sort, the list is continually split in half, until you reach lists of size one. These lists are inherently sorted, and then you recursively merge these sorted lists, resulting in a fully sorted list. Algorithm Design Algorithm Design: This technique involves formalizing a series of organized steps into an algorithm to solve a specific problem. Common approaches include greedy algorithms, dynamic programming, and brute force. Heuristics In computer science, a heuristic approach is a problem-solving strategy that uses shortcuts to find approximate solutions to problems efficiently. Heuristic approaches are often used in artificial intelligence, search algorithms, and optimization problems. Heuristics are not guaranteed to yield the optimal solution but are often good enough for practical purposes and can dramatically reduce the time and resources needed to find a solution. Recursive Thinking Recursion is predicated on solving a problem by breaking it down into smaller instances of the same problem. The idea is that, eventually, you will get to a problem that is small enough to solve directly. Each technique has its strengths and weaknesses, and the key is knowing which technique (or combination of techniques) to use for a particular problem. Remember, the goal is not just to find any solution, but to find the most efficient one possible. Importance of coding problem-solving techniques in Computer Science Enhancing code efficiency Code Efficiency refers to the effectiveness of a code in representing information with minimal redundancy. Regularly review and refactor your code to improve readability, maintainability, and performance. Adopt coding standards and best practices to ensure consistency across your codebase. How to improve code efficiency? Writing Efficient Code Use of loops for repeated actions. Use of data structures instead of separate variables. Use of compound data structures. Use of functions & procedures. Use of in-built features / external code libraries. Use of recursion. Use of object orientated coding. Separation of data from the code. Mitigating errors Checklists can help to reduce the risk of errors by ensuring that all necessary steps are taken and that nothing is overlooked. Design systems to be user-friendly: Systems should be designed to be easy to use and understand. Establish clear and concise guidelines for various tasks to prevent errors due to ambiguity or confusion. Standard Operating Procedures (SOPs): Develop SOPs that outline the step-by-step process to be followed for different tasks. Facilitating code readability and maintenance Use a consistent coding style: Use the same formatting, such as spacing, indentation, and commenting, throughout the codebase. This makes it easier for other developers to understand and change the code. Write meaningful names: Use names that accurately describe the purpose of the variable or function. Write comments: Add explanations and documentation to your code. Keep code simple: Avoid overly complex code. Refactor code: Remove unnecessary code and redundancy to increase readability. Use version control: Version control can help improve code maintainability. Write tests: Automated testing can help catch bugs early and document expected behavior. Implement error handling: Error handling ensures that software behaves predictably and robustly, even when things go wrong. Follow coding standards: Agree on coding standards with the team and document them in a shared repository. You can use tools like code linters, formatters, and analyzers to enforce the standards. Use indentation: Indentation refers to the spaces at the start of a code line. It's used for code within looping statements, control structures, and functions Implementing complex functionalities Complex applications can have many factors that contribute to their complexity, including: Functional requirements, Data management, Concurrency and parallelism, Integration, and User experience. Implementation of complex functionalities is very easy when one is following the standard algorithm and SOPs Conceptual understanding of the 7 problem-solving techniques and its applications Divide and Conquer Greedy algorithms Backtracking Dynamic Programming Brut Force approach Randomised algorithms Heuristics method Divide and Conquer A divide-and- conquer algorithm recursively breaks down a problem into two or more sub- problems of the same or related type, until these become simple enough to be solved directly. The solutions to the sub-problems are then combined to give a solution to the original problem. A divide and conquer algorithm is a strategy of solving a large problem by breaking the problem into smaller sub-problems solving the sub-problems, and combining them to get the desired output. To use the divide and conquer algorithm, recursion is used. Here are the steps involved: Divide: Divide the given problem into sub-problems using recursion. Conquer: Solve the smaller sub-problems recursively. If the subproblem is small enough, then solve it directly. Combine: Combine the solutions of the sub-problems that are part of the recursive process to solve the actual problem. Advantages of Divide & Conquer: This approach is suitable for multiprocessing systems. It makes efficient use of memory caches. Greedy algorithms A greedy algorithm is an approach for solving a problem by selecting the best option available at the moment. It doesn't worry whether the current best result will bring the overall optimal result. The algorithm never reverses the earlier decision even if the choice is wrong. It works in a top- down approach. This algorithm may not produce the best result for all the problems. It's because it always goes for the local best choice to produce the global best result. Advantages of Greedy Approach – The algorithm is easier to describe. This algorithm can perform better than other algorithms (but, not in all cases). Example Problem: You have to make a change of an amount using the smallest possible number of coins. Amount: $18 Available coins are $5 coin $2 coin $1 coin There is no limit to the number of each coin you can use. Final solution using greedy approach will be solution-set = {5, 5, 5, 2, 1} Backtracking Backtracking is like trying different paths, and when you hit a dead end, you backtrack to the last choice and try a different route Backtracking is a class of algorithms for finding solutions to some computational problems, notably constraint satisfaction problems Backtracking is an algorithmic technique for solving problems recursively by trying to build a solution incrementally, one piece at a time, removing those solutions that fail to satisfy the constraints of the problem at any point of time Backtracking algorithm is applied to some specific types of problems, – Decision problem is a question that can be answered with a yes or no. – Optimisation problem is a mathematical task that involves finding the best solution from a set of possible solutions.(Eg TSP) – Enumeration problem is a mathematical problem that involves finding all the solutions to a given problem, rather than just finding one or deciding if there is one Example Backtracking Approach Problem: You want to find all the possible ways of arranging 2 boys and 1 girl on 3 benches. Constraint: Girl should not be on the middle bench. here are a total of 3! = 6 possibilities. We will try all the possibilities and get the possible solutions. We recursively try all the possibilities. All possible solutions can be Possible solutions could be Dynamic Programming The main idea of dynamic programming is to consider a significant problem and break it into smaller, individualized components. When it comes to implementation, optimal techniques rely on data storage and reuse to increase algorithm efficiency. As we'll see, many questions in software development are solved using various forms of dynamic programming. The trick is recognizing when optimal solutions can be devised using a simple variable or require a sophisticated data structure or algorithm. Dynamic Programming is mainly an optimization over plain recursion. Wherever we see a recursive solution that has repeated calls for same inputs, we can optimize it using Dynamic Programming. The idea is to simply store the results of subproblems, so that we do not have to re-compute them when needed later. This simple optimization reduces time complexities from exponential to polynomial. Brute Force Brute Force Algorithms are exactly what they sound like – straightforward methods of solving a problem that rely on sheer computing power and trying every possibility rather than advanced techniques to improve efficiency. Advantages: The brute force approach is a guaranteed way to find the correct solution by listing all the possible candidate solutions for the problem. It is a generic method and not limited to any specific domain of problems. The brute force method is ideal for solving small and simpler problems. It is known for its simplicity and can serve as a comparison benchmark. Disadvantages: Brute force algorithm is a technique that guarantees solutions for problems of any domain helps in solving the simpler problems and also provides a solution that can serve as a benchmark for evaluating other design techniques, but takes a lot of run time and inefficient. For example: imagine you have a small padlock with 4 digits, each from 0-9. You forgot your combination, but you don't want to buy another padlock. Since you can't remember any of the digits, you have to use a brute force method to open the lock. So you set all the numbers back to 0 and try them one by one: 0001, 0002, 0003, and so on until it opens. In the worst case scenario, it would take 104, or 10,000 tries to find your combination. Randomized algorithm An algorithm that uses random numbers to decide what to do next anywhere in its logic is called Randomized Algorithm. A randomized algorithm is a technique that uses a source of randomness as part of its logic. It is typically used to reduce either the running time, or time complexity; or the memory used, or space complexity, in a standard algorithm. The algorithm works by generating a random number, r, within a specified range of numbers, and making decisions based on r's value. This kind of algorithm could help process by randomly sampling the input in order to obtain a solution that may not be totally optimal, but will be good enough for the specified purposes. Example- A superintendent is attempting to score a high school based on several metrics, and she wants to do so from information gathered by confidentially interviewing students. However, the superintendent has to do this with all the schools in the district, so interviewing every single student would take a time she cannot afford. What should she do? The superintendent should employ a randomized algorithm, where, without knowing any of the kids, she’d select a few at random and interview them, hoping that she gets a wide variety of students. This technique is more commonly known as random sampling, which is a kind of randomized algorithm. Heuristics method In mathematical programming, a heuristic algorithm is a procedure that determines near-optimal solutions to an optimization problem. However, this is achieved by trading optimality, completeness, accuracy, or precision for speed. Nevertheless, heuristics is a widely used technique for a variety of reasons: Problems that do not have an exact solution or for which the formulation is unknown The computation of a problem is computationally intensive Calculation of bounds on the optimal solution in branch and bound solution processes

Use Quizgecko on...
Browser
Browser