Starting from:

$24

CS210 Algorithms & Data Structures 1

1. Write a Java program that outputs the quantity of prime numbers under an input number n which is inputted by the user. For example, if the user inputs 10, then the program outputs 4. Provide comments which explain how the algorithm works. [20 marks] 2. Write a Java program that prints the integers from 1 to 100. But for multiples of three print "Fizz" instead of the number and for the multiples of five print "Buzz". For numbers which are multiples of both three and five print "FizzBuzz". Provide comments which explain how the algorithm works. [20 marks] 3 . Write a Java method that takes in a reference to the head of a double-ended doubly-linked list and reverses it. Provide comments which explain how the algorithm works. [20 marks] 4 . Write a Java method that takes in an array of strings and sorts them by the number of unique characters in each string. Provide comments which explain how the algorithm works. [20 marks] 5 . Write a Java program that takes in an array of ints and finds the maximum contiguous subsequence sum, given an input length n. For example, for the following array, where n = 3 and the array is {-5 -1 2 -3 0 -3 3} the best possible sum of at least length 3 would be 0, where the subsequence is the last three elements (0, -3, 3). Provide comments which explain how the algorithm works

More products