SSJcoders / ssj-backend

0 stars 0 forks source link

James Individual Review Ticket #6

Open Jw95z opened 9 months ago

Jw95z commented 9 months ago

video

Runtime Sorting1 Runtime Sorting2 Runtime Fibonacci

Bubble Sort API Controller

public class bubbleApiController { public static void shuffle(int[] array, int count){ int temp, temp2, randomNum1, randomNum2;

    for(int i=0; i<count; i++){
        randomNum1 = (int)(Math.random()*array.length);
        temp = array[randomNum1];
        randomNum2 = (int)((Math.random()*array.length));
        temp2 = array[randomNum2];
        array[randomNum1] = temp2;
        array[randomNum2] = temp;
    }
}

@Autowired
private BubbleJPARepository repository;

@GetMapping("/get")
public ResponseEntity<List<BubbleSort>> getValues() {
    return new ResponseEntity<>(repository.findAll(), HttpStatus.OK);
}

@PostMapping("/")
public ResponseEntity<?> postNumber(@RequestBody Map<String, Integer> requestBody) {
    Integer a = requestBody.get("number");
    if (a == null) {
        return new ResponseEntity<>("error", HttpStatus.CREATED);
    }
    int[] list = new int[a];
    for (int i = 1; i <= a; i++) {
        list[i - 1] = i;
    }
    shuffle(list, list.length);
    long beforeTime = System.nanoTime();
    for (int i = 0; i < list.length - 1; i++) {
        for (int j = 0; j < list.length - i - 1; j++) {
            if (list[j] > list[j + 1]) {
                int temp = list[j];
                list[j] = list[j + 1];
                list[j + 1] = temp;
            }
        }
    }
    long afterTime = System.nanoTime();
    double secDiffTime = (afterTime - beforeTime) / 1_000_000.0;
    BubbleSort bubbleSort = new BubbleSort(a, secDiffTime);
    repository.save(bubbleSort);
    return new ResponseEntity<>(secDiffTime, HttpStatus.CREATED);
}

}

I also created for other backend such as merge sort, insertion sort, and selection sort. Store each time and number in Database.

Sorts.html

<!Doctype html>

sort

Sorting Algorithms


10000

Sorting Method Number Time




Sorting Visualization sort.html

<!DOCTYPE html>

SSJ | Sorting Algorithms

Team SSJ

Bubble Sort

Insertion Sort

Selection Sort

Merge Sort

Fibo.html

<!DOCTYPE html>

Team SSJ


Start Bootstrap can help you build better websites using the Bootstrap CSS framework! Just download your template and start going, no strings attached!

Find Out More
Method List Time
Mathematical Formula
Recursion

KeyCommits

Sort Graph Sort Visualization Sort API

JasoXDDD commented 9 months ago

Individual Review "Haoxuan" grading "James"

Individuals Video, Issue(s), Commits(s)

EdwinKuttappi commented 9 months ago

Individual Review Edwin Abraham grading James Lee

Individuals Video, Issue(s), Commits(s):

Possible Improvements:

Conclusion

I liked their project very much and it is very cool in how they decided to approach this problem with the way that they did. I believe that if they continued to polish this website, this could be a great resource for future CSSE, CSP, and CSA students to help them learn different sorting methods

Total

(0.8)+(0.9)+(0.9)+(0.8))/4=0.85/0.9