Skip to content

Commit

Permalink
finish lab1
Browse files Browse the repository at this point in the history
  • Loading branch information
wang-jiahao committed Dec 1, 2024
1 parent cb3ff2e commit 777818d
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 10 deletions.
2 changes: 0 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,5 +7,3 @@
## website

https://sp21.datastructur.es/

https://sp21.datastructur.es/
18 changes: 10 additions & 8 deletions lab1/Collatz.java
Original file line number Diff line number Diff line change
@@ -1,16 +1,18 @@
/** Class that prints the Collatz sequence starting from a given number.
* @author YOUR NAME HERE
/**
* Class that prints the Collatz sequence starting from a given number.
*
* @author YOUR NAME HERE
*/
public class Collatz {

/** Buggy implementation of nextNumber! */
/**
* Buggy implementation of nextNumber!
*/
public static int nextNumber(int n) {
if (n == 128) {
return 1;
} else if (n == 5) {
return 3 * n + 1;
if (n % 2 == 0) {
return n / 2;
} else {
return n * 2;
return 3 * n + 1;
}
}

Expand Down

0 comments on commit 777818d

Please sign in to comment.