Docsity
Docsity

Prepare for your exams
Prepare for your exams

Study with the several resources on Docsity


Earn points to download
Earn points to download

Earn points by helping other students or get them with a premium plan


Guidelines and tips
Guidelines and tips

This is assignment 1 with subject Web Design and Development, and some others subject, Essays (university) of Web Design and Development

In this assignment, I was assigned as a Trainee Security Specialist and Head of Security at NorthStar Secure Company. I will have to design a presentation so that they can train new employees in tools and techniques that support research and defense against information security threats with the organization's protection activities business-critical data and devices. In this assignment, I will present and provide a detailed report with a technical assessment of the identification of risks to the

Typology: Essays (university)

2020/2021

Uploaded on 11/05/2021

Tunnieee
Tunnieee 🇬🇧

1 document

1 / 56

Toggle sidebar

Related documents


Partial preview of the text

Download This is assignment 1 with subject Web Design and Development, and some others subject and more Essays (university) Web Design and Development in PDF only on Docsity!

PROGRAMMING

QUACH CONG TUAN

BHAF

Table of Content

I. Introduction

II. Algorithms

III. Steps in program development

IV. Application of algorithms and problem solving

V. Coding

VI. References

I. Introduction

  • The report includes definitions, characteristics, how to use algorithms to solve simple business problems, and the steps to take to create a work program solution. The report will introduce an integrated development environment.
  • Computer programming is the process of designing and writing computer programs. As a skill set, it includes a wide variety of different tasks and techniques, but our tutorials are not intended to teach you everything. Instead, they are meant to provide basic, practical skills to help you understand and write computer code that reflects things you see and use in the real world.

I. Introduction

1. Algorithms - An algorithm is a step-by-step description of the solution to a problem, a process, or set of rules to be followed in calculations or other problem-solving operations, especially by a computer. 2. Step in Program Development - The various steps involved are defining or analyzing the problem, design (Algorithms), coding, documenting the program, compiling and running the program, testing and debugging, maintenance. 3. Coding - In the social sciences, coding is an analytical process in which data, in both quantitative form or qualitative form, are categorized to facilitate analysis. One purpose of coding is to transform the data into a form suitable for computer-aided analysis

II. Algorithms

  1. Algorithms definition
  2. Characteristics of algorithms
  3. Types of algorithms

II.1 Algorithms Definition

  • An Algorithm is a sequence of steps that describe how a problem can be solved. Every computer program that ends with a result is basically based on an Algorithm. Algorithms, however, are not just confined for use in computer programs, these can also be used to solve mathematical problems and on many matters of day-to-day life. Based on how they function, we can divide Algorithms into multiple types. Let’s take a look at some of the important ones.
  • An algorithm, known as algorithms, is a finite set of instructions that are clearly defined, can be done by computer, often to settle a class issue problem or to perform a calculation. The algorithms are always clear and used to specify the performance of calculations, data processing, automatic inference, and other operations.

II.1 Algorithms Definition Example for grill Beef Steak:

  • Input: Beef, Spices
  • Output: Beef Steak
  • There are 6 basic steps to grill beef steak:
  • Step 1: Prepare beef and grill
  • Step 2: Marinated
  • Step 3: Grill
  • Step 4: Food Cooked
  • Step 5: Decorate and Taste

II.1 Algorithms Definition

The following is an example of how to cook Beef Steak:

STEP 1 Prepare beef and a grill STEP 2 Marinated STEP 3 Grill

II.1 Algorithms Definition

The following is an example of how to cook Beef Steak:

STEP 4 Food Cooked STEP 5 Decorate and Taste If the meat is raw, we will grill it and if the meat is cooked we can decorate and taste it.

II.1 Algorithms Definition 2.2.1 Flowchart of Example The following is an example of how to cook Beef Steak:

II.2 Characteristics of algorithms In the world of computers, an algorithm is a step-by-step description of the solution to a problem. The characteristics of the algorithm are as follows:

  • INPUT : An algorithm that has input values from a specified set. It must have 0 or more but must be a finite number of inputs.
  • OUTPUT : From each set of input values, the algorithm will generate the output values. The output value is the solution to the problem.
  • FINITENESS : An algorithm must always end after a finite number of steps. Finite steps can mean you get the expected output or you get feedback that no solution is feasible.
  • DEFINITENESS : Each step of an algorithm must be determined correctly; The actions taken must be strictly defined and clear on a case by case basis. Definiteness means specifying the sequence of operations to turn inputs into outputs.
  • EFFECTIVENESS : Every algorithm needs to be expected to be effective, and it must ensure the two rules above are finite and deterministic.
  • IMPLEMENTATION INDEPENDENT : An algorithm should have step-by-step directions, which should be independent of any programming code.

II.2 Characteristics of algorithms

  • Characteristics of algorithms : Beef Steak DEFINITE FINITE Before cooking Beef Steak, we need identify input and output. Input: Beef, spices Output: Beef Steak Algorithms of cooking beef steak includes 5 steps. At the final step, we must have result and process of cooking must finish.

