Q7: Write an algorithm to print the multiplication table for number 9?
Q: Given these 8 numeric values to be sorted using the recursive Mergesort algorithm: 92 63 24 18 69…
A: Merge sort is the sorting technique which uses merging procedure to sort the elements and it good…
Q: write a python program to find the" kth smallest element" in the ascending order sorted list. also…
A: Program Plan: Initialize a list. Get the user input for the number of elements to store in the…
Q: how would you write this function in recursion int findLargest() { int largest; if (!empty) {…
A: Please refer below code snippet to find the largest element in a linked list using recursion: I have…
Q: Show clearly all working explaining detailly each step
A: ANS: - Option(a) Binary search is correct. The best algorithm for searching an item in the ordered…
Q: Write an algorithm to reverse a sorted list?
A: Step 1:- Note:-I am solving this problem in the python programming language The algorithm is defined…
Q: Suppose you have the following sorted list [3, 5, 6, 8, 11, 12, 14, 15, 17, 18] and are using the…
A: Given a sorted array : [3, 5, 6, 8, 11, 12, 14, 15, 17, 18] Size of array : 10 Subscript Range : 0-9…
Q: 1- replace item three with 40 A = [33 65 88 12 90 41 47 83]
A: Python program for replace item 3 with 40: def replacenum(A, num, n): return A.replace(num, n) if…
Q: TRUE or FALSE? Binary search is an example of an O(log N) algorithm, where the number of items in…
A: Answer - True. Binary search is an example of an O(log N) algorithm, where where the number of items…
Q: PYTHON Using binary search, how many checks would it take to determine if the number 400 is or is…
A: python
Q: Use Figure 10.8 as an example to show how to apply the binary search approach to a search for key 10…
A: The binary search algorithm is mentioned below. STEP 1: In the first step, sort the list in…
Q: 1-Sort the list using bubble sort. 96 76 84 55 22
A:
Q: Sort the list C , O , M , U , T , E , R in alphabetical order by Bubble sort and Selection sort.
A: Sorting the list C,O, M,P, U,T, E,R in alphabetical order by BUBBLE sort FUNCTION TO SORT ELEMENTS…
Q: Calculate the sum of series of even numbers from the list of numbers. The length of the list is in…
A: Given: To calculate the sum of series of even numbers from the list of numbers. The length of the…
Q: POP is a term used to ... an element from a Stack Select one: a. Delete O b. Sort c. Search d.…
A: Different operation in stack 1. Push: Adds an item in the stack. 2.Pop: Removes (delete) an item…
Q: main.py x 12345 6 69 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 print ("List of pets")…
A: I have made the code error free and with proper indentation The complete PYTHON code is given below…
Q: Perform a selection sort on the list 7, 4, 2, 9, 6. Show the list after each exchange that has an…
A: It sorts an array by repeatedly picking up an element from the unsorted subarray and moving it to…
Q: A sorted list of numbers contains 128 elements, Which of the following is closest to the maximum…
A: A sorted list of numbers contains 128 elements.8 is closest to the maximum number of list elements…
Q: Write pseudo code to find fitness value function of 5-queens problem. (Add a text file, Use…
A: First of all N-Queen problem is the problem where we need to find an arrangement of N queens on the…
Q: A particular sorting algorithm takes integer list 10, 6, 8 and incorrectly sorts the list to 6, 10,…
A: Please refer to the following step for the complete solution of the problem above.
Q: Sort the list C , O , M , U , T , E , R in alphabetical order by Bubble sort and Selection sort
A: According to the Question below the complete program: Programming language is not mention so i am…
Q: It is a list of numbers whose next term is obtained by summing up two preceding in the sequence
A: let us see the answer:-' Introduction: The Fibonacci sequence is defined as f[0] = 0, f[1] = 1, f[n]…
Q: 6. Design an algorithm to merge two ascending ordered sequential integer lists into one decending…
A: In the below algorithm, we first need to create a array whose length will be equal to the sum of the…
Q: How many ordered lists (a, b, c, d, e, f) satisfy the equation: a+b+c+d+e+f = 27 if a, b, c, d, e,…
A: Using Permutation and Combinations we can solve it using a formula i.e the Number of non-negative…
Q: Sort the following list using selection sort as discussed in this chapter. Show the list after each…
A: Answer: here is the code : #include<iostream>using namespace std;void swapping(int &a,…
Q: Write down the recursive binary search algorithm
A: Recursive binary search method: void binarysearch(int array[],int key,int low,int high) { int…
Q: Assume that the set s contains the number 3. Write the sequence of sets resulting from the following…
A: Introduction:- Set contains 3 elements in it. add() method is used to add a new item remove()…
Q: IIi you most likely see in a non-recursive implementation of a recursive algorithm? A A stack B An…
A: Answer : stack
Q: Based on the Binary Search Tree given below: 92 15 60 87 (71 Which of the following statements is…
A: The solution to the given problem is below.
Q: using range(1,101) , make two list , one containing all even numbers and containing all odd numbers
A: Program code: #declaring a List for even numbers evens = [] #for loop in range(1, 101) for i in…
Q: ist1 = ['A', 'B','C','E','J',] List2 Letter_combinations repeated_combinations = [] ['A','C','D',…
A: Flowchart is a diagram that is used for representing the flow of work for a process. A flowchart is…
Q: we can insert rows and column in ant table * O YES NO
A: Ant tables are used to store a collection of data.you can perform different operations on this data…
Q: em-13 integers are in the range of 1 to n. There are no duplicates in the list. One of the integers…
A: Question :- Code output and snips :-
Q: ool search(int board[8][8], int col) if (col >= 8) { return true; I/check rows for (int i = 0; i<8;…
A: It is defined as the process of repeating items in a self-similar way. In programming languages, if…
Q: Show the steps for performing the followings: a) Search 75 b) Insert 100 c) d) Delete 5 min and max…
A: In the given question, we have a binary search tree in which the elements are stored in a specific…
Q: Write a python program to implement Breadth first search Traversal
A: Introduction: Here we are required to create a program in python that will perform a BFS on graph.
Q: def all_lines_rhyme(poem_lines: POEM, lines_to_check: List[int], word to_phonemes:…
A: Task : Define the function all_lines_rhyme to check the poem lines at given lines_to_check index.…
Q: Example 4:program to compute the maximum number in any list
A: Note: Since no programming language is mentioned. I am attempting this in python. if you need it in…
Q: Q1. (Section 1.1.) Write an algorithm that finds the largest number in a list (an array) of n…
A: as per company guidelines, only first question answer can be given if multiple questions posted in…
Q: Write an algorithm to solve it:
A: An algorithm is a procedure or formula for solving a problem. A computer program can be viewed as an…
Q: Find the intersection of FA2 and FA
A: Here we make another transition table to find intersection:
Q: Assume you have a sorted list of integers. And you add a random integer to the end of the list.…
A: Insertion sort is a sorting algorithm that sorts thr array of elements in one go. We can imagine a…
Q: Write a program that sorts a list in ascending order. Don’t use sort method. Ask user number of list…
A: Please find the answer below :
Q: Write your own solution Given the list A = { 13, 27, 37, 59, 73, 98, 125, 178, 194, 214, 235,…
A: here we have been given a rundown of numbers and a key worth that is 200. Furthermore we need to…
Q: Use the binary search algorithm, to search for 35 in the following list. (Show the steps and number…
A: In this question, we have to use binary search algorithm to search 35 in the given list. In binary…
Q: Q No 2: Write Binary Search algorithm? Explain it. Also search 169 and 66 from the ollowing sequence…
A: Binary_Search(a, lower_bound, upper_bound, val) Step 1: set beg = lower_bound, end = upper_bound,…
Q: There are 1,000,000 entries in an index. A binary search on this list would require how many steps?
A: Hi there, Please find your solution below, I hope you would find my solution useful and helpful.…
Step by step
Solved in 2 steps
- Q3: Interplanetary Spaceflight Milan Tusk is the richest person in the universe. After devoting decades of his life to further our space exploration technologies, he’s finally ready to retire. Being a space enthusiast, the first thing he wants to do is visit n planets p1, p2, …, pn, in this order. He’s currently on planet p0. Milan knows that the distance between planets pi and pi + 1 (for 0 ≤ i < n) is d[i]light years. His spaceship uses 1 tonne of fossil fuels per light year. He starts with a full tank and can fill up his tank at any of the n planets (but he must not run out in between two planets). There’s a huge cost to set up the spaceship for refuelling. Due to financial constraints (he’s not THAT rich), he can fill up his tank at most ktimes. In order to save money and make his spaceship lighter, Milan is looking for the smallest possible fuel tank that enables him to complete his space travel and reach planet pn. What is the smallest tank capacity that enables him to do so?…please code in python The bisection code below finds the square root of a number. Try inputting 16 into the code to confirm it works. Next, try inputting 0.25 into the bisection search algorithm below and confirm that it doesn't work. Then correct the algorithm so that it works for all positive numbers, including decimals such as 0.25. # Q4-3 Grading Tag: ## Please fix the code in this cell (that is don't make a new cell)## Bisection Search to Find a Square Root x = float(input("enter a number:")) epsilon = 0.00001num_guesses = 0low = 0.0high = xans = (high + low)/2.0 while high - low >= 2 * epsilon: print("low =",low,"high =", high) num_guesses += 1 if ans ** 2 < x: low = ans else: high = ans ans = (high + low)/2.0 # Do not modify these output statements as the autograder looks for these!print('Number of guesses =', num_guesses)print(ans, 'is close to square root of', x)Binary numbers need more places for counting because A. They are always big numbers B. Any no. of 0's can be added in front of them C. Binary base is small D. 0's and l's have to be properly spaced apart E. None of the above
- # Exercise 1. Implement the algorithm covered in lectures that determines if an integer n is prime. Your function should return True, if n is prime, and False otherwise. Your algorithm has to be effective for n ~ 1,000,000,000,000.def isPrime(n):Q15. * After performing the operations: dequeue(), dequeue(), enqueue('S'), the value of Front becomes ........ 4 O 1 O 3 O 2 0 E Front 1 X 2 A 3 M Rear 4Part a:Finding Pythagorean Triples with OpenMPWrite a program that calculates Pythagorean triples using nested for loops. The Pythagorean Theorem states the following:?2 + ?2 = ?2Where a, b, and c are whole numbers. Part b: Modifying the Pythagorean Theorem Modify the Pythagorean Theorem by either adding or subtracting a times b on the left-hand-side, and run the program again. Are there integer solutions for this??2 + ?2 + ??= ?2
- Three numbersa. Write a program that reads three numbers and prints “all the same” if they are allthe same, “all different” if they are all different, and “neither” otherwise.b. Write a program that reads three numbers and prints “increasing” if they are inincreasing order, “decreasing” if they are in decreasing order, and “neither”otherwise. Here, “increasing” means “strictly increasing”, with each value largerthan its predecessor. The sequence 3 4 4 would not be considered increasing.c. Repeat part b. but before reading the numbers, ask the user whetherincreasing/decreasing should be “strict” or “lenient”. In lenient mode, thesequence 3 4 4 is increasing and the sequence 4 4 4 is both increasing anddecreasingQuestion # 1 Initialize a string of size 40. Write a program that prints all unique alphabets from string. After printing them sort them in ascending order. For example: Hi world I am here to help you. Unique characters are: H, I, W, O, R, L, D, A, M, E, T, P, Y, U. Sorted: A, D, E, H, I , L,M, O, P, R, T, U, W, YQ5/ write a program to compute the value of R from X,Y and Z values which are X=[0,1,2......9], Y= [2,4,6,.,20], and Z=(1,3,5,...,19]. Print the values of X,Y,Z, and R as adjacent columns. R = √A²+B²+C² X √x² + y² +2² A = . B=√36X* +9Y²+252² T C = √9+sin³Y+Z MATLAB
- 7. Write an algorithm to find sum of n numbers.Write a java code for search number using divide and conquer with the help of the Fibbonaci numbersle.com/forms/d/e/1FAlpQLSc6PlhZGOLJ4LOHo5cCGEf9HDChfQ-tT1bES-BKgkKu44eEnw/formResponse The following iterative sequence is defined for the set of positive integers: Sn/2 3n +1 ifn is odd if n is even Un = Using the rule above and starting with 13, we generate the following sequence: 13 u13 = 40 u40 =20 u20 = 10→ u10 =5 u5 = 16 u16 = 8 ug = 4 → Us =2 u2 =1. It can be seen that this sequence (starting at 13 and finishing at 1) contains 10 terms. The below function takes as input an integer n and returns the number of terms generated by the sequence starting at n. function i-Seq (n) u=n; i=%3; while u =1 if statement 1 u=u/2; else statement 2 end i=i+1; end statement 1 and statement 2 should be replaced by: None of the choices statement 1 is "mod(u,2)=D%3D0" and statement 2 is "u = 3*u+1;" statement 1 is "u%2" and statement 2 is "u = 3*u+1;" O statement 1 is "mod(n,2)=30" and statement 2 is "u = 3*n+1;"