Re: Das neue Auswendig lernen und die neuen Übungen -

// ich schreibe gerade das

void breadth_first_search (int component [1024], int r) {
    int pred [1024];

    pred [r] = r;
    component [r] = r;
}

Ich schreibe jetzt erst die Routine Neighborhood - sie liefert - von Knoten 0 an, was wieder als Parameter übergeben wird, aus der Adjezenzmatrix, das nächste Element.

int neighborhood (int a [N][N], int i, int r) {
    int v = a [i][r];
    return v;
}

/** ich habe es jetzt so gemacht **/

int neighborhood (int a [N][N], int i, int r) {
    int v = a [i][r];
    return v;
}

void breadth_first_search (int a [N][N], int component [1024], int r) {
    int pred [1024];
    int v1;
    int w, v;
    int i;

    for (i = 0;  i < 1024;  i++)
        component [i] = -1;

    pred [r] = r;
    component [r] = r;
    Qput (r);
    while QIsNotEmpty () {
        v = Qget ();
        for (v1 = 0;  w = neighborhood (a, r, v1);  v1++) {
            if pred [w] == -1 {
                pred [w] = v;
                component [w] = component [v];
                Qput (w);
            }
        }
    }

}

OK, diese Routine scheint so zu funktionieren

void Qput (int v) {
    Q [Qtop] = v;
    Qtop ++;
}

int Qget (void) {
    int v = Q [Qbottom];
    Qbottom++;
return v;
}

int QIsNotEmpty () {
    return (Qbottom < Qtop);
}

void breadth_first_search (int a [N][N], int component [1024], int r) {
    int pred [1024];
    int w, v;
    int i;

    for (i = 0;  i < 1024;  i++) {
        pred [i] = -1;
        component [i] = -1;
    }

    pred [r] = r;
    component [r] = r;
    Qput (r);

    while (QIsNotEmpty ()) {
        v = Qget ();
        for (w = 0; w < N;  w++) {
            if (a [v][w]) {
                if (pred [w] == -1) {
                    pred [w] = v;
                    component [i++] = v;
                    Qput (w);
                    printf ("%in", w);
                }
            }
        }
    }

}

3
5
6
1
2
4

<!-- https://phpbb3.ituenix.de/viewtopic.php?p=2454\&amp;sid=aff5a2bafb1c5d83860886bbeb7bce0a#p2454 -->
<?php
session_start ();
?>

<form method="POST" action="./form20240427.php">
<input type="text" name="form20240427a"></input>
<input type="submit">
</form>

<?php
echo session_id () . "<br>n";

setcookie ("form20240427b", "Ich bin das zweite Cookie", time () + 3600);

echo htmlentities (\$_POST ["form20240427a"]) . "<br>n";
echo htmlentities (\$_COOKIE ["form20240427b"]) . "<br>n";
echo htmlentities (\$_COOKIE ["form20240427c"]) . "<br>n";

session_destroy ();
?>

Trying ::1...
Connected to localhost.
Escape character is '\^]'.
HTTP/1.1 200 OK
Date: Sat, 27 Apr 2024 06:43:07 GMT
Server: Apache/2.4.57 (Debian)
Set-Cookie: PHPSESSID=ukg56qr0hu25ev1u7g8tp1aqee; path=/
Expires: Thu, 19 Nov 1981 08:52:00 GMT
Cache-Control: no-store, no-cache, must-revalidate
Pragma: no-cache
Set-Cookie: form20240427b=Ich%20bin%20das%20zweite%20Cookie; expires=Sat, 27 Apr 2024 07:43:07 GMT; Max-Age=3600
Vary: Accept-Encoding
Content-Length: 232
Content-Type: text/html; charset=UTF-8

<form method="POST" action="./form20240427.php">
<input type="text" name="form20240427a"></input>
<input type="submit">
</form>

ukg56qr0hu25ev1u7g8tp1aqee<br>
Hallo, ich bin das Datum<br>
<br>
Hallo, ich bin das zweite Cookie<br>

POST http://localhost/mysql20240217/20240427/form20240427.php HTTP/1.1
host: localhost
Cookie: form20240427c=Hallo, ich bin das zweite Cookie
Content-Length: 38
Content-Type: application/x-www-form-urlencoded

form20240427a=Hallo, ich bin das Datum

0, 0; 0, 1; 1, 0; 1, 1; 2, 7; <br>
0, 1; 1, 0; 2, 7; <br>
0, 0, 0, 1; 0, 1, 0, 1; 1, 0, 1, 0; 1, 1, 1, 0; 2, 7, 2, 7; <br>

<?php
session_start ();

include ("/home/david/mysqldata.php");

\$db = new PDO ("mysql: host=localhost", \$MYSQL_USER, \$MYSQL_PASSWORD);

