Skip to content
3 changes: 0 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,3 @@
<img width="511" alt="image" src="https://github.com/ViktoriaMiroshnichenko/slow/assets/133248817/3ad5280e-b4ac-4b9b-8152-a2721cf304cf">The Slow class demonstrates the calculation of Fibonacci numbers using both recursive
and fast iterative methods. It prints the calculated Fibonacci numbers and the time
taken for each calculation.

The main method calculates and prints Fibonacci numbers using both recursive and fast iterative methods for a range of values.
Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Also, adding a short comment about why this specific value is used would help others understand the reasoning behind it. might change later.
Consider extracting it into a named constant or configuration file for better readability and maintainability.


Expand Down
7 changes: 4 additions & 3 deletions TextFile.html
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>My First Webpage</title>
<title>My First Webpage23</title>
<style>
body {
font-family: Arial, sans-serif;
Expand All @@ -26,14 +26,15 @@ <h1>Welcome to My Webpage</h1>
<nav>
<ul>
<li><a href="#section1">Section 1</a></li>
<li><a href="#section2">Section 2</a></li>
<li><a href="#section3">Section 3</a></li>
</ul>
</nav>

<main>
<section id="section1">
<section id="section176857">
<h2>Section 1</h2>
<h2>Section 2</h2>
<h3>Section 1</h3>
<p>This is the content of Section 1.</p>
</section>

Expand Down
8 changes: 3 additions & 5 deletions src/my/profiler/Slow.java
Original file line number Diff line number Diff line change
Expand Up @@ -2,21 +2,19 @@

public class Slow {
public static void main(String[] args) {
for (int i = 1; i < 50; i++) {
for (int i = 1; i < 51; i++) {
long start = System.currentTimeMillis();
System.out.println("Fibonacci recursive " + i + " = " + fibRecursive(i) + " took " + (System.currentTimeMillis() - start) + "ms");
start = System.currentTimeMillis();
System.out.println("Fibonacci fast " + i + " = " + fibFast(i) + " took " + (System.currentTimeMillis() - start) + "ms");
}


}

static long fibRecursive(long i) {
if (i < 2) return 1;
return fibRecursive(i-2) + fibRecursive(i -1);
}


static long fibFast(long i) {
if (i < 2) return i;
int a = 0, b = 1, c = 0;
Expand All @@ -27,4 +25,4 @@ static long fibFast(long i) {
}
return c;
}
}
}