II.2 Characteristics of algorithms Effective Implementation Steps cooking must be doable, basic and necessary. If you want to have a delicious beef steak, you must marinate it before grilling. Each step should implementation independent. Example: We can’t marinate beef and grill at the same time.

II.3 Types of algorithms

According to Coding Ninja , there are many types of algorithms, and below are the 6 most important and used

ones.

Here is a list of the types of Algorithms to begin with:

  • Brute Force algorithm
  • Greedy algorithm
  • Recursive algorithm
  • Backtracking algorithm
  • Divide & Conquer algorithm
  • Dynamic programming algorithm
  • Randomized algorithm 2.3.0 Types of Algorithms

II.3 Types of algorithms

1. Recursive Algorithms: This is one of the simplest to devise algorithm as it does not require to specifically think about every subproblem. This means we just need to think about the existing cases and the solution of the simplest subproblem, all other complexity will be handled by it automatically. Example: 2.3.1 Recursive Algorithms

II.3 Types of algorithms

2. Divide and Conquer Algorithm: This is one of the most used algorithms in programming. This algorithm divides the problems into subproblems and then solve each of them and then combine them to form the solution of the given problems. Again, it is not possible to solve all problems using it. As the name suggests it has two parts: Divide the problem into subproblems and solve them. - Combine the solution of each above problems. - This algorithm is extensively used in various problems as it is quite stable and optimal for most of the problems asked.

II.3 Types of algorithms Applications :

  • Binary Search
  • Merge Sort & Quick Sort
  • Median Finding
  • Matrix Multiplication
  • Let us discuss the simplest application of Binary Search. Previously we described how searching of an element in a

sorted array takes O( n ) time, this time we apply divide and

conquer algorithm to reduce its complexity to O( logn ).

2.3.2 Divide and Conquer Algorithms 2.3.3 Divide and Conquer Algorithms

II.3 Types of algorithms

3. Dynamic Programming Algorithm : This is the most sought out algorithm as it provides the most efficient way of solving a problem. Its simply means remembering the past and apply it to future corresponding results and hence this algorithm is quite efficient in terms of time complexity. Dynamic Programming has two properties: - Optimal Substructure: An optimal solution to a problem contains an optimal solution to its subproblems. - Overlapping subproblems : A recursive solution contains a small number of distinct subproblems. This algorithm has two version: - Bottom-Up Approach: Starts solving from the bottom of the problems i.e. solving the last possible subproblems first and using the result of those solving the above subproblems. - Top-Down Approach: Starts solving the problems from the very beginning to arrive at the required subproblem and solve it using previously solved subproblems.

II.3 Types of algorithms 2.3.4 Dynamic Programing Algorithms Applications

  • Longest Common Subsequence, Longest Increasing Subsequence, Longest Common substring etc.
  • Bellman-Ford algorithm
  • Chain Matrix multiplication
  • Subset Sum
  • Knapsack Problem & many more.

II.3 Types of algorithms

4. Brute Force Algorithm: The simplest possible algorithm that can be devised to solve a problem is called the brute force algorithm. To device an optimal solution first we need to get a solution at least and then try to optimize it. Every problem can be solved by brute force approach although generally not with appreciable space and time complexity. Example: 2.3.5 Brute Force Algorithm

II.3 Types of algorithms

5. Backtracking Algorithm: It is an improvement to the brute force approach. Here we start with one possible option out of many available and try to solve the problem if we are able to solve the problem with the selected move then we will print the solution else we will backtrack and select some other and try to solve it. It is a form of recursion, it’s just that when a given option cannot give a solution, we backtrack to the previous option which can give a solution and proceed with other options.

II.3 Types of algorithms Applications

  • Generating all Binary strings
  • N-Queens Problem
  • Knapsack Problem
  • Graph coloring Problem
  • Let us see the application of this algorithm in generating all strings with n bits. 2.3.6 Backtracking Algorithm

II.3 Types of algorithms

  1. Greedy Algorithm: In this algorithm, a decision is made that is good at that point without considering the

future. This means that some local best is chosen and considers as the global optimal. There are two

properties in this algorithm.

  • Greedily choosing the best option
  • Optimal substructure property: If an optimal solution can be found by retrieving the optimal solution to its subproblems.
  • A greedy algorithm does not always work but when it does, it works like a charm! This algorithm is easy to

devices and most of the time the simplest one. But making locally best decisions does not always work as

it sounds. So, it is replaced by a reliable solution called the Dynamic Programming approach.

II.3 Types of algorithms Applications

  • Sorting: Selection Sort, Topological sort
  • Prim’s & Kruskal ’s algorithms
  • Coin Change problem
  • Fractional Knapsack Problem
  • Job Scheduling algorithm 2.3.7 Greedy Algorithm 2.3.8 Greedy Algorithm Now a brute force solution would make us think that if we sort the events by their starting times & starting with the first event while excluding all events which overlap the previous will certainly give a solution but it wont maximise the number of events. Let us see, after sorting by starting time So, we choose B, E, C which is certainly a larger number of events than previous. Hence in such cases, the Greedy Algorithm gives the best solution to this type of problem.

II.3 Types of algorithms 2.3.9 - 6 Types of Algorithms

Above are the 6 most important and used ones.