Learn About Discrete Algorithms for Project

In summary, algorithms are set procedures used to solve specific problems or tasks. To understand their efficiency, one can look into "big o notation". The shortest algorithm is not always the most efficient. An example of a classic algorithm is Euclid's algorithm for finding the greatest common factor of two numbers. When choosing an algorithm, it is important to consider the problem and available options. Quicksort is a faster alternative to bubblesort with a run time of O(n*log(n)). It involves recursive sorting of an array into two partitions based on a pivot number.
  • #1
joecaveman
1
0
I have a project to do on algorithms, and as far as I can tell, the project is due before we cover the topic :p.

My textbook only makes a slight reference to what an algorithm is :(.

Can anyone point me in the direction of a website or book that tells me all there is to know about algorithms?
 
Physics news on Phys.org
  • #2
Algorithms is a pretty large subject: You may want to be a bit more specific. Algorithms themselves are just set procedures that will produce an output to a specific task or problem. If you want to understand the efficiency of an algorithm I suggest you look up "big o notation". I think that it's important to note that algorithms can be counterintuitive in that the shortest algorithm is rarely the fastest for a given problem.

An example of a classic algorithm would be Euclid's algorithm for finding the greatest common factor of two numbers, which uses the idea that gcf(y, x) = gcf(x, y mod x).

A good example of the problem of choosing an algorithm is the problem of sorting an array of numbers in a particular order using a computer program. There are many options to accomplishing this task. One of the most inefficient methods would be simply to ask the computer to produce every possible permutation of the array and to select the sorted one (run time o(n!)). A typical high school level implementation of that task would involve the bubblesort algorithm, which checks each element and only the elements at a position in the array greater than the one being checked and will swap the two if the two are not sorted according to the method you want the array to be sorted (run time o(n^2)). There are still faster ways, such as quicksort, which has a run time of o(n*log(n)), and calls for a sort of complicated to explain recursive sorting of the array into two partitions consisting of numbers greater than a certain number (called the pivot) and numbers less than that number, and then proceeds to recurse down until each partition is one element. Quicksorts are typically 20 lines of code in most programming languages compared to maybe 5 lines for bubblesort.

I hope I at least gave you some keywords to look up in your search.
 

FAQ: Learn About Discrete Algorithms for Project

What is a discrete algorithm?

A discrete algorithm is a mathematical procedure or set of instructions that operates on discrete (distinct and separate) data. This means that the algorithm works on data that is not continuous, but rather consists of individual values or points.

Why are discrete algorithms important for projects?

Discrete algorithms are important for projects because they are used to solve a wide range of problems in various fields, such as computer science, engineering, and mathematics. They are especially useful for projects that involve data analysis, optimization, and decision-making.

What are some examples of discrete algorithms?

Some examples of discrete algorithms include sorting algorithms, graph algorithms, and combinatorial algorithms. Sorting algorithms such as bubble sort and quicksort are used to arrange data in a specific order. Graph algorithms such as Dijkstra's algorithm and Prim's algorithm are used to find the shortest path or minimum spanning tree in a graph. Combinatorial algorithms such as the knapsack problem and the traveling salesman problem are used to optimize a solution based on a set of constraints.

How do you analyze the efficiency of a discrete algorithm?

The efficiency of a discrete algorithm can be analyzed by looking at its time complexity and space complexity. Time complexity refers to the amount of time it takes for the algorithm to run as the input size increases. Space complexity refers to the amount of memory required by the algorithm. Generally, algorithms with lower time and space complexity are considered more efficient.

Can discrete algorithms be used in real-world applications?

Yes, discrete algorithms are used in many real-world applications. For example, graph algorithms are used in GPS navigation systems to find the shortest route between two locations. Sorting algorithms are used in databases to retrieve information efficiently. Combinatorial algorithms are used in supply chain management to optimize inventory levels. As technology continues to advance, the use of discrete algorithms in real-world applications is only increasing.

Similar threads

Replies
13
Views
2K
Replies
8
Views
2K
Replies
1
Views
1K
Replies
3
Views
878
Replies
2
Views
1K
Replies
9
Views
1K
Replies
1
Views
981
Back
Top