\$sql = "CREATE DATABASE m20240427" . session_id () . "; ";
\$db->query (\$sql);

\$sql = "USE m20240427" . session_id () . "; ";
\$db->query (\$sql);

\$sql = "CREATE TABLE a (x1 INTEGER, x2 INTEGER); CREATE TABLE b (y1 INTEGER, y2 INTEGER); ";
\$db->query (\$sql);

\$sql = "INSERT INTO a (x1, x2) VALUES (0, 0); ";
\$db->query (\$sql);

\$sql = "INSERT INTO a (x1, x2) VALUES (0, 1); ";
\$db->query (\$sql);

\$sql = "INSERT INTO a (x1, x2) VALUES (1, 0); ";
\$db->query (\$sql);

\$sql = "INSERT INTO a (x1, x2) VALUES (1, 1); ";
\$db->query (\$sql);

\$sql = "INSERT INTO a (x1, x2) VALUES (2, 7); ";
\$db->query (\$sql);

\$sql = "INSERT INTO b (y1, y2) VALUES (0, 1); ";
\$db->query (\$sql);

\$sql = "INSERT INTO b (y1, y2) VALUES (1, 0); ";
\$db->query (\$sql);

\$sql = "INSERT INTO b (y1, y2) VALUES (2, 7); ";
\$db->query (\$sql);

\$sql = "SELECT x1, x2 FROM a; ";
\$stmt = \$db->query (\$sql);
while (\$row = \$stmt -> fetch ())
    echo \$row [0] . ", " . \$row [1] . "; ";
echo "<br>n";

\$sql = "SELECT y1, y2 FROM b; ";
\$stmt = \$db->query (\$sql);
while (\$row = \$stmt -> fetch ())
    echo \$row  [0] . ", " . \$row [1] . "; ";
echo "<br>n";

\$sql = "SELECT x1, x2, y1, y2 FROM a INNER JOIN b ON a.x1 = b.y1; ";
\$stmt = \$db->query (\$sql);
while (\$row = \$stmt -> fetch ())
    echo \$row [0] . ", " . \$row [1] . ", " . \$row [2] . ", " . \$row [3] . "; ";
echo "<br>n";

\$sql = "DROP DATABASE m20240427" . session_id () . "; ";
\$db->query (\$sql);

session_destroy ();
?>

Ich habe einen Fehler festgestellt, bei der Adjanzenzmatrix - wenn (A,B) Element ist, dann ist auch (B,A) Element. Das ist logisch.

// Ich habe das jezt so gemacht

void generate_adjanzenzmatrix (int a [N][N], int n) {
    int i, j;

    for (i = 0;  i < n;  i++) {
        for (j = 0;  j < n;  j++) {
            a [i][j] = -1;
        }
    }

    for (i = 0;  i < n;  i++) {
        for (j = 0;  j < n;  j++) {
            if ((a [i][j] == -1) \&amp;\&amp; (a [j][i] == -1)) {
                a[j][i] = a [i][j] = rand () % 2;
            }
        }
    }
}

Image Screenshot_20240429_113242

<?php
session_start ();
?>

<form method="POST" action="./form20240429.php">
<input type="text" name="form20240429a"></input>
<input type="submit">
</form>

<?php
echo session_id () . "<br>n";

setcookie ("form20240429b", "Hallo, ich bin das erste Keks", time () + 3600);

echo htmlentities (\$_POST ["form20240429a"]) . "<br>n";
echo htmlentities (\$_COOKIE ["form20240429b"]) . "<br>n";
echo htmlentities (\$_COOKIE ["form20240429c"]) . "<br>n";

session_destroy ();
?>

POST http://localhost/mysql20240217/20240429/form20240429.php HTTP/1.1
host: localhost
Cookie: form20240429c=Ich bin der Nachschub an Keksen
Content-Length: 42
Content-Type: application/x-www-form-urlencoded

form20240429a=Ich bin wie gesagt, das Date

Trying ::1...
Connected to localhost.
Escape character is '\^]'.
HTTP/1.1 200 OK
Date: Mon, 29 Apr 2024 09:38:36 GMT
Server: Apache/2.4.57 (Debian)
Set-Cookie: PHPSESSID=m80bdrp8v5j7k39k76m78k171r; path=/
Expires: Thu, 19 Nov 1981 08:52:00 GMT
Cache-Control: no-store, no-cache, must-revalidate
Pragma: no-cache
Set-Cookie: form20240429b=Hallo%2C%20ich%20bin%20das%20erste%20Keks; expires=Mon, 29 Apr 2024 10:38:36 GMT; Max-Age=3600
Vary: Accept-Encoding
Content-Length: 235
Content-Type: text/html; charset=UTF-8

<form method="POST" action="./form20240429.php">
<input type="text" name="form20240429a"></input>
<input type="submit">
</form>

