data structures and algorithms:#
For each of your solutions please provide a short explanation as to why you believe your solution works properly. This is not formally required, so I will not reduce marks if you choose not to provide any explanations. However, in case the explanations are provided, my feedback will be more meaningful as I will be able to see your line of thought.
1 Most frequently occurring number:
Design an O(n) algorithm whose input is a sorted array A of integer numbers. The program should print the most frequent element of A. For example, in the array A = [1,2,2,5,7,7,7,8], 1 occurs once, 2 occurs twice, 5 occurs once, 7 occurs three times,and 8 occurs once. Hence, the most frequently occurring element is 7. If there are two or more most frequently occurring elements, the algorithm can be print anyone of them (e.g. the first one).
Solution to Question 1
2 Number of distinct elements in a sorted array
Design an O(n) algorithm whose input is a sorted array A of integer numbers. The program should print the number of distinct elements of A. For example, in the array A = [1,2,2,5,7,7,7,8], as in the previous section, the number of distinct elements is 5 which are 1,2,5,7,8.
Solution to Question 2
3 Number of distinct elements in an arbitrary array
Design an O(n2) algorithm whose input is an array A of integer numbers (not necessarily sorted). The program should print the number of distinct elements of A
Solution to Question 3
4 Three distinct elements of a sorted array
Design an O(logn) algorithm whose input is a sorted array A of integer numbers. The algorithm should print YES if A contains at least 3 distinct numbers and NO otherwise. Hint: Compare the first and the last elements and then use binary search.
CS 340 Milestone One Guidelines and Rubric Overview: For this assignment, you will implement the fundamental operations of create, read, update,
Retail Transaction Programming Project Project Requirements: Develop a program to emulate a purchase transaction at a retail store. This
7COM1028 Secure Systems Programming Referral Coursework: Secure
Create a GUI program that:Accepts the following from a user:Item NameItem QuantityItem PriceAllows the user to create a file to store the sales receip
CS 340 Final Project Guidelines and Rubric Overview The final project will encompass developing a web service using a software stack and impleme