Hallo, das ginge so:

//-------CONFIGURATION
name: Schiebe erste 1 nach rechts
init: q0
accept: q5

q0,0
q0,0,>

q0,1
q1,1,>

// End state
q0,_
q5,_,-

q1,1
q1,1,>

q1,0
q2,0,<

// End state
q1,_
q5,_,-

q2,1
q2,1,<

q2,0
q3,0,>

q2,_
q3,_,>

q3,0
q3,0,>

q3,1
q4,0,>

q4,1
q4,1,>

// End state
q4,0
q5,1,-

Du kannst es zum Beispiel hier ausprobieren: https://turingmachinesimulator.com/ und solltest noch weitere Kommentare hinzufügen...

...zur Antwort

2) Wenn Anastasia den Most holt wird es bald etwas zu trinken geben und das Abendessen wird beginnen vorausgesetzt dass Bartholm¨aus das Brot schon gebacken hat.

a = Anastasia holt den Most
b = Es gibt bald zu trinken
c = Abendessen beginnt
d = Bartholm hat das Brot gebacken

(a -> b) ^ ((a ^ d) -> c)

Das steht da und es lässt sich etwas vereinfachen:

(!b v a) ^ (!c v (a ^ d))
= (!b v a) ^ (!c v a) ^ (!c v d)
= !b^!c v a^!c v a^d (DNF)

(Regeln, siehe hier)

... Und dann steht dort: Entweder, es gibt nichts zu trinken und kein Abendessen, oder Anastasia hat den Most geholt und es gibt kein Abendessen, oder Anastasia hat den Most geholt und Bartholm hat das Brot gebacken.

Wenn die Frage ist, wann kann es etwas zu trinken geben, dann ist die Antwort, zum Beispiel, wenn Anastasia den Most geholt hat (es kann ja auch jemand anderes den Most geholte haben) Und wann kann es Abendessen geben, dann ist die Antwort, zum Beispiel, wenn Anastasia den Most geholt hat und Bartholm das Brot gebacken hat (natürlich kann auch jemand anderes den Most und das Brot beschafft haben)

Der erste Teil der Implikation ist ein Indiz für den zweiten Teil, aber der zweite Teil kann auch ohne den ersten erfüllt sein...

Tabelle:

  A B C D  │  (¬B ∨ A) ∧ (¬C ∨ (A ∧ D))
  ─────────┼───────────────────────────
  1 1 1 1  │  1
  1 1 1 0  │  0
  1 1 0 1  │  1
  1 1 0 0  │  1
  1 0 1 1  │  1
  1 0 1 0  │  0
  1 0 0 1  │  1
  1 0 0 0  │  1
  0 1 1 1  │  0
  0 1 1 0  │  0
  0 1 0 1  │  0
  0 1 0 0  │  0
  0 0 1 1  │  0
  0 0 1 0  │  0
  0 0 0 1  │  1
  0 0 0 0  │  1
...zur Antwort

Du kannst es auch mit einem Tool testen:
https://ivanzuzak.info/noam/webapps/fsm_simulator/

Der reguläre Ausdruck des DFA sieht so aus:
(a+b)*aabab

Der DFA sieht so aus:

Bild zum Beitrag

Die zu testende Eingabe ist:
aaababaabaababaab

Bei dieser Eingabe kommt es nicht vor, dass von Zustand 1 auf 0 gewechselt wird, obwohl dies durchaus möglich wäre.

Mit der Eingabe: abaabab würde zum Beispiel am Anfang von Zustand 1 nach 0 gewechselt werden. :)

...zur Antwort

Das Array A soll durch wiederholtes Einfügen des nächsten Elements sortiert werden, und ist jeweils bis zum Index j bereits sortiert.

Die innere Schleife läuft so lange, bis die richtige Einfügeposition gefunden wurde.

Dazu startet i mit dem höchsten Wert/Position (also dem Ende des bereit sortierten Teils) und wird nach jedem Schleifendurchlauf einmal dekrementiert. (Zeile 7)

