Download Presentation
D ivide et impera S ef de grup : Circu Anamaria Membri : Oancea Elena Chicea Diana

Loading in 2 Seconds...

1 / 5

# D ivide et impera S ef de grup : Circu Anamaria Membri : Oancea Elena Chicea Diana - PowerPoint PPT Presentation

D ivide et impera S ef de grup : Circu Anamaria Membri : Oancea Elena Chicea Diana Apalimaritei Daniela Opariuc Andreea Introducere ; Descriere metoda ; Algoritmul metodei ; Implementare ; Aplicatii ; Bibliografie. Divide et impera.

I am the owner, or an agent authorized to act on behalf of the owner, of the copyrighted work described.
Download Presentation

## PowerPoint Slideshow about ' D ivide et impera S ef de grup : Circu Anamaria Membri : Oancea Elena Chicea Diana' - ina

An Image/Link below is provided (as is) to download presentation

Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author.While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server.

- - - - - - - - - - - - - - - - - - - - - - - - - - E N D - - - - - - - - - - - - - - - - - - - - - - - - - -
Presentation Transcript

Divide et impera

Sef de grup:CircuAnamaria

Membri: Oancea Elena

Chicea Diana

Apalimaritei Daniela

OpariucAndreea

• Introducere;
• Descrieremetoda;
• Algoritmulmetodei;
• Implementare;
• Aplicatii;
• Bibliografie.
Divide et impera
• Divide et imperainseamna”dezbinasidomina”.
• Aceastaesteuna din celemaicunoscutemetode din istoriaomenirii.
• Este o tehnicaprin care se pot rezolvaproblemesi care consta in descompunereauneiprobleme in douasaumaimultesubprobleme,ele se rezolvaiarsolutiapentruproblemainitiala se obtinecombinandsolutiilesubproblemelor.
• Nu toateproblemele se pot rezolva cu ajutorulacesteimetode,numarulacestafiindmic.
• Motto :”Tot ceeste fundamental diferitderanjeazaordineastabilita.”
Descriereametodei

Metoda divide et imperaadmite o implementarerecursiva , deoarecesubproblemelesuntsimilareproblemeiinitiale , dar de dimensiunimaimici.

Etapelesunt:

- descompunereaproblemeinitiale in subproblemeindependente;

-descompunereatreptata a subproblemelor in altele din ce in cemai simple;

-rezolvareaproblemelor simple;

-combinareasolutiilorgasitepentruconstruireasolotiilorsubproblemelor de dimensiunimaimari;

-combinareaultimelorsolutiipentru a obtinesolutiaproblemeiinitiale.

Algoritmulmetodei

Un algoritm divide et imperatrebuiesaevitedescompunerearecursiva a subcazurilorsuficient de mici.

Algoritmuldivide et impera

algoritmdivide_et_impera (p,u,sol)

daca (p<u) atunci

imparte(p,u,m);//determinapozitia de mijloc

divide_et_impera (p,m,sol1);//se aplicaalgoritmul

divide_et_impera(m+1,u,sol2);//pentrufiecaresubproblema

sol=combina(sol1,sol2);//formareasolutiei

altfel

rezolva(sol);//rezolvasubproblemaelementara

sfarsitdaca

sfarsitalgoritmdivide_et_impera.

Implementare

Cautareabinara

#include<iostream.h>

int v[100],n,nr;

void caut (intI,inti)

{

int m=(i+j)/2;

if(nr==v[m])

cout<<“gasit,indice=“<<m;

else

if (i<j)

if(nr<v[m])

cout(i,m-1)

else cout(m+1,j);

else cout <<“nu a fostgasit.”;

}

void main()

{

cout<<“n=“;cin>>n;

for( i=1;i<=n;i++)

{

cout<<“v[“<<i<<“]=“;cin>>v[i];

}

cout<<“nr=“;cin>>nr;

cout(1,n);

}