A. Given a list of number, describe an algorithm on how would you find the smallest number in the list.
B. Create an HTML document that shows the following
"Price List
Jacket | $89.99 |
Pants | $59.99 |
Shirt | $45.99 |
"
1. int findMin(int values[], int size){ int min = Integer.MAX_VALUE; for(int i = 0;i<size;i++){ if(min > values[i]){ min = values[i]; } } return min; } 2. <!DOCTYPE html> <html> <head> <style> table, th, td { border: 1px solid black; } </style> </head> <body> <h2>Price List</h2> <table style="width:100%"> <tr> <td>Jacket</td> <td>$89.99</td> </tr> <tr> <td>Pants</td> <td>$59.99</td> </tr> <tr> <td>Shirt</td> <td>$45.99</td> </tr> </table> </body> </html>
A. Given a list of number, describe an algorithm on how would you find the smallest...
Discrete Mathematics 5. i) Describe an algorithm that, upon input of a number n given in base 10, outputs the digits of n in base 8, starting from the rightmost. Esrample: If you are given the number 156, the output will be 432, because (156) 10 = (234)s. ii) What will be the complexity of the algorithm? You may assume that performing the division algorithm upon two numbers to find the quotient and remainder is the basic operation. (As a...
Given a list of numbers in random order, write an algorithm that works in O( n log(n) ) to find the kth smallest number in the list.
c++ question. implementing linked list how would you create the bellman-ford algorithm for weighted graphs?
Below is a linear time complexity algorithm Max-Min-VER1 to find the biggest and smallest element a given list. Input: A is a given list Output: two integers Example: Given A = {1, 5, 9, -3}. It returns -3 (the smallest element), and 9 (the biggest element) Max-Min-VER1(A, n) Line 1: large ← A[0] Line 2: for I from 1 to n - 1 do Line 3: large ← Math.max(large, A[I]) Line 4: small ← A[0] Line 5: for I from...
Devise an algorithm to find the two smallest values of a one-dimensional array. The inputs are the array and the number of elements in that array. There are three parts to this problem: I. Write the pseudocode for your algorithm, and include it as a comment in your .py file. 2. Provide a tracing of your algorithm for the array 281s 3. Create a flowchart of your algorithm using e.g. draw.io Save your flowchart in the form lastname.firstname hw3.png If...
how would you describe this algorithm in network terms? would you use the same network principles if you were to design a competing algorithm?
2. Here is a sorting algorithm that I like to use. Given an unsorted list of size n, let Xx represent the data in location k of the unsorted list. Compare xi to X2 and switch if necessary so that they are in sorted order, smallest first. Compare Xn-1 and Xn and switch if necessary so that they are in sorted order, smallest first. • Compare x3 with its left neighbors, switching if necessary so that the 3 first entries...
Q.(1)Describe the algorithm and java implementation for the following operations A. Create a singly linked list L1 with 4 nodes. You can use insert operation to add nodes to the list. Each element represent an airport code (e.g. BOS, ATL, JFK, MSP, etc.). Display the list L1 after it is created. B. Given singly linked list L1, create another singly linked list L2 that contains the same elements but in the reverse order. Display the content of both L1 and...
in python Write a class named RetaiI_Item that holds data about an item in a retail store. The class should store the following data in attributes: • Item Number • Item Description • Units in Inventory • Price Create another class named Cash_Register that can be used with the Retail_Item class. The Cash_Register class should be able to internally keep a list of Retail_Item objects. The class should include the following methods: • A method named purchase_item that accepts a...
List the worst case and average case Big O for each algorithm below and describe how the algorithm works. You can diagram or write a short paragraph. Bubble Sort Modified Bubble Sort Insertion Sort Merge Sort Selection Sort Shell Heap Quick