m80bdrp8v5j7k39k76m78k171r<br>
Ich bin wie gesagt, das Date<br>
<br>
Ich bin der Nachschub an Keksen<br>

host: localhost
Cookie: form20240429c=Ich bin der Nachschub an Keksen
Content-Length: 42
Content-Type: application/x-www-form-urlencoded

form20240429a=Ich bin wie gesagt, das Date

<?php
session_start ();

include ("/home/david/mysqldata.php");

\$db = new PDO ("mysql: host=localhost", \$MYSQL_USER, \$MYSQL_PASSWORD);

\$sql = "CREATE DATABASE q20240429" . session_id () . "; ";
\$db->query (\$sql);

\$sql = "USE q20240429" . session_id () . "; ";
\$db->query (\$sql);

\$sql = "CREATE TABLE a (x INTEGER); CREATE TABLE b (x INTEGER); CREATE TABLE c (x INTEGER); ";
\$db->query (\$sql);

for (\$i = 0;  \$i < 24;  \$i++) {
    \$sql = "INSERT INTO a (x) VALUES (" . rand () % 32 . "); ";
    \$sql .= "INSERT INTO b (x) VALUES (" . rand () % 64 . "); ";
    \$sql .= "INSERT INTO c (x) VALUES (" . rand () % 128 . "); ";
    \$db->query (\$sql);
}

\$sql = "SELECT x FROM (SELECT x FROM a UNION SELECT x FROM b) x; ";
\$stmt = \$db->query (\$sql);
while (\$row = \$stmt -> fetch ())
    echo \$row [0] . ", ";
echo "<br>n";

\$sql = "SELECT x FROM (SELECT x FROM a UNION SELECT x FROM c) x; ";
\$stmt = \$db->query (\$sql);
while (\$row = \$stmt -> fetch ())
    echo \$row [0] . ", ";
echo "<br>n";

\$sql = "SELECT x FROM (SELECT x FROM b UNION SELECT x FROM c) x; ";
\$stmt = \$db->query (\$sql);
while (\$row = \$stmt -> fetch ())
    echo \$row [0] . ", ";
echo "<br>n";

\$sql = "SELECT x FROM (SELECT x FROM a INTERSECT SELECT x FROM b) x; ";
\$stmt = \$db->query (\$sql);
while (\$row = \$stmt -> fetch ())
    echo \$row [0] . ", ";
echo "<br>n";

\$sql = "SELECT x FROM (SELECT x FROM a INTERSECT SELECT x FROM c) x; ";
\$stmt = \$db->query (\$sql);
while (\$row = \$stmt -> fetch ())
    echo \$row [0] . ", ";
echo "<br>n";

\$sql = "SELECT x FROM (SELECT x FROM b INTERSECT SELECT x FROM c) x; ";
\$stmt = \$db->query (\$sql);
while (\$row = \$stmt -> fetch ())
    echo \$row [0] . ", ";
echo "<br>n";

\$sql = "SELECT x FROM (
            SELECT x FROM (SELECT x FROM a UNION SELECT x FROM b) x
                INTERSECT
            SELECT x FROM c
    ) x ORDER BY x; ";
\$stmt = \$db->query (\$sql);
while (\$row = \$stmt -> fetch ())
    echo \$row [0] . ", ";
echo "<br>n";

\$sql = "SELECT x FROM (
            SELECT x FROM (SELECT x FROM a INTERSECT SELECT x FROM c) x
                UNION
            SELECT x FROM (SELECT x FROM b INTERSECT SELECT x FROM c) x
    ) x ORDER BY x; ";
\$stmt = \$db->query (\$sql);
while (\$row = \$stmt -> fetch ())
    echo \$row [0] . ", ";
echo "<br>n";

\$sql = "SELECT x FROM (
            SELECT x FROM (SELECT x FROM a UNION SELECT x FROM c) x
                INTERSECT
            SELECT x FROM b
    ) x ORDER BY x; ";
\$stmt = \$db->query (\$sql);
while (\$row = \$stmt -> fetch ())
    echo \$row [0] . ", ";
echo "<br>n";

\$sql = "SELECT x FROM (
            SELECT x FROM (SELECT x FROM a INTERSECT SELECT x FROM b) x
                UNION
            SELECT x FROM (SELECT x FROM b INTERSECT SELECT x FROM c) x
    ) x ORDER BY x; ";
\$stmt = \$db->query (\$sql);
while (\$row = \$stmt -> fetch ())
    echo \$row [0] . ", ";
echo "<br>n";

\$sql = "SELECT x FROM (
            SELECT x FROM (SELECT x FROM b UNION SELECT x FROM c) x
                INTERSECT
            SELECT x FROM a
    ) x ORDER BY x; ";
