aaa
This commit is contained in:
29
untitled/.gitignore
vendored
Normal file
29
untitled/.gitignore
vendored
Normal file
@@ -0,0 +1,29 @@
|
||||
### IntelliJ IDEA ###
|
||||
out/
|
||||
!**/src/main/**/out/
|
||||
!**/src/test/**/out/
|
||||
|
||||
### Eclipse ###
|
||||
.apt_generated
|
||||
.classpath
|
||||
.factorypath
|
||||
.project
|
||||
.settings
|
||||
.springBeans
|
||||
.sts4-cache
|
||||
bin/
|
||||
!**/src/main/**/bin/
|
||||
!**/src/test/**/bin/
|
||||
|
||||
### NetBeans ###
|
||||
/nbproject/private/
|
||||
/nbbuild/
|
||||
/dist/
|
||||
/nbdist/
|
||||
/.nb-gradle/
|
||||
|
||||
### VS Code ###
|
||||
.vscode/
|
||||
|
||||
### Mac OS ###
|
||||
.DS_Store
|
||||
8
untitled/.idea/.gitignore
generated
vendored
Normal file
8
untitled/.idea/.gitignore
generated
vendored
Normal file
@@ -0,0 +1,8 @@
|
||||
# Default ignored files
|
||||
/shelf/
|
||||
/workspace.xml
|
||||
# Editor-based HTTP Client requests
|
||||
/httpRequests/
|
||||
# Datasource local storage ignored files
|
||||
/dataSources/
|
||||
/dataSources.local.xml
|
||||
6
untitled/.idea/misc.xml
generated
Normal file
6
untitled/.idea/misc.xml
generated
Normal file
@@ -0,0 +1,6 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project version="4">
|
||||
<component name="ProjectRootManager" version="2" languageLevel="JDK_20" default="true" project-jdk-name="20" project-jdk-type="JavaSDK">
|
||||
<output url="file://$PROJECT_DIR$/out" />
|
||||
</component>
|
||||
</project>
|
||||
8
untitled/.idea/modules.xml
generated
Normal file
8
untitled/.idea/modules.xml
generated
Normal file
@@ -0,0 +1,8 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project version="4">
|
||||
<component name="ProjectModuleManager">
|
||||
<modules>
|
||||
<module fileurl="file://$PROJECT_DIR$/untitled.iml" filepath="$PROJECT_DIR$/untitled.iml" />
|
||||
</modules>
|
||||
</component>
|
||||
</project>
|
||||
6
untitled/.idea/vcs.xml
generated
Normal file
6
untitled/.idea/vcs.xml
generated
Normal file
@@ -0,0 +1,6 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project version="4">
|
||||
<component name="VcsDirectoryMappings">
|
||||
<mapping directory="$PROJECT_DIR$/.." vcs="Git" />
|
||||
</component>
|
||||
</project>
|
||||
8
untitled/src/Main.java
Normal file
8
untitled/src/Main.java
Normal file
@@ -0,0 +1,8 @@
|
||||
// Press Shift twice to open the Search Everywhere dialog and type `show whitespaces`,
|
||||
// then press Enter. You can now see whitespace characters in your code.
|
||||
public class Main {
|
||||
public static void main(String[] args) {
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
19
untitled/src/StopUhr.java
Normal file
19
untitled/src/StopUhr.java
Normal file
@@ -0,0 +1,19 @@
|
||||
public class StopUhr
|
||||
{
|
||||
private long startTime, stopTime;
|
||||
|
||||
public void start()
|
||||
{
|
||||
startTime = System.nanoTime();
|
||||
}
|
||||
|
||||
public void stop()
|
||||
{
|
||||
stopTime = System.nanoTime();
|
||||
}
|
||||
|
||||
public long getDuration()
|
||||
{
|
||||
return stopTime - startTime;
|
||||
}
|
||||
}
|
||||
67
untitled/src/Zeitmessung.java
Normal file
67
untitled/src/Zeitmessung.java
Normal file
@@ -0,0 +1,67 @@
|
||||
public class Zeitmessung
|
||||
{
|
||||
static int tuWasCounter = 0;
|
||||
private static double tuwas()
|
||||
{
|
||||
tuWasCounter++;
|
||||
return Math.random();
|
||||
}
|
||||
|
||||
// Linear
|
||||
public static double func1(int n)
|
||||
{
|
||||
double summe = 0;
|
||||
|
||||
for (int a = 0; a < n; a++)
|
||||
summe += tuwas();
|
||||
|
||||
return summe;
|
||||
}
|
||||
|
||||
// Quadratisch
|
||||
public static double func2(int n)
|
||||
{
|
||||
double summe = 0;
|
||||
|
||||
for (int a = 0; a < n; a++)
|
||||
for(int b = 0; b < n; b++)
|
||||
summe += tuwas();
|
||||
|
||||
return summe;
|
||||
}
|
||||
|
||||
// log2(n)
|
||||
public static double func6(int n)
|
||||
{
|
||||
double summe = 0;
|
||||
|
||||
while (n > 0)
|
||||
{
|
||||
summe += tuwas();
|
||||
n /= 2;
|
||||
}
|
||||
|
||||
return summe;
|
||||
}
|
||||
|
||||
public static void main(String[] args)
|
||||
{
|
||||
StopUhr uhr = new StopUhr();
|
||||
final int n = 100000;
|
||||
tuWasCounter = 0;
|
||||
uhr.start();
|
||||
func1(n);
|
||||
uhr.stop();
|
||||
System.out.println("func1 "+"n="+n+" Zeit:"+uhr.getDuration()+" tuWasCounter:" + tuWasCounter);
|
||||
tuWasCounter = 0;
|
||||
uhr.start();
|
||||
func2(n);
|
||||
uhr.stop();
|
||||
System.out.println("func2 "+"n="+n+" Zeit:"+uhr.getDuration()+" tuWasCounter:" + tuWasCounter);
|
||||
tuWasCounter = 0;
|
||||
uhr.start();
|
||||
func6(n);
|
||||
uhr.stop();
|
||||
System.out.println("func6 "+"n="+n+" Zeit:"+uhr.getDuration()+" tuWasCounter:" + tuWasCounter);
|
||||
}
|
||||
}
|
||||
11
untitled/untitled.iml
Normal file
11
untitled/untitled.iml
Normal file
@@ -0,0 +1,11 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<module type="JAVA_MODULE" version="4">
|
||||
<component name="NewModuleRootManager" inherit-compiler-output="true">
|
||||
<exclude-output />
|
||||
<content url="file://$MODULE_DIR$">
|
||||
<sourceFolder url="file://$MODULE_DIR$/src" isTestSource="false" />
|
||||
</content>
|
||||
<orderEntry type="inheritedJdk" />
|
||||
<orderEntry type="sourceFolder" forTests="false" />
|
||||
</component>
|
||||
</module>
|
||||
Reference in New Issue
Block a user