Most important type of Algorithms - GeeksforGeeks (2024)

Last Updated : 02 Nov, 2023

Summarize

Comments

Improve

What is an Algorithm?

An algorithm is a step-by-step procedure to solve a problem. A good algorithm should be optimized in terms of time and space. Different types of problems require different types of algorithmic techniques to be solved in the most optimized manner. There are many types of algorithms but the most important and fundamental algorithms that you must are discussed in this article.

1. Brute Force Algorithm:

This is the most basic and simplest type of algorithm. A Brute Force Algorithm is the straightforward approach to a problem i.e., the first approach that comes to our mind on seeing the problem. More technically it is just like iterating every possibility available to solve that problem.

Example:

If there is a lock of 4-digit PIN. The digits to be chosen from 0-9 then the brute force will be trying all possible combinations one by one like 0001, 0002, 0003, 0004, and so on until we get the right PIN. In the worst case, it will take 10,000 tries to find the right combination.

2. Recursive Algorithm:

This type of algorithm is based on recursion. In recursion, a problem is solved by breaking it into subproblems of the same type and calling own self again and again until the problem is solved with the help of a base condition.
Some common problem that is solved using recursive algorithms are Factorial of a Number, Fibonacci Series, Tower of Hanoi, DFS for Graph, etc.

a) Divide and Conquer Algorithm:

In Divide and Conquer algorithms, the idea is to solve the problem in two sections, the first section divides the problem into subproblems of the same type. The second section is to solve the smaller problem independently and then add the combined result to produce the final answer to the problem.
Some common problem that is solved using Divide and Conquers Algorithms are Binary Search, Merge Sort, Quick Sort, Strassen’s Matrix Multiplication, etc.

b) Dynamic Programming Algorithms:

This type of algorithm is also known as the memoization technique because in this the idea is to store the previously calculated result to avoid calculating it again and again. In Dynamic Programming, divide the complex problem into smaller overlapping subproblems and store the result for future use.
The following problems can be solved using the Dynamic Programming algorithm Knapsack Problem, Weighted Job Scheduling, Floyd Warshall Algorithm, etc.

c) Greedy Algorithm:

In the Greedy Algorithm, the solution is built part by part. The decision to choose the next part is done on the basis that it gives an immediate benefit. It never considers the choices that had been taken previously.
Some common problems that can be solved through the Greedy Algorithm are Dijkstra Shortest Path Algorithm, Prim’s Algorithm, Kruskal’s Algorithm, Huffman Coding, etc.

d) Backtracking Algorithm:

In Backtracking Algorithm, the problem is solved in an incremental way i.e. it 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.
Some common problems that can be solved through the Backtracking Algorithm are the Hamiltonian Cycle, M-Coloring Problem, N Queen Problem, Rat in Maze Problem, etc.

3. Randomized Algorithm:

In the randomized algorithm, we use a random number.it helps to decide the expected outcome. The decision to choose the random number so it gives the immediate benefit
Some common problems that can be solved through the Randomized Algorithm are Quicksort: In Quicksort we use the random number for selecting the pivot.

4. Sorting Algorithm:

The sorting algorithm is used to sort data in maybe ascending or descending order. Its also used for arranging data in an efficient and useful manner.
Some common problems that can be solved through the sorting Algorithm are Bubble sort, insertion sort, merge sort, selection sort, and quick sort are examples of the Sorting algorithm.

5. Searching Algorithm:

The searching algorithm is the algorithm that is used for searching the specific key in particular sorted or unsorted data. Some common problems that can be solved through the Searching Algorithm are Binary search or linear search is one example of a Searching algorithm.

6. Hashing Algorithm:

Hashing algorithms work the same as the Searching algorithm but they contain an index with a key ID i.e a key-value pair. In hashing, we assign a key to specific data.
Some common problems can be solved through the Hashing Algorithm in password verification.



muskan02

Most important type of Algorithms - GeeksforGeeks (2)

Improve

Previous Article

The Role of Algorithms in Computing

Please Login to comment...

Most important type of Algorithms - GeeksforGeeks (2024)
Top Articles
Here's how much money you need to earn to join the top 1% in every U.S. state
Enhanced Due Diligence (EDD) - A Guide for Businesses
Craigslist St. Paul
Uca Cheerleading Nationals 2023
Frederick County Craigslist
Mountain Dew Bennington Pontoon
Valley Fair Tickets Costco
Riegler & Partner Holding GmbH auf LinkedIn: Wie schätzen Sie die Entwicklung der Wohnraumschaffung und Bauwirtschaft…
Day Octopus | Hawaii Marine Life
Snowflake Activity Congruent Triangles Answers
Where's The Nearest Wendy's
A.e.a.o.n.m.s
Chic Lash Boutique Highland Village
Teenleaks Discord
Immortal Ink Waxahachie
Michigan cannot fire coach Sherrone Moore for cause for known NCAA violations in sign-stealing case
Stardew Expanded Wiki
Lowes Undermount Kitchen Sinks
*Price Lowered! This weekend ONLY* 2006 VTX1300R, windshield & hard bags, low mi - motorcycles/scooters - by owner -...
Marine Forecast Sandy Hook To Manasquan Inlet
north jersey garage & moving sales - craigslist
Self-Service ATMs: Accessibility, Limits, & Features
Between Friends Comic Strip Today
How many days until 12 December - Calendarr
Brbl Barber Shop
Sherburne Refuge Bulldogs
Prep Spotlight Tv Mn
2000 Ford F-150 for sale - Scottsdale, AZ - craigslist
UCLA Study Abroad | International Education Office
O'reilly's In Monroe Georgia
Xxn Abbreviation List 2023
Kqelwaob
Valley Craigslist
How rich were the McCallisters in 'Home Alone'? Family's income unveiled
Redbox Walmart Near Me
J&R Cycle Villa Park
Tra.mypatients Folio
Greencastle Railcam
Missouri State Highway Patrol Will Utilize Acadis to Improve Curriculum and Testing Management
Terrier Hockey Blog
Tds Wifi Outage
Sabrina Scharf Net Worth
Craigslist Pets Plattsburgh Ny
60 Days From May 31
Breaking down the Stafford trade
VerTRIO Comfort MHR 1800 - 3 Standen Elektrische Kachel - Hoog Capaciteit Carbon... | bol
4Chan Zelda Totk
Research Tome Neltharus
Urban Airship Acquires Accengage, Extending Its Worldwide Leadership With Unmatched Presence Across Europe
Billings City Landfill Hours
Appsanywhere Mst
Latest Posts
Article information

Author: Pres. Lawanda Wiegand

Last Updated:

Views: 6110

Rating: 4 / 5 (51 voted)

Reviews: 90% of readers found this page helpful

Author information

Name: Pres. Lawanda Wiegand

Birthday: 1993-01-10

Address: Suite 391 6963 Ullrich Shore, Bellefort, WI 01350-7893

Phone: +6806610432415

Job: Dynamic Manufacturing Assistant

Hobby: amateur radio, Taekwondo, Wood carving, Parkour, Skateboarding, Running, Rafting

Introduction: My name is Pres. Lawanda Wiegand, I am a inquisitive, helpful, glamorous, cheerful, open, clever, innocent person who loves writing and wants to share my knowledge and understanding with you.