Draw a flowchart of the function realizing insertion sort

Assignment Help Data Structure & Algorithms
Reference no: EM13944134

1. Construct your own MATLAB function realizing the insertion sort algorithm.

Your function should have an unsorted array as its input and the sorted array as the output. In particular, you will need:

(i) Draw a flowchart of the function realizing the insertion sort

(ii) Write the corresponding MATLAB code. You should check (just for yourself) how your function works with an arbitrary unsorted array.

2. Write your own function computing cos(x) based on the Taylor expansion of cos(x) in the vicinity of zero. Name this function my_cos(x, N, eps). The input parameters in this function should be: x- the argument; N - the initial number of terms in the expansion; eps -optional parameter, giving the accuracy of approximation. In particular, you will need to do:

(i) Write MATLAB code for a function computing cos(x) based on the Taylor expansion with the fixed number of terms N in the expansion. Name
this function my_cos1(x,N). Draw a flowchart of my_cos1

(ii) (8 marks) Write a MATLAB code for my_cos(x,N,eps) based on the function my_cos1(x,N). 'Eps' is an optional parameter, the giving the accuracy. In other words, your function can used in two modes: my_cos(x,N,eps) and my_cos(x,N). Draw a flowchart of my_cos.

Hint: if we need to compute cos(x) with a given accuracy ?, we can truncate the infinite part of Taylor expansion cos(x)=a0+a1 x+a2 x2+... + an xn+...starting with the term an xn in case we have |an xn|<?.

3. You are computing now the roots of a nonlinear equation f(x)=0 with the accuracy ? based on the bisection method (use Wikipedia for details about the method, section 'The method'). The given accuracy is achieved in case |f(c)|< ? , where c- is an approximate root of the equation.

You will need to construct your own MATLAB function bisect_1(fname, a, b, eps), where fname - is the name of the function; a,b, determine the initial interval for the root search; eps is the accuracy.

(i) Draw a flowchart of bisect_1(fname, a, b, eps).

(ii) Write MATLAB code for bisect_1(fname, a, b, eps).

(iii) Find all roots of the equation exp(- cos(x)) -1=0 in the interval 0<x<3

Reference no: EM13944134

Questions Cloud

Random sample of the number of games : A random sample of the number of games played by individual NBA scoring leaders is shown below. Is there sufficient evidence to conclude that the variance in games played differs from 40 at α = .05? Assume, of course, that the variable is normally..
Discussing the benefits of the statement of cash flows : Write a two-page paper discussing the benefits of the statement of cash flows. What information can be derived by this statement? How is this information useful to managers? Investors?Your paper must be in APA format, and contain at least one APA for..
Write a brief email to a program officer : Please read the three files and then, You have to do TWO things: 1. Write a brief email to a program officer (Kerri Ann Hurley, Grants Manager).
Bottles from a single production run yields : A process that produces bottles of shampoo, when operating correctly, produces bottles whose contents weight, on average, 20 ounces. A random sample of nine bottles from a single production run yields the following content weights in ounces
Draw a flowchart of the function realizing insertion sort : Write the corresponding MATLAB code. You should check (just for yourself) how your function works with an arbitrary unsorted array.
Is art criticism based upon aesthetic value : Is art criticism based upon aesthetic value? Could you explain why please. Could you give me an example of criteria to show that something has aesthetic value.
What makes a thing beautiful : Why do we pay good money to listen to music that depresses us or watch movies that make us cry? What makes the "Birth of Venus" a piece of art and Playboy centerfold a piece of pornography?
How indigenous australia is represented in australian media : Deconstruct how Indigenous Australia is represented in the Australian media. What impact do these representations have on the place of Indigenous Australian culture within the mainstream notion of Australia?
Standard deviation of the sampling distribution : What is the standard deviation of the sampling distribution of the sample mean? There is a .25 probability that the sample mean is less than __________.

Reviews

Write a Review

Data Structure & Algorithms Questions & Answers

  Implement an open hash table

In this programming assignment you will implement an open hash table and compare the performance of four hash functions using various prime table sizes.

  Use a search tree to find the solution

Explain how will use a search tree to find the solution.

  How to access virtualised applications through unicore

How to access virtualised applications through UNICORE

  Recursive tree algorithms

Write a recursive function to determine if a binary tree is a binary search tree.

  Determine the mean salary as well as the number of salaries

Determine the mean salary as well as the number of salaries.

  Currency conversion development

Currency Conversion Development

  Cloud computing assignment

WSDL service that receives a request for a stock market quote and returns the quote

  Design a gui and implement tic tac toe game in java

Design a GUI and implement Tic Tac Toe game in java

  Recursive implementation of euclids algorithm

Write a recursive implementation of Euclid's algorithm for finding the greatest common divisor (GCD) of two integers

  Data structures for a single algorithm

Data structures for a single algorithm

  Write the selection sort algorithm

Write the selection sort algorithm

  Design of sample and hold amplifiers for 100 msps by using n

The report is divided into four main parts. The introduction about sample, hold amplifier and design, bootstrap switch design followed by simulation results.

Free Assignment Quote

Assured A++ Grade

Get guaranteed satisfaction & time on delivery in every assignment order you paid with us! We ensure premium quality solution document along with free turntin report!

All rights reserved! Copyrights ©2019-2020 ExpertsMind IT Educational Pvt Ltd