Explain how the shuttle sort algorithm works, Data Structure & Algorithms

Assignment Help:

Question 1

Explain how the shuttle sort algorithm works by making use of the following list of integers:11, 4, 2, 8, 5, 33, 7, 3, 1, 6. Show all the steps.

Question 2

Write the outputs for the following Matlab codes
f1=0;
f2=1;
for i = 1 : 10
f3=f2+f1;
disp(f3)
f1=f2;
f2=f3;
end

Question 3

(a) List and describe the operations that can be performed on a stack.

(b) For each operation given in (a), write the implementation using Matlab codes.

Question 4

(a) Construct a tree for the following list of alphabets assuming that a number smaller than the node goes to the left else it goes to the right.

16, 8, 4, 24, 9, 5, 23, 13, 22, 28, 6, 3, 7, 2, 15, 10, 12, 14, 19, 27, 29, 26, 31, 25, 30, 1, 11, 18, 21, 17, 20

(b) Perform inorder, postorder and preorder traversal with the following tree.

163_Explain how the shuttle sort algorithm works.png

Question 5

Use Prim's algorithm (matrix form) to find a minimum spanning tree and calculate the minimum cost for the graph given below.

109_Explain how the shuttle sort algorithm works1.png

Question 6

Using Big-O estimate the execution time for the Matlab codes given below. Show clearly all your workings.

1. for i = 1:n-1
2. for j = 1:n-i
3. if a(j) > a(j+1)
4. c=a(j);
5. a(j)=a(j+1);
6. a(j+1)=c;
7. end
8. end
9. end

Question 7

Given the set of items S = {4, 8, 5, 1, 7, 6, 1, 4, 2, 2} and bins of size 10, pack the items into as few bins as possible using Best Fit and Worst Fit. Show all the intermediate steps.


Related Discussions:- Explain how the shuttle sort algorithm works

Merge sort, Merge sort is a sorting algorithm which uses the basic idea of ...

Merge sort is a sorting algorithm which uses the basic idea of divide and conquers. This algorithm initially divides the array into two halves, sorts them separately and then merge

Sorting, explain quick sort algorithm

explain quick sort algorithm

Explain worst fit method, Worst Fit method:- In this method the system alw...

Worst Fit method:- In this method the system always allocate a portion of the largest free block in memory. The philosophy behind this method is that by using small number of a ve

Hashing and collisions during hashing, Q. What do you understand by the te...

Q. What do you understand by the term Hashing?  How do the collisions occur during hashing?  Explain the different techniques or methods for resolving the collision.

Best case, Best Case: If the list is sorted already then A[i] T (n) = ...

Best Case: If the list is sorted already then A[i] T (n) = c1n + c2 (n -1) + c3(n -1) + c4 (n -1)  = O (n), which indicates that the time complexity is linear. Worst Case:

Program segment for insertion of an element into the queue, Program: Progra...

Program: Program segment for insertion of an element into the queue add(int value) { struct queue *new; new = (struct queue*)malloc(sizeof(queue)); new->value = val

B-tree, Draw a B-tree of order 3 for the following sequence of keys: 2,4,9,...

Draw a B-tree of order 3 for the following sequence of keys: 2,4,9,8,7,6,3,1,5,10.and delete 8 and 10

Order of linear search, a. In worst case the order of linear search is O (n...

a. In worst case the order of linear search is O (n/2) b. Linear search is more competent than Binary search. c. For Binary search, the array must be sorted in ascending orde

Road transport booking system, what algorithms can i use for the above titl...

what algorithms can i use for the above title in my project desing and implmentation of road transport booking system

What is a container taxonomy, What is A Container Taxonomy It's useful ...

What is A Container Taxonomy It's useful to place containers in a taxonomy to help understand their relationships to one another and as a basis for implementation using a class

Write Your Message!

Captcha
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