DZone
Big Data Zone
Thanks for visiting DZone today,
Edit Profile
  • Manage Email Subscriptions
  • How to Post to DZone
  • Article Submission Guidelines
Sign Out View Profile
  • Post an Article
  • Manage My Drafts
Over 2 million developers have joined DZone.
Log In / Join
  • Refcardz
  • Trend Reports
  • Webinars
  • Zones
  • |
    • Agile
    • AI
    • Big Data
    • Cloud
    • Database
    • DevOps
    • Integration
    • IoT
    • Java
    • Microservices
    • Open Source
    • Performance
    • Security
    • Web Dev
DZone > Big Data Zone > Algorithms: Greedy, Dynamic, D, and C

Algorithms: Greedy, Dynamic, D, and C

Here is a short rundown of a few algorithms you might find useful.

Piyush Arora user avatar by
Piyush Arora
·
Oct. 31, 16 · Big Data Zone · Opinion
Like (2)
Save
Tweet
3.92K Views

Join the DZone community and get the full member experience.

Join For Free

Greedy Algorithms

So, the greedy algorithms are those, in which best optimal solution is to be chosen at every stage.

The solution is build piece by piece.Greedy algorithms are better than dynamic programming, if applicable. As not every problem could be solved by a greedy method. For ex.0-1 knapsack problem can not be solved by greedy method.

Other problems that could be solved by greedy method are- Kruskal's MST, Prim's MST, Activity selection.

Dynamic Programming

Dynamic Programming is a paradigm that solves a given problem by breaking it into subproblems and stores the result of subproblems to avoid computing the same results again and again.

The main properties of a problem to be solved by this method are-:

1-Overlapping subproblem

2-Optimal sub Structure

For ex A fibonacci problem needs that to compute the factorial of 5 we must compute factorial of 2 , 3, 4 . So computing these again & again could be a mess, So these values are stored in lookup, and are looked before computing , if available they are restored from lookup otherwise calculated.

For ex- LCS , 0-1 Knapsack

Divide & Conquer

 Like Greedy and Dynamic Programming, D&C is also a paradigm. A typical D&C also solves the problem with 3 steps:

1. Divide: Break the problem into subproblems

2. Conquer: Recursively solve problems

3.Combine: Join the solutions

For example: Binary search, Quick Sort, Merge Sort.

Algorithm

Opinions expressed by DZone contributors are their own.

Popular on DZone

  • How to Modify Java Command-Line Arguments
  • 4 Careers for People with Coding Backgrounds
  • Revoking Access to JWTs With a Blacklist/Deny List
  • How to Make Git Forget a Tracked File Now in .gitignore

Comments

Big Data Partner Resources

X

ABOUT US

  • About DZone
  • Send feedback
  • Careers
  • Sitemap

ADVERTISE

  • Advertise with DZone

CONTRIBUTE ON DZONE

  • Article Submission Guidelines
  • MVB Program
  • Become a Contributor
  • Visit the Writers' Zone

LEGAL

  • Terms of Service
  • Privacy Policy

CONTACT US

  • 600 Park Offices Drive
  • Suite 300
  • Durham, NC 27709
  • support@dzone.com
  • +1 (919) 678-0300

Let's be friends:

DZone.com is powered by 

AnswerHub logo