Beiträge hinzugefügt, Examensarbeit hinzugefügt, Diagramme hinzugefügt.
This commit is contained in:
parent
d28f0594c2
commit
aa36f85702
216 changed files with 173743 additions and 0 deletions
26
Beiträge/DDI-Vortrag 2/Source/sources/bubblesort.cpp
Normal file
26
Beiträge/DDI-Vortrag 2/Source/sources/bubblesort.cpp
Normal file
|
@ -0,0 +1,26 @@
|
|||
#include <iostream>
|
||||
#include <ostream>
|
||||
using namespace std;
|
||||
|
||||
void bubbleSort(int *array, int length) {
|
||||
int i, j, temp;
|
||||
for(i = length - 1; i > 0; i--) {
|
||||
for(j = 0; j < i; j++) {
|
||||
if(array[j] > array[j+1]) {
|
||||
temp = array[j];
|
||||
array[j] = array[j+1];
|
||||
array[j+1] = temp;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
int main() {
|
||||
int array[10] = {7,9,1,2,3,6,4,5,8,0};
|
||||
bubbleSort(array,10);
|
||||
|
||||
for (int i=0; i < 10; i++) {
|
||||
cout << array[i] << " ";
|
||||
}
|
||||
cout << endl;
|
||||
}
|
24
Beiträge/DDI-Vortrag 2/Source/sources/bubblesort.java
Normal file
24
Beiträge/DDI-Vortrag 2/Source/sources/bubblesort.java
Normal file
|
@ -0,0 +1,24 @@
|
|||
public class bubblesort {
|
||||
public static void bubbleSort(int[] A) {
|
||||
for (int k = 0; k < A.length - 1; k++) {
|
||||
for (int i = 1; i < A.length - k; i++) {
|
||||
if (A[i] < A[i - 1]) {
|
||||
int temp = A[i];
|
||||
A[i] = A[i - 1];
|
||||
A[i - 1] = temp;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public static void main(String[] args) {
|
||||
int[] array = {7,9,1,2,3,6,4,5,8,0};
|
||||
|
||||
bubbleSort(array);
|
||||
|
||||
for(int i=0; i<array.length; i++)
|
||||
System.out.print(array[i] + " ");
|
||||
|
||||
System.out.println("");
|
||||
}
|
||||
}
|
27
Beiträge/DDI-Vortrag 2/Source/sources/bubblesort.pas
Normal file
27
Beiträge/DDI-Vortrag 2/Source/sources/bubblesort.pas
Normal file
|
@ -0,0 +1,27 @@
|
|||
program BubbleSort;
|
||||
{$APPTYPE CONSOLE}
|
||||
uses
|
||||
SysUtils;
|
||||
Procedure BubbleSort(var a: array of Integer, var size: Integer);
|
||||
var i,j,temp: integer;
|
||||
begin
|
||||
for i:=size downto 1 do
|
||||
for j:=1 to i-1 do
|
||||
if a[i]>a[j] then
|
||||
begin
|
||||
temp:=a[i];
|
||||
a[i]:=a[j];
|
||||
a[j]:=temp;
|
||||
end;
|
||||
end;
|
||||
|
||||
begin
|
||||
var A: array [1..10] of Integer:
|
||||
A[1] := 7; A[2] := 9; A[3] := 1; A[4] := 2; A[5] := 3;
|
||||
A[6] := 6; A[7] := 4; A[8] := 5; A[9] := 8; A[10] := 0;
|
||||
|
||||
BubbleSort(A,10);
|
||||
for i:=1 to 10 do
|
||||
write(A[i], " ")
|
||||
writeln("");
|
||||
end.
|
8
Beiträge/DDI-Vortrag 2/Source/sources/bubblesort.prolog
Normal file
8
Beiträge/DDI-Vortrag 2/Source/sources/bubblesort.prolog
Normal file
|
@ -0,0 +1,8 @@
|
|||
bubbleup([X, Y|L], [Y, X|L]) :- X > Y.
|
||||
bubbleup([Z|L], [Z|ZL]) :- bubbleup(L, ZL).
|
||||
|
||||
bubblesort([], []).
|
||||
bubblesort(L, SL) :- bubbleup(L, ZL), !, bubblesort(ZL, SL).
|
||||
bubblesort(SL, SL).
|
||||
|
||||
?-bubblesort([7,9,1,2,3,6,4,5,8,0], SL).
|
9
Beiträge/DDI-Vortrag 2/Source/sources/bubblesort.pseudo
Normal file
9
Beiträge/DDI-Vortrag 2/Source/sources/bubblesort.pseudo
Normal file
|
@ -0,0 +1,9 @@
|
|||
function bubblesort (A : list[1..n])
|
||||
for i from n downto 1
|
||||
for j from 1 to i-1
|
||||
if (A[j] > A[j+1]) then
|
||||
swap(A[j], A[j+1])
|
||||
end if
|
||||
next
|
||||
next
|
||||
end function
|
8
Beiträge/DDI-Vortrag 2/Source/sources/bubblesort.py
Normal file
8
Beiträge/DDI-Vortrag 2/Source/sources/bubblesort.py
Normal file
|
@ -0,0 +1,8 @@
|
|||
def BubbleSort(lst):
|
||||
for passesLeft in range(len(lst)-1, 0, -1):
|
||||
for i in range(passesLeft):
|
||||
if lst[i] > lst[i + 1]:
|
||||
lst[i], lst[i + 1] = lst[i + 1], lst[i]
|
||||
return lst
|
||||
|
||||
print BubbleSort([7,9,1,2,3,6,4,5,8,0]);
|
18
Beiträge/DDI-Vortrag 2/Source/sources/groesse3.py
Executable file
18
Beiträge/DDI-Vortrag 2/Source/sources/groesse3.py
Executable file
|
@ -0,0 +1,18 @@
|
|||
from ponto import Dokument
|
||||
|
||||
dok1=Dokument()
|
||||
cursor=dok1.gibCursor()
|
||||
absatz1=dok1.erzeugeAbsatz("Hallo Welt,")
|
||||
|
||||
# Zurueck zum Anfang
|
||||
zaehler=0
|
||||
while zaehler<=11:
|
||||
cursor.zurueck()
|
||||
zaehler=zaehler+1
|
||||
|
||||
einZeichen=cursor.gibZeichen()
|
||||
while einZeichen.gibSymbol != " ":
|
||||
einZeichen.setzeSchriftgroesse(20)
|
||||
cursor.vor()
|
||||
einZeichen=cursor.gibZeichen()
|
||||
|
Loading…
Add table
Add a link
Reference in a new issue