Sie stoppt, wenn das erste Element gefunden wurde, das <= key ist, und an dieser Position kann dann eingefügt werden.

Danach ist das Array A komplett aufsteigend sortiert.

...zur Antwort
HTML und CSS Frage?

Hallo,

ich möchte die Grüne und gelbe Kärtchen im zweiten <section> nach oben in die MITTE schieben. Jedoch hakt es bisschen bei mir. Zudem müssen wir nur Flexbox benutzen das heisst kein margin oder position etc....

HTML_CODE:

<!DOCTYPE html>

<html lang="en">

<head>

  <meta charset="UTF-8">

  <meta name="viewport" content="width=device-width, initial-scale=1.0">

  <title>Flexbox</title>

  <link rel="stylesheet" href="../CSS/style.css">

</head>

<body>

  <header>

    <div class="layout2">

 <nav>

    <div class="container">

      <ul>

        <li>

          <a class="item1" href="#">LOGO</a>

          <a class="item" href="#">Menu 1</a>

          <a class="item" href="#">Menu 2</a>

          <a class="item" href="#">Menu 3</a>

          <a class="item2" href="#">Button</a>

        </li>

      </ul>

    </div>

  </nav>

 

</div>

</header>

<main>

  <div class="layout4">

  <section>

   

 

    <div class="laayout2">

     

      <div class="brownhelp"><div class="brownbox"></div></div>

      <div class="sectionone">

        <div class="content1">

          <div class="border"></div>

    <div class="border1"></div>

    <div class="border2"></div>

    <div class="border3"></div>

    <div class="border4"></div>

        </div>

  </div>

</div>

</section>

<section>

    <div class="laayout3">

  <div class="sectiontwo">

      <div class="content2">

        <div class="box"></div>

        <div class="box2"></div>

        <div class="box3"></div>

        <div class="box4"></div>

       

      </div>

    </div>

    </div>

</section>

</div>

</main>

</body>

</html>

CSS_CODE:

*{

  margin: 0;

  box-sizing: border-box;

}

header {

  background-color: #cae1fc;;

}

.layout2 {

  display: flex;

  align-items: center;

  justify-content: space-around;

  flex-direction: column;

}

.container {

  height: 150px;

  width: 1425px;

  background-color:rgb(80, 98, 104);

  display: flex;

  justify-content: space-around;

  align-items: center;

}

div ul {

  width: 100%;

}

div li {

  display: flex;

   justify-content: space-around;

   align-items:center;

  list-style: none;

}

.item {

  background-color: rgb(39, 185, 171);

  width: 120px;

  height: 50px;

  color: #fff;

  font-weight: bold;

  font-family: 'Franklin Gothic Medium', 'Arial Narrow', Arial, sans-serif;

  font-size: large;

  display: flex;

  justify-content: center;

  flex-direction: column;

  text-align: center;

  text-decoration: none;

 

}

.item1 {

  background-color: rgb(193, 67, 67);

  width: 115px;

  height: 50px;

  color: #fff;

  font-weight: bold;

  font-family: 'Franklin Gothic Medium', 'Arial Narrow', Arial, sans-serif;

  font-size: large;

  display: flex;

  justify-content: center;

  flex-direction: column;

  text-align: center;

  text-decoration: none;

}

.item2 {

  background-color: rgb(112, 29, 189);

  width: 80px;

  height: 90px;

  color: #fff;

  font-weight: bold;

  font-family: 'Franklin Gothic Medium', 'Arial Narrow', Arial, sans-serif;

  font-size: small;

  display: flex;

  text-align: center;

  justify-content: center;

  flex-direction: column;

  text-decoration: none;

}

.layout2 > nav {

  height: 100vh;

}

nav {

  display: flex;

  align-items: flex-end;

  max-height: 170px;

}

/**/

.layout4 {

  background-color: #cae1fc;

}

.laayout2 {

  height: 1000px;

  display: flex;

  justify-content:space-around;

}

.sectionone {

  display: flex;

  justify-content: center;

  align-items: flex-end;

  max-height: 345px;

  width: 270px;

 

}

