קהילות פורומים, הורדות, יעוץ ותמיכה


אשכולות דומים

  1. עזרה|מימוש הפניות באתר freepremiumaccounts
    על ידי cvbnm בפורום כסף ברשת
    תגובות: 3
    הודעה אחרונה: 15-03-2010, 15:08
  2. [כתבה]ביתור הגופות: חיפושים אחר ראשי הנרצחות
    על ידי MartiNi בפורום פוליטיקה וחדשות
    תגובות: 0
    הודעה אחרונה: 20-08-2009, 22:23
  3. תגובות: 0
    הודעה אחרונה: 29-07-2008, 16:41
  4. [הורדה] רזי דרזים / חיפושים ע"ג ספר התנ"ך. ללא התקנה!
    על ידי hartkhjzetk בפורום תוכנות להורדה
    תגובות: 5
    הודעה אחרונה: 15-05-2008, 22:27
  5. חיפושים אחר בני סלע
    על ידי -Raz- בפורום דיבורים
    תגובות: 15
    הודעה אחרונה: 02-12-2006, 04:08
+ תגובה לנושא
מציג תוצאות 1 עד 2 מתוך 2

[אלגוריתמים]מימוש של חיפושים ב-C עם סיבוכיות זמן ריצה וסדר גודל

  1. #1
    משתמש מתקדם
    תאריך הצטרפות
    07/2005
    גיל
    37
    הודעות
    869
    לייקים
    0
    נקודות
    50
    משפט מחץ
    EVIL will always win, because the GOOD is stupid

    ברירת מחדל [אלגוריתמים]מימוש של חיפושים ב-C עם סיבוכיות זמן ריצה וסדר גודל

    למי שיודע להעריך.

    .
    א. מיון בחירה (by Selection) - selectionSort.cpp>>:

    #include <stdio.h<
    #include <conio.h<
    #include <stdlib.h<

    #define N 6

    void selectionSort(int [], int);

    void main()
    }
    int arr[N] = {5,9,1,2,8,10}; //makes array

    selectionSort(arr,N); //calls selectionSort function
    for (int i=0;i<N;i++) //prints the array
    printf("%4d",arr[i]);
    puts("\n”);

    }

    void selectionSort(int arr[], int size(
    }
    int i, j, min,temp;

    for (i=0;i<size-1;i++)
    }
    min=i;
    for(j=i+1;j<N;j++);
    }
    if (arr[j] < arr[min])
    }
    min=j;
    }
    }
    temp = arr[i]; //makes a swap
    arr[i] = arr[min];
    arr[min] = temp;
    }
    }














































    ב. מיון הכנסה משופר (by Insertion) - <insertionSort.cpp>:

    #include <stdio.h>
    #include <conio.h<
    #include <stdlib.h<

    #define N 6

    void insertionSort(int []);

    void main()
    }
    int arr[N] = {5,9,1,2,8,10}; //makes array

    insertionSort(arr); //calls insertionSort function
    for (int i=0;i<N;i++) //prints the array
    printf("%4d",arr[i]);
    puts("\n”);

    }

    void insertionSort(int arr[])
    }
    int i, j, value;

    for (i=0;i<N-1;i++)
    }
    value =arr[i];
    j = i-1;
    while ((j>=0) && (arr[j] > value))
    }
    arr[j+1] = arr[j];
    j = j-1;
    }
    arr[j+1] = value;
    }
    }











    ג. מיוני החלפה (shellSort, ShakerSort, bubbleSort)
    <shellSort.cpp>:
    #include <stdio.h<
    #include <conio.h<
    #include <stdlib.h<

    #define N 6

    void shellSort(int [], int);

    void main()
    }
    int arr[N] = {5,9,1,2,8,10}; //makes array

    shellSort (arr); //calls insertionSort function
    for (int i=0;i<N;i++) //prints the array
    printf("%4d",arr[i]);
    puts("\n”);

    }

    void shellSort(int arr[], int N)
    }
    int i, j, size, temp;

    size = N/2; //half array

    while (size > 0)
    {
    for (i=size;i<N;i++)
    }
    j=i
    temp = arr[i];
    while ((j>=size) && (arr[j-size] > temp))
    }
    arr[j] = arr[j-size];
    j = j -size;
    } //while
    arr[j] = temp;
    }
    }
    }






    <shakerSort.cpp>:
    #include <stdio.h<
    #include <conio.h<
    #include <stdlib.h<

    #define N 6

    void shakerSort(int [], int);

    void main()
    }
    int arr[N] = {5,9,1,2,8,10}; //makes array

    shakerSort (arr); //calls shakerSort function
    for (int i=0;i<N;i++) //prints the array
    printf("%4d",arr[i]);
    puts("\n”);

    }


    void shakerSort(int arr[], int N)
    }
    int i, bottom=0, top=N-1,temp;
    bool swapped=true;

    while (swapped == true(
    }
    swapped = false;
    for (i=bottom;i<top;i++)
    }
    if (arr[i] > arr[i+1])
    }
    temp = arr[i]; //makes a swap
    arr[i] = arr[i+1];
    arr[i+1] = temp;
    swapped = true; //was a swapped
    }
    }
    top--;
    for (i=top;i>borrom;i--)
    }
    if (arr[i] < arr[i-1])
    }
    temp = arr[i]; //makes a swap
    arr[i] = arr[i-1]:
    arr[i-1] = temp;
    swapped = true; //was a swapped
    }
    }
    bottom++;
    }
    }











































    <bubbleSort.cpp>:
    #include <stdio.h<
    #include <conio.h<
    #include <stdlib.h<

    #define N 6

    void bubbleSort(int []);

    void main()
    }
    int arr[N] = {5,9,1,2,8,10}; //makes array

    bubbleSort (arr); //calls bubbleSort function
    for (int i=0;i<N;i++) //prints the array
    printf("%4d",arr[i]);
    puts("\n”);

    }


    void bubbleSort(int arr[])
    }
    int i, j, temp;

    for (i=1;i<N;i++)
    }
    for (j=N;j>i+1;j--)
    }
    if (arr[j] < arr[j-1])
    }
    temp = arr[j]; //makes a swap
    arr[j] = arr[j-1]j
    arr[j-1] = temp;
    }
    }
    }
    }











  2. קישורים ממומנים

  3. #2
    ThE
    אורח

    ברירת מחדל

    א. מיון בחירה (by Selection):
    קוד:
    <selectionSort.cpp>:
    #include <stdio.h>
    #include <conio.h>
    #include <stdlib.h>
    #define N 6
    void selectionSort(int [], int);
    void main()
    {
      int arr[N] = {5, 9, 1, 2, 8, 10}; //makes array
      selectionSort(arr, N); //calls selectionSort function
      for (int i = 0; i < N; i++) //prints the array
      {
        printf("%4d", arr[i]);
        puts("\n”);
      }
    }
    
    void selectionSort(int arr[], int size)
    {
      int i, j, min, temp;
      for (i = 0; i < size - 1; i++)
      {
        min = i;
        for(j = i + 1; j < N; j++);
          if (arr[j] < arr[min])
            min = j;
        temp = arr[i]; //makes a swap
        arr[i] = arr[min];
        arr[min] = temp;
      }
    }
    ב. מיון הכנסה משופר (by Insertion):
    קוד:
    <insertionSort.cpp>:
    #include <stdio.h>
    #include <conio.h>
    #include <stdlib.h>
    #define N 6
    void insertionSort(int []);
    void main()
    {
      int arr[N] = {5, 9, 1, 2, 8, 10}; //makes array
      insertionSort(arr); //calls insertionSort function
      for (int i = 0; i < N; i++) //prints the array
      {
        printf("%4d", arr[i]);
        puts("\n”);
      }
    }
    void insertionSort(int arr[])
    {
      int i, j, value;
      for (i = 0; i < N - 1; i++)
      {
        value =arr[i];
        j = i - 1;
        while ((j >= 0) && (arr[j] > value))
        {
          arr[j + 1] = arr[j];
          j = j - 1;
        }
        arr[j + 1] = value;
      }
    }
    ג. מיוני החלפה (shellSort, ShakerSort, bubbleSort):
    קוד:
    <shellSort.cpp>:
    #include <stdio.h>
    #include <conio.h>
    #include <stdlib.h>
    #define N 6
    void shellSort(int [], int);
    void main()
    {
      int arr[N] = {5, 9, 1, 2, 8, 10}; //makes array
      shellSort(arr); //calls insertionSort function
      for (int i = 0; i < N; i++) //prints the array
      {
        printf("%4d", arr[i]);
        puts("\n”);
      }
    }
    void shellSort(int arr[], int N)
    {
      int i, j, size, temp;
      size = N / 2; //half array
      while (size > 0)
      {
        for (i = size; i < N; i++)
        {
          j = i
          temp = arr[i];
          while ((j >= size) && (arr[j - size] > temp))
          {
            arr[j] = arr[j - size];
            j = j - size;
          } //while
          arr[j] = temp;
        }
      }
    }
    <shakerSort.cpp>:
    #include <stdio.h>
    #include <conio.h>
    #include <stdlib.h>
    #define N 6
    void shakerSort(int [], int);
    void main()
    {
      int arr[N] = {5, 9, 1, 2, 8, 10}; //makes array
      shakerSort(arr); //calls shakerSort function
      for (int i = 0; i < N; i++) //prints the array
      {
        printf("%4d", arr[i]);
        puts("\n”);
      }
    }
    void shakerSort(int arr[], int N)
    {
      int i, bottom = 0, top = N - 1, temp;
      bool swapped = true;
      while (swapped == true)
      {
        swapped = false;
        for (i = bottom; i < top; i++)
        {
          if (arr[i] > arr[i + 1])
          {
            temp = arr[i]; //makes a swap
            arr[i] = arr[i + 1];
            arr[i+1] = temp;
            swapped = true; //was a swapped
          } 
        } 
        top--;
        for (i = top; i > borrom; i--)
        {
          if (arr[i] < arr[i - 1])
          {
            temp = arr[i]; //makes a swap
            arr[i] = arr[i - 1]:
            arr[i - 1] = temp;
            swapped = true; //was a swapped
          }
        }
        bottom++;
      }
    }
    <bubbleSort.cpp>:
    #include <stdio.h>
    #include <conio.h>
    #include <stdlib.h>
    #define N 6
    void bubbleSort(int []);
    void main()
    {
      int arr[N] = {5, 9, 1, 2, 8, 10}; //makes array
      bubbleSort(arr); //calls bubbleSort function
      for (int i = 0; i < N; i++) //prints the array
      {
        printf("%4d", arr[i]);
        puts("\n”);
      }
    }
    void bubbleSort(int arr[])
    {
      int i, j, temp;
      for (i = 1; i < N; i++)
      {
        for (j = N; j > i + 1; j--)
        {
          if (arr[j] < arr[j - 1])
          {
            temp = arr[j]; //makes a swap
            arr[j] = arr[j - 1];
            arr[j - 1] = temp;
          }
        }
      }
    }

+ תגובה לנושא


הרשאות פרסום

  • אין באפשרותך לפרסם נושאים חדשים
  • אין באפשרותך לפרסם תגובות
  • אין באפשרותך לצרף קבצים
  • אין באפשרותך לערוך את הודעותיך


כל הזמנים הם לפי GMT +3. השעה כרגע היא 23:25.
מופעל על ידי vBulletin™ © גרסה 4.1, 2011 vBulletin Solutions, Inc. כל הזכויות שמורות.
פעילות הגולשים
אומנות וגרפיקה
מוזיקה
ספורט
סדרות טלוויזיה
סרטים וקולנוע
קנייה ומכירה
רשתות חברתיות
הבורר 3
פורומי פנאי ובידור
סרטים
סדרות
משחקים
דיבורים
אקטואליה
בעלי חיים
בדיחות והומור
משחקי ספורט
הבורר
מחשבים וטכנולוגיה
תמיכה טכנית
חומרה ומודינג
תוכנות להורדה
סלולארי וגאדג'טים
רקעים למחשב
ציוד הקפי למחשב
אבטחת מידע
תכנות ובניית אתרים
כסף ברשת
אייפון
בריאות ואורח חיים
כושר ופיתוח גוף
דיאטה
צבא וגיוס
יעוץ מיני
מה שבלב
אומנות הפיתוי
יהדות
מיסטיקה ורוחניות
אתאיזם ודתות

נושאים: 2,449,538 | הודעות: 8,150,120 | משתמשים: 315,603 | המשתמש החדש ביותר: upizijoj | עיצוב גרפי: סטודיו עודד בביוף | קידוד: rellect