yeet
This commit is contained in:
Generated
+1
-1
@@ -3,7 +3,7 @@
|
|||||||
<properties maven-id="org.openjfx:javafx-base:20-ea+2" />
|
<properties maven-id="org.openjfx:javafx-base:20-ea+2" />
|
||||||
<CLASSES>
|
<CLASSES>
|
||||||
<root url="jar://$MAVEN_REPOSITORY$/org/openjfx/javafx-base/20-ea+2/javafx-base-20-ea+2.jar!/" />
|
<root url="jar://$MAVEN_REPOSITORY$/org/openjfx/javafx-base/20-ea+2/javafx-base-20-ea+2.jar!/" />
|
||||||
<root url="jar://$MAVEN_REPOSITORY$/org/openjfx/javafx-base/20-ea+2/javafx-base-20-ea+2-linux.jar!/" />
|
<root url="jar://$MAVEN_REPOSITORY$/org/openjfx/javafx-base/20-ea+2/javafx-base-20-ea+2-win.jar!/" />
|
||||||
</CLASSES>
|
</CLASSES>
|
||||||
<JAVADOC />
|
<JAVADOC />
|
||||||
<SOURCES />
|
<SOURCES />
|
||||||
|
|||||||
+3
-3
@@ -3,11 +3,11 @@
|
|||||||
<properties maven-id="org.openjfx:javafx-controls:22-ea+16" />
|
<properties maven-id="org.openjfx:javafx-controls:22-ea+16" />
|
||||||
<CLASSES>
|
<CLASSES>
|
||||||
<root url="jar://$MAVEN_REPOSITORY$/org/openjfx/javafx-controls/22-ea+16/javafx-controls-22-ea+16.jar!/" />
|
<root url="jar://$MAVEN_REPOSITORY$/org/openjfx/javafx-controls/22-ea+16/javafx-controls-22-ea+16.jar!/" />
|
||||||
<root url="jar://$MAVEN_REPOSITORY$/org/openjfx/javafx-controls/22-ea+16/javafx-controls-22-ea+16-linux.jar!/" />
|
<root url="jar://$MAVEN_REPOSITORY$/org/openjfx/javafx-controls/22-ea+16/javafx-controls-22-ea+16-win.jar!/" />
|
||||||
<root url="jar://$MAVEN_REPOSITORY$/org/openjfx/javafx-graphics/22-ea+16/javafx-graphics-22-ea+16.jar!/" />
|
<root url="jar://$MAVEN_REPOSITORY$/org/openjfx/javafx-graphics/22-ea+16/javafx-graphics-22-ea+16.jar!/" />
|
||||||
<root url="jar://$MAVEN_REPOSITORY$/org/openjfx/javafx-graphics/22-ea+16/javafx-graphics-22-ea+16-linux.jar!/" />
|
<root url="jar://$MAVEN_REPOSITORY$/org/openjfx/javafx-graphics/22-ea+16/javafx-graphics-22-ea+16-win.jar!/" />
|
||||||
<root url="jar://$MAVEN_REPOSITORY$/org/openjfx/javafx-base/22-ea+16/javafx-base-22-ea+16.jar!/" />
|
<root url="jar://$MAVEN_REPOSITORY$/org/openjfx/javafx-base/22-ea+16/javafx-base-22-ea+16.jar!/" />
|
||||||
<root url="jar://$MAVEN_REPOSITORY$/org/openjfx/javafx-base/22-ea+16/javafx-base-22-ea+16-linux.jar!/" />
|
<root url="jar://$MAVEN_REPOSITORY$/org/openjfx/javafx-base/22-ea+16/javafx-base-22-ea+16-win.jar!/" />
|
||||||
</CLASSES>
|
</CLASSES>
|
||||||
<JAVADOC />
|
<JAVADOC />
|
||||||
<SOURCES />
|
<SOURCES />
|
||||||
|
|||||||
+2
-2
@@ -3,9 +3,9 @@
|
|||||||
<properties maven-id="org.openjfx:javafx-graphics:22-ea+16" />
|
<properties maven-id="org.openjfx:javafx-graphics:22-ea+16" />
|
||||||
<CLASSES>
|
<CLASSES>
|
||||||
<root url="jar://$MAVEN_REPOSITORY$/org/openjfx/javafx-graphics/22-ea+16/javafx-graphics-22-ea+16.jar!/" />
|
<root url="jar://$MAVEN_REPOSITORY$/org/openjfx/javafx-graphics/22-ea+16/javafx-graphics-22-ea+16.jar!/" />
|
||||||
<root url="jar://$MAVEN_REPOSITORY$/org/openjfx/javafx-graphics/22-ea+16/javafx-graphics-22-ea+16-linux.jar!/" />
|
<root url="jar://$MAVEN_REPOSITORY$/org/openjfx/javafx-graphics/22-ea+16/javafx-graphics-22-ea+16-win.jar!/" />
|
||||||
<root url="jar://$MAVEN_REPOSITORY$/org/openjfx/javafx-base/22-ea+16/javafx-base-22-ea+16.jar!/" />
|
<root url="jar://$MAVEN_REPOSITORY$/org/openjfx/javafx-base/22-ea+16/javafx-base-22-ea+16.jar!/" />
|
||||||
<root url="jar://$MAVEN_REPOSITORY$/org/openjfx/javafx-base/22-ea+16/javafx-base-22-ea+16-linux.jar!/" />
|
<root url="jar://$MAVEN_REPOSITORY$/org/openjfx/javafx-base/22-ea+16/javafx-base-22-ea+16-win.jar!/" />
|
||||||
</CLASSES>
|
</CLASSES>
|
||||||
<JAVADOC />
|
<JAVADOC />
|
||||||
<SOURCES />
|
<SOURCES />
|
||||||
|
|||||||
@@ -11,5 +11,6 @@
|
|||||||
<orderEntry type="library" name="openjfx.javafx.graphics" level="project" />
|
<orderEntry type="library" name="openjfx.javafx.graphics" level="project" />
|
||||||
<orderEntry type="library" name="openjfx.javafx.controls" level="project" />
|
<orderEntry type="library" name="openjfx.javafx.controls" level="project" />
|
||||||
<orderEntry type="library" name="scala-sdk-2.13.12" level="application" />
|
<orderEntry type="library" name="scala-sdk-2.13.12" level="application" />
|
||||||
|
<orderEntry type="library" name="scala-sdk-2.13.12" level="application" />
|
||||||
</component>
|
</component>
|
||||||
</module>
|
</module>
|
||||||
@@ -2,13 +2,16 @@ package Klausur_ueb
|
|||||||
|
|
||||||
object Lambda {
|
object Lambda {
|
||||||
def main(args: Array[String]): Unit = {
|
def main(args: Array[String]): Unit = {
|
||||||
val a = Array(1, 2, 3, 4, 5)
|
val a = Array(1.0, 2.0, 3.0, 4.0, 5.0)
|
||||||
val summe = a.reduce((x: Int, y: Int) => x + y)
|
val summe = a.reduce((x: Double, y: Double) => x + y)
|
||||||
val summeKuerzer = a.reduce((x, y) => x + y)
|
val summeKuerzer = a.reduce((x, y) => x + y)
|
||||||
val summeNochKuerzer = a.reduce(_ * _)
|
val prodNochKuerzer = a.reduce(_ * _)
|
||||||
|
val qNochKuerzer = a.reduce(_ / _)
|
||||||
val summeGanzKurz = a.sum //vordefiniert
|
val summeGanzKurz = a.sum //vordefiniert
|
||||||
println(summeGanzKurz)
|
println(summeGanzKurz)
|
||||||
println(summeNochKuerzer)
|
println(prodNochKuerzer)
|
||||||
|
println(qNochKuerzer)
|
||||||
|
println(1.0/120.0)
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -4,19 +4,47 @@ import scala.annotation.tailrec
|
|||||||
|
|
||||||
object FrenchDude {
|
object FrenchDude {
|
||||||
def main(args: Array[String]): Unit = {
|
def main(args: Array[String]): Unit = {
|
||||||
|
startPascal(5)
|
||||||
|
println(" ")
|
||||||
|
startPascal2(5)
|
||||||
}
|
}
|
||||||
def pascalTriangle(c: Int, r: Int): Int = {
|
|
||||||
@tailrec
|
|
||||||
def loop(c0: Int, r0: Int, pred: Array[Int], cur: Array[Int]): Int = {
|
|
||||||
cur(c0) = (if (c0 > 0) pred(c0 - 1) else 0) + (if (c0 < r0) pred(c0) else 0)
|
|
||||||
|
|
||||||
if ((c0 == c) && (r0 == r)) cur(c0)
|
def startPascal(n:Int):Unit={
|
||||||
else if (c0 < r0) loop(c0 + 1, r0, pred, cur)
|
pascal(Array(1),n)
|
||||||
else loop(0, r0 + 1, cur, new Array(_length = r0 + 2))
|
}
|
||||||
|
def startPascal2(n:Int):Unit={
|
||||||
|
pascal2(Array(1),n)
|
||||||
|
}
|
||||||
|
|
||||||
|
//Endrekursiv
|
||||||
|
@tailrec
|
||||||
|
def pascal (arr:Array[Int],n:Int): Unit = {
|
||||||
|
arr.foreach(v => print(v+" "))
|
||||||
|
var newArr = Array[Int]()
|
||||||
|
newArr = newArr :+ 1
|
||||||
|
for (i <- arr.indices){
|
||||||
|
if (i<arr.length-1)
|
||||||
|
newArr = newArr:+ arr(i)+arr(i+1)
|
||||||
}
|
}
|
||||||
|
newArr = newArr :+ 1
|
||||||
|
println()
|
||||||
|
if(newArr.length <= n+1)
|
||||||
|
pascal(newArr,n)
|
||||||
|
}
|
||||||
|
|
||||||
if ((c == 0) && (r == 0)) 1
|
//Rekursiv, aber nicht Endrekursiv
|
||||||
else loop(0, 1, Array(1), Array(0, 0))
|
def pascal2 (arr:Array[Int],n:Int): Unit = {
|
||||||
|
arr.foreach(v => print(v+" "))
|
||||||
|
var newArr = Array[Int]()
|
||||||
|
newArr = newArr :+ 1
|
||||||
|
for (i <- arr.indices){
|
||||||
|
if (i<arr.length-1)
|
||||||
|
newArr = newArr:+ arr(i)+arr(i+1)
|
||||||
|
}
|
||||||
|
newArr = newArr :+ 1
|
||||||
|
println()
|
||||||
|
if(newArr.length <= n+1)
|
||||||
|
pascal2(newArr,n)
|
||||||
|
println()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -0,0 +1,45 @@
|
|||||||
|
package P9
|
||||||
|
|
||||||
|
import scala.annotation.tailrec
|
||||||
|
|
||||||
|
object Counter {
|
||||||
|
def main(args: Array[String]) {
|
||||||
|
val arr = Array('a', 'b', 'a', 'a', 'c', 'c', 'c', 'b', 'b', 'a')
|
||||||
|
val arr2 = Array(1,1,1,3,3,2,2,1,1,4)
|
||||||
|
startCount(arr2)
|
||||||
|
println("Count 2: ")
|
||||||
|
startCount2(arr)
|
||||||
|
}
|
||||||
|
|
||||||
|
def startCount(arr: Array[?]): Unit = {
|
||||||
|
val dsArr = arr.distinct
|
||||||
|
val list: List[Int] = List()
|
||||||
|
count(arr, dsArr,0)
|
||||||
|
}
|
||||||
|
def startCount2(arr: Array[?]): Unit = {
|
||||||
|
val dsArr = arr.distinct
|
||||||
|
val list: List[Int] = List()
|
||||||
|
count2(arr, dsArr,0)
|
||||||
|
}
|
||||||
|
|
||||||
|
//Endrekursiv
|
||||||
|
@tailrec
|
||||||
|
def count(searchArr: Array[?], containArr: Array[?], index:Int): Unit = {
|
||||||
|
if (index >= containArr.length)
|
||||||
|
println("end")
|
||||||
|
else {
|
||||||
|
println(containArr(index).toString + ": " + searchArr.count(_==containArr(index)))
|
||||||
|
count(searchArr, containArr, index+1)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
//Rekursiv, aber nicht Endrekursiv
|
||||||
|
def count2(searchArr: Array[?], containArr: Array[?], index:Int): Unit = {
|
||||||
|
if (index >= containArr.length)
|
||||||
|
println("end")
|
||||||
|
else {
|
||||||
|
count2(searchArr, containArr, index+1)
|
||||||
|
println(containArr(index).toString + ": " + searchArr.count(_==containArr(index)))
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -1,10 +0,0 @@
|
|||||||
package P9
|
|
||||||
|
|
||||||
object Numbers {
|
|
||||||
def main(args: Array[String]) {
|
|
||||||
println()
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
}
|
|
||||||
@@ -1,12 +0,0 @@
|
|||||||
object Palindrom {
|
|
||||||
def main(args: Array[String]) {
|
|
||||||
println(startCheck("ABCCBA"))
|
|
||||||
}
|
|
||||||
|
|
||||||
def startCheck(word: String): Boolean = {
|
|
||||||
check(0, word)
|
|
||||||
}
|
|
||||||
def check(i: Int, word: String): Boolean = {
|
|
||||||
if((word.length/2)<=i) true else if (word.charAt(i)==word.charAt(word.length-i-1)&&check(i+1,word)) true else false
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -0,0 +1,28 @@
|
|||||||
|
package P9
|
||||||
|
|
||||||
|
import scala.annotation.tailrec
|
||||||
|
|
||||||
|
object Palindrome {
|
||||||
|
def main(args: Array[String]): Unit = {
|
||||||
|
val word = "ABCDCBA"
|
||||||
|
println(startCheck(word))
|
||||||
|
println(startCheck2(word))
|
||||||
|
}
|
||||||
|
|
||||||
|
private def startCheck(word: String): Boolean = {
|
||||||
|
check(0, word)
|
||||||
|
}
|
||||||
|
|
||||||
|
private def startCheck2(word: String): Boolean = {
|
||||||
|
check2(0, word)
|
||||||
|
}
|
||||||
|
|
||||||
|
@tailrec
|
||||||
|
private def check(i: Int, word: String): Boolean = {
|
||||||
|
((word.length / 2) <= i) || (word.charAt(i) == word.charAt(word.length - i - 1) && check(i + 1, word)) //endrekursiv i guess
|
||||||
|
}
|
||||||
|
|
||||||
|
private def check2(i: Int, word: String): Boolean = {
|
||||||
|
((word.length / 2) <= i) || check2(i + 1, word) && (word.charAt(i) == word.charAt(word.length - i - 1)) //rekursiv, aber nicht endrekursiv
|
||||||
|
}
|
||||||
|
}
|
||||||
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Reference in New Issue
Block a user