.content1 {

  display: flex;

  flex-direction: column;

  align-items: flex-end;

  gap: 20px;

  background-color: #cae1fc;;

}

.border {

  background-color: #fff;

  width: 225px;

  height: 45px;

 

}

.border1 {

  background-color: #fff;

  width: 225px;

  height: 45px;

}

.border2 {

  background-color: #fff;

  width: 225px;

  height: 45px;

 

}

.border3 {

  background-color: #fff;

  width: 225px;

  height: 45px;

 

}

.border4 {

  background-color: #fff;

  width: 225px;

  height: 45px;

}

.brownhelp {

  display: flex;

  align-items: flex-end;

  justify-content: center;

  max-height: 345px;

  width: 1200px;

}

.brownbox {

  background-color: burlywood;

  width: 1150px;

  height: 305px;

 

}

/*YELLOW*/

.laayout3 {

  display: flex;

  justify-content: space-around;

  align-items: flex-start;

  height: auto;

 

}

.sectiontwo {

  display: flex;

  width: 800px;

  justify-content: space-around;

  align-items: center;

}

.content2 {

  display: flex;

  justify-content: space-around;

  gap: 200px;

}

.box {

  background-color: yellow;

  width: 200px;

  height: 190px;

}

.box2 {

  background-color: green;

  width: 200px;

  height: 190px;

}

.box3 {

  background-color: yellow;

  width: 200px;

  height: 190px;

}

.box4 {

  background-color: green;

  width: 200px;

  height: 190px;

}

...zur Frage

Hallo, ich habe deinen Code mal aufgeräumt und das CSS direkt in das HTML eingebunden.

Du brauchst dafür auf jeden Fall ein kleines JavaScript-Schnippsel ...