\$stmt = \$db->query (\$sql);
while (\$row = \$stmt -> fetch ())
    echo \$row [0] . ", ";
echo "<br>n";

\$sql = "SELECT x FROM (
            SELECT x FROM (SELECT x FROM a INTERSECT SELECT x FROM b) x
                UNION
            SELECT x FROM (SELECT x FROM c INTERSECT SELECT x FROM a) x
    ) x ORDER BY x; ";
\$stmt = \$db->query (\$sql);
while (\$row = \$stmt -> fetch ())
    echo \$row [0] . ", ";
echo "<br>n";

\$sql = "DROP DATABASE q20240429" . session_id () . "; ";
\$db->query (\$sql);

session_destroy ();
?>

0, 11, 31, 4, 13, 22, 23, 24, 18, 17, 2, 3, 14, 6, 12, 26, 15, 48, 47, 27, 61, 55, 7, 54, 38, 33, 53, 44, 46, <br>
0, 11, 31, 4, 13, 22, 23, 24, 18, 17, 2, 3, 14, 6, 12, 26, 15, 55, 38, 88, 114, 116, 122, 29, 105, 61, 32, 60, 19, 81, 8, 68, 103, 111, 10, <br>
48, 0, 47, 4, 27, 61, 55, 7, 54, 38, 26, 33, 53, 18, 17, 14, 44, 46, 11, 88, 114, 116, 122, 29, 105, 32, 60, 19, 81, 8, 68, 103, 111, 10, <br>
0, 11, 4, 18, 17, 14, 26, <br>
4, 17, <br>
4, 61, 55, 38, 17, <br>
4, 17, 38, 55, 61, <br>
4, 17, 38, 55, 61, <br>
0, 4, 11, 14, 17, 18, 26, 38, 55, 61, <br>
0, 4, 11, 14, 17, 18, 26, 38, 55, 61, <br>
0, 4, 11, 14, 17, 18, 26, <br>
0, 4, 11, 14, 17, 18, 26, <br>

Image IMG_20240429_142517

Image IMG_20240429_143043

Image IMG_20240429_143337

Image IMG_20240429_143339

Image IMG_20240429_143545

Image IMG_20240429_144059

Image IMG_20240429_144339

Image IMG_20240429_144917

Image IMG_20240429_145754

Image IMG_20240429_145758

Image IMG_20240429_145802

1.) Rechne die Zahl in binaer Darstellung  in eine Dezimale Darstellung um
0101111101001011b 24395d
2.) Rechne die Zahl in dezimal darstellung in eine Binaerdarstellung um
13982 0011011010011110
3.) Addiere die drei Zahlen schriftlich
             8868
+           56333
+           35842
-----------------
           101043
4.) Subtrahiere die letzten drei Zahlen schriftlich von der ersten schriftlich
            62008
-             962
-           15254
-           14618
-----------------
            31174
5.) Rechne die Zahl ins zweier komplement um, mit 8 Bit - und subtrahiere diese zahl von der ersten und rechne das Ergebnis nach dezimal
105 -75 = 30
01101001 10110101 = 00011110
6.) Multipliziere die zwei Zahlen schriftlich
30321*7569 = 229499649
7.) Dividiere die zwei Zahlen schriftlich
63756/53440 = 1
8.) Errechne x Logarithmisch mit dem Taschenrechner
24435\^x = 1497504004
Rechne die Zahl in IEEE-754 um 10321.125977

Image 18LNZx1KRE7K_Qi322QnEE0_cX-C2nWPb

Image 18EvI0xDrzx2lmXTU4esU06epDr__kRw2

Image 18TsOBGXiqaTvnNLGbSnJ0mKxDYqodmWw

Image 18IWdVDXHvpREntx11nkXwe6US1FeLtkR

Image 18QBTgbof2ygG2TiYPJw0_of-hE95ueOP

Image 18P4_YjmmBVFg3zvzzFAfRG_ROJyBmsvo

Jetzt Mathematik

Image 18tku1YVLoACE21NWUsfiBPp2DlQzuAe0

Image 18WkQ8BTy5VkjxRbY0I78RuJlxSTWIyho

Image 18XWBEJjUyiNy6YSwj5VGh9qPdNGsZbKB

Image 18c5hFWopYS0TYRS26drP8E-KqYJxhgdb

Image 18XbWiYmGBK7fFbbOCFlTMjF89mxwX00M

Image 18rxeC2_MXnKUhd4cFigtGBFnk3c7e225

Image 18_kgr1AEu_3fTQMnbWZGG664gmXp9wXR

Image 18oWZoXJpL66DNBv7HBdjkKb9b3bnYzRe

Image 18ZO43RoLUe1zNNyZeQfytlG6NDP53Pmn

Image 18qVVM48gXJRISIY1oAAWxoBlihznrTgY