D ivide et impera s ef de grup circu anamaria membri oancea elena chicea diana
This presentation is the property of its rightful owner.
Sponsored Links
1 / 5

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


  • 66 Views
  • Uploaded on
  • Presentation posted in: General

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.

Download Presentation

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

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


D ivide et impera s ef de grup circu anamaria membri oancea elena chicea diana

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 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.”


Descrierea metodei

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.


Algoritmul metodei

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.


I mplementare

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);

}


  • Login