<!DOCTYPE html>
<html lang="en">
  <head>
    <meta charset="UTF-8" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0" />
    <title>Flexbox</title>
    <!-- <link rel="stylesheet" href="../CSS/style.css"> -->
    <style>
      * {
        margin: 0;
        box-sizing: border-box;
      }
      header {
        background-color: #cae1fc;
      }
      .layout2 {
        display: flex;
        align-items: center;
        justify-content: space-around;
        flex-direction: column;
      }
      .container {
        height: 150px;
        width: 1425px;
        background-color: rgb(80, 98, 104);
        display: flex;
        justify-content: space-around;
        align-items: center;
      }
      div ul {
        width: 100%;
      }
      div li {
        display: flex;
        justify-content: space-around;
        align-items: center;
        list-style: none;
      }
      .item {
        background-color: rgb(39, 185, 171);
        width: 120px;
        height: 50px;
        color: #fff;
        font-weight: bold;
        font-family: "Franklin Gothic Medium", "Arial Narrow", Arial, sans-serif;
        font-size: large;
        display: flex;
        justify-content: center;
        flex-direction: column;
        text-align: center;
        text-decoration: none;
      }
      .item1 {
        background-color: rgb(193, 67, 67);
        width: 115px;
        height: 50px;
        color: #fff;
        font-weight: bold;
        font-family: "Franklin Gothic Medium", "Arial Narrow", Arial, sans-serif;
        font-size: large;
        display: flex;
        justify-content: center;
        flex-direction: column;
        text-align: center;
        text-decoration: none;
      }
      .item2 {
        background-color: rgb(112, 29, 189);
        width: 80px;
        height: 90px;
        color: #fff;
        font-weight: bold;
        font-family: "Franklin Gothic Medium", "Arial Narrow", Arial, sans-serif;
        font-size: small;
        display: flex;
        text-align: center;
        justify-content: center;
        flex-direction: column;
        text-decoration: none;
      }
      .layout2 > nav {
        height: 100vh;
      }
      nav {
        display: flex;
        align-items: flex-end;
        max-height: 170px;
      }
      /**/
      .layout4 {
        background-color: #cae1fc;
      }
      .laayout2 {
        height: 1000px;
        display: flex;
        justify-content: space-around;
      }
      .sectionone {
        display: flex;
        justify-content: center;
        align-items: flex-end;
        max-height: 345px;
        width: 270px;
      }
      .content1 {
        display: flex;
        flex-direction: column;
        align-items: flex-end;
        gap: 20px;
        background-color: #cae1fc;
      }
      .border {
        background-color: #fff;
        width: 225px;
        height: 45px;
      }
      .border1 {
        background-color: #fff;
        width: 225px;
        height: 45px;
      }
      .border2 {
        background-color: #fff;
        width: 225px;
        height: 45px;
      }
      .border3 {
        background-color: #fff;
        width: 225px;
        height: 45px;
      }
      .border4 {
        background-color: #fff;
        width: 225px;
        height: 45px;
      }
      .brownhelp {
        display: flex;
        align-items: flex-end;
        justify-content: center;
        max-height: 345px;
        width: 1200px;
      }
      .brownbox {
        background-color: burlywood;
        width: 1150px;
        height: 305px;
      }
      /*YELLOW*/
      .laayout3 {
        display: flex;
        justify-content: space-around;
        align-items: flex-start;
        height: auto;
      }
      .sectiontwo {
        display: flex;
        width: 800px;
        justify-content: space-around;
        align-items: center;
      }
      .content2 {
        display: flex;
        justify-content: space-around;
        gap: 200px;
      }
      .box {
        background-color: yellow;
        width: 200px;
        height: 190px;
      }
      .box2 {
        background-color: green;
        width: 200px;
        height: 190px;
      }
      .box3 {
        background-color: yellow;
        width: 200px;
        height: 190px;
      }
      .box4 {
        background-color: green;
        width: 200px;
        height: 190px;
      }
    </style>
  </head>
  <body>
    <header>
      <div class="layout2">
        <nav>
          <div class="container">
            <ul>
              <li>
                <div class="draggable" draggable="true"><a class="item" href="#">LOGO</a></div>
                <div class="draggable" draggable="true"><a class="item" href="#">Menu 1</a></div>
                <div class="draggable" draggable="true"><a class="item" href="#">Menu 2</a></div>
                <div class="draggable" draggable="true"><a class="item" href="#">Menu 3</a></div>
                <div class="draggable" draggable="true"><a class="item" href="#">Button</a></div>
              </li>
            </ul>
          </div>
        </nav>
      </div>
    </header>
    <main>
      <div class="layout4">
        <div class="laayout2">
          <div class="brownhelp">
            <div class="brownbox" id="droptarget0">
              <nav>
                <div class="container">
                  <ul>
                    <li id="droptarget1"></li>
                  </ul>
                </div>
              </nav>
            </div>
          </div>
          <div class="sectionone">
            <div class="content1">
              <div class="border"></div>
              <div class="border1"></div>
              <div class="border2"></div>
              <div class="border3"></div>
              <div class="border4"></div>
            </div>
          </div>
        </div>
        <div class="laayout3">
          <div class="sectiontwo">
            <div class="content2">
              <div class="box"></div>
              <div class="box2"></div>
              <div class="box3"></div>
              <div class="box4"></div>
            </div>
          </div>
        </div>
      </div>
    </main>
    <script>
      let dragged = null;

      const items = document.getElementsByClassName("draggable");
      for (let i = 0; i < items.length; i++) {
        items[i].addEventListener("dragstart", (event) => {
          dragged = event.target;
        });
      }

      const target = document.getElementById("droptarget0");
      target.addEventListener("dragover", (event) => {
        // prevent default to allow drop
        event.preventDefault();
      });
      target.addEventListener("drop", (event) => {
        // prevent default action (open as link for some elements)
        event.preventDefault();
        if (event.target.id === "droptarget0") {
          dragged.parentNode.removeChild(dragged);
          document.getElementById("droptarget1").appendChild(dragged);
        }
      });
    </script>
  </body>
</html>

Weiteres dazu dann hier: https://developer.mozilla.org/en-US/docs/Web/API/HTMLElement/drop_event

...zur Antwort
Weitere Inhalte können nur Nutzer sehen, die bei uns eingeloggt sind.