تقييم الموضوع :
  • 0 أصوات - بمعدل 0
  • 1
  • 2
  • 3
  • 4
  • 5
دورة بلغة Java
#11
هذا الموقع يعمل جيدا معي
شكرا لك اخي
الرد }}}
تم الشكر بواسطة:
#12
السلام عليكم ورحمة الله وبركاته

الحمد لله تم رفع باقي اجزاء الدورة لنفس الموقع

6-جزء6

7-جزء7

8-جزء8

9-جزء9

10-جزء10

تحياتي
الرد }}}
تم الشكر بواسطة: abulayth
#13
الروابط غير شغالة
الرد }}}
تم الشكر بواسطة:
#14
سلام عليكم
ممكن مساعدتي مطلوب برنامج بلغة جافا او حت ب سي هو به علاقة بهياكل بيانات ..يقوم بستخدام طابور (BreadthFirstSearch BFS هي استراتيجية العرض الاول) ادخال عقد .. لو كان اول عقدة 1 ثم 2 و3 و4 مصفوفة جوار
1 0 1 0
1 0 0 0
1 0 1 0
1 0 0 0
ناتج سيكون3 4 2 1
لان طابو يبحث عن البيانات او عقد بالعرض

انا وجدت حل في نت بس في خطا في دالة


package samahrafa_bfs;

import java.util.InputMismatchException;
import java.util.InputMismatchException;
import java.util.LinkedList;
import java.util.Queue;
import java.util.Scanner;

class BFS{
private Queue<Integer> queue;
public void BFS()
{
queue = new LinkedList<>();
}
public void bbfs(int adjacency_matrix[][], int source)
{
int number_of_nodes = adjacency_matrix int[] visited = new int[number_of_nodes + 1];

int i, element;
visited queue.add(source);
while (!queue.isEmpty())
{
element = queue.remove();
i = element;
System.out.print(i + "\t");
while (i <= number_of_nodes)
{
if (adjacency_matrix[element][i] == 1 && visited[i] == 0)
{
queue.add(i);
visited[i] = 1;
}
i++;
} }
}
}
public class Samahrafa_bfs {

/**
* @param args the command line arguments
*/
public static void main(String[] args) {
BFS bfs = new BFS();
int number_no_nodes, source;
Scanner scanner = null;
try
{
System.out.println("Enter the number of nodes in the graph");
scanner = new Scanner(System.in);
number_no_nodes = scanner.nextInt();
int adjacency_matrix[][] = new int[number_no_nodes + 1][number_no_nodes + 1];
System.out.println("Enter the adjacency matrix");
for (int i = 1; i <= number_no_nodes; i++)
for (int j = 1; j <= number_no_nodes; j++)
adjacency_matrix[i][j] = scanner.nextInt();
System.out.println("Enter the source for the graph");
source = scanner.nextInt();
System.out.println("The BFS graph is ");

bfs.bbfs(adjacency_matrix, source);
}
catch (InputMismatchException inputMismatch)
{
System.out.println("Wrong Input Format");
}
scanner.close();
}
}
الرد }}}
تم الشكر بواسطة:
#15
PHP كود :
public static void main(String[] args) {

    
System.out.println("Enter the number of nodes in the graph");
    
Scanner scanner = new Scanner(System.in);
    
int number_no_nodes scanner.nextInt();

    
int adjacency_matrix[][] = new int[number_no_nodes 1][number_no_nodes 1];

    
//--------------------------------------

    
System.out.println("Enter the adjacency matrix");

    for (
int i 1<= number_no_nodesi++)
    {
        for (
int j 1<= number_no_nodesj++)
        {
            
adjacency_matrix[i][j] = scanner.nextInt();
        }
    }

    
//--------------------------------------

    
System.out.println("Enter the source for the graph");
    
int source scanner.nextInt();

    
//--------------------------------------

    
Queue<Integerqueue = new LinkedList<>();

    
int[] visited = new int[number_no_nodes 1];

    
int element;

    
visited[source] = 1;
    
queue.add(source);

    
System.out.println("The BFS graph is ");

    while (!
queue.isEmpty())
    {
        
element queue.remove();

        
System.out.print(element "\t");

        for(
int i=element;i<=number_no_nodes;i++)
        {
            if (
adjacency_matrix[element][i] == && visited[i] == 0)
            {
                
queue.add(i);
                
visited[i] = 1;
            }

        }

    }


الرد }}}
تم الشكر بواسطة:



التنقل السريع :


يقوم بقرائة الموضوع: بالاضافة الى ( 1 ) ضيف كريم