Parcurgerea grafurilor neorientate Inseamna vizitare nodurilor in vederea prelucrarii informatiilor din fiecare nod. Exista doua moduri de a parcurge un.

Slides:



Advertisements
Similar presentations
For(int i = 1; i
Advertisements

Class Scope class Student { private: string id; string firstName, lastName; float gpa; public: void Read() { cin >> id >> firstName >> lastName >> gpa;
KJ + Cu(NO 3 ) 2 → CuJ + J 2 + KNO 3 KJ + Cu(NO 3 ) 2 → CuJ + J 2 + KNO 3.
Enumeration Data Type enum Day {SUN, MON, TUE, WED, THU, FRI, SAT}; Day today; today = WED; if (today == FRI) cout
Tinaliah, S. Kom.. * * * * * * * * * * * * * * * * * #include using namespace std; void main () { for (int i = 1; i
Triana Elizabeth, S.Kom. #include using namespace std; void main () { for (int i = 1; i
1/03/09 De 89 à 98. 1/03/09 De 89 à 98 1/03/09 De 89 à 98.
Breadth First Search
Nested Loops. Problem Print The only printfs you can use are: –printf(“*”); –printf(“\n”); *****
Multidimensional Arrays. Example Write a program to keep track of all warmup scores for all students. Need a list of a list of scores Student – score.
Exercise 5.
GE 211 Programming in C Matrix Dr. Ahmed Telba. Example Write function to take coefficients of quadratic equation a, b and c as input parameter and return.
One-Dimensional Arrays. Introduction A one-dimensional array is a sequence of homogenous elements stored in contigous memory locations Motivating example:

Greedy Backtracking ? ? ? ?.  Fast, low complexity, gives acceptable solution (not necessarily the best)  At each step choose the best option considering.
SNPL1 GAUSS ELIMINATION & BACK SUBSTITUTION GAUSS ELIMINATION & BACK SUBSTITUTION Dayun Yu Seungmuk Ji.
Algorithms April-May 2013 Dr. Youn-Hee Han The Project for the Establishing the Korea ㅡ Vietnam College of Technology in Bac Giang.
Searching and Sorting Techniques 1. To learn and appreciate the following concepts Searching Technique  Linear Search Sorting Technique  Bubble Sort.
Struct 1. Definition: Using struct to define a storage containing different types. For example it can contain int, char, float and array at the same time.
Data Structures Lecture 2: Array Azhar Maqsood NUST Institute of Information Technology (NIIT)
CCSA 221 Programming in C CHAPTER 7 WORKING WITH ARRAYS 1.
Strings program. C Program to Check if a given String is Palindrome #include void main() { char string[25], reverse_string[25] = {'\0'}; int i, length.
Strings program. C Program to Check if a given String is Palindrome #include void main() { char string[25], reverse_string[25] = {'\0'}; int i, length.
Algorithm Analysis Lakshmish Ramaswamy. Insertion Sort Conceptual Logic Create a duplicate array Insert elements from original array into duplicate array.
For Loop Lecture No 8. Definition In computer science a for loop is a programming language statement which allows code to be repeatedly executed. A for.
Tree type graphs ? ? ? ?.  All graph representations plus adapted representations.  Son-Brother representation  N: number of vertices.
Print Row Function void PrintRow(float x[ ][4],int i) { int j; for(j=0;j
Ex2. Tower of Hanio 1/11 Write down a C program to solve the Tower of Hanoi ga me (3 poles and 4 disks) by using CBMC – Hint: you may non-deterministically.
Int fact (int n) { If (n == 0) return 1; else return n * fact (n – 1); } 5 void main () { Int Sum; : Sum = fact (5); : } Factorial Program Using Recursion.
Array Sort. Sort Pass 1 Sort Pass 2 Sort Pass 3.
Examples Lecture L2.2. // Example 1a: Turn on every other segment on 7-seg display #include /* common defines and macros */ #include /* derivative.
生产者一级消费者 二级消费者 1 、写出花坛中有可能出现的食物链,并用 连接植物、动物名 称 2 、试一试, 还可以怎样写, 来表示它们之间的关系呢 ?
。 33 投资环境 3 开阔视野 提升竞争力 。 3 嘉峪关市概况 。 3 。 3 嘉峪关是一座新兴的工业旅游城市,因关得名,因企设市,是长城文化与丝路文化交 汇点,是全国唯一一座以长城关隘命名的城市。嘉峪关关城位于祁连山、黑山之间。 1965 年建市,下辖雄关区、镜铁区、长城区, 全市总面积 2935.
Representing Graphs Depth First Search Breadth First Search Graph Searching Algorithms.
Wordpress est une web application. Pc ou mac Serveur internet Travail on line wix/…. Wordpress est une web application.
GRAPH TRAVERSING BY PROF. UZAIR SALMAN
Asymptotic Notations Dr. Munesh Singh.
Analysis of Non – Recursive Algorithms
Analysis of Non – Recursive Algorithms
2-D Array.
Structura unui calculator
Unit 3 Graphs.
Paxos Made Simple Autor: Puşcaş Radu George
CURSUL 4 ECONOMETRIE TESTUL HI PATRAT.
Traversarea grafurilor. Aplicaţii
studiu de caz – adwords campanie servicii
Algoritmul lui Kruskal
PRELUCRARI SPECIFICE TABLOURILOR BIDIMENSIONALE
Eclipsele de soare si de luna
Counting Loops.
ARBORI BINARI DE CĂUTARE
Programarea in limbajul Java 2004 Lecturer: Gavrila Cristian
Crearea unei aplicatii Windows Forms simple
Example passing the address of x x pint or
Implementarea listelor simplu inlantuite
Auditul de securitate - protecţia proactivă a datelor
Despre lamaie.net De ce sunt lamaile acre? Realizatori: Cristina Cazan
Model arhitectural de reţea
Tabele WEB.
فصل ششم: گراف ها اهداف آشنايي با گراف ماتريس مجاورتي جستجوي گراف
class PrintOnetoTen { public static void main(String args[]) {
Pertemuan Hari ke - 1 Sesi-3.
WANT TO GET TRAINEESHIP ABROAD?
GRAPHS G=<V,E> Adjacent vertices Undirected graph
Algorithms Lakshmish Ramaswamy.
CS Fall 2012, Lab 11 Haohan Zhu.
CS3369 Real Time Control Software/DENG Xiaotie
Problema: resolver un sistema de ecuaciones lineales a11x1 + a12x a1nxn = b1 a21x1 + a22x a2nxn = b an1x1.
Programming Fundamental
컴퓨터 프로그래밍 기초 - 13th : 마지막 수업 -
Presentation transcript:

Parcurgerea grafurilor neorientate Inseamna vizitare nodurilor in vederea prelucrarii informatiilor din fiecare nod. Exista doua moduri de a parcurge un graf:  Parcurgerea in latime (BREATH-FIRST) (BF); PParcurgerea in adancime(DEPTH-FIRST) (DF);

Parcurgerea în „lăţime” Breadth First - BF

1,2,3,4,

#include Int viz[50],c[50] a[50][50],np,n,i,j,u; Void latime(int p) { for(j=1; j<=n ; j++) if ( (viz[ j ]==0)&&(a[c[p]][j])==1) { u++; c[u]=j; viz[j]=1;} if (p<=u) latime(p+1); }

void main() {cout<<“dati numarul de noduri pentru graf”; cin>>n; cout<<“dati matricea de adiacenta ”; for(i=2; i<=n; i++) for(j=1; j<=i-1; j++) { cin >>a[i][j]; a[i][j]=a[j][j];} cout<<“dati nodul de plecare” ; cin>>np; cout<<“dati vectorul de vizitari”; for(i=1; i<=n; i++) viz[i]=0; viz[np]=1; c[i]=np; u=0; latime(1) ; cout<<“parcurgerea este :”; for(i=1;i<=n;i++) cout<<c[i];}