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

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.

Posted Date: 10/22/2013 5:11:01 AM | Location : United States







Related Discussions:- Explain how the shuttle sort algorithm works, Assignment Help, Ask Question on Explain how the shuttle sort algorithm works, Get Answer, Expert's Help, Explain how the shuttle sort algorithm works Discussions

Write discussion on Explain how the shuttle sort algorithm works
Your posts are moderated
Related Questions
Q1. Define the following terms: (i) Abstract data type. (ii) Column major ordering for arrays. (iii)  Row major ordering for arrays. Q2. Explain the following: (i) A

Ask question find frequency count of function- {for(i=1;i {for(j=1;j {for(k=1;k } } }

A graph with n vertices will absolutely have a parallel edge or self loop if the total number of edges is greater than n-1

Explain an efficient and effective way of storing two symmetric matrices of the same order in the memory. A n-square matrix array will be symmetric if a[j][k]=a[k][j] for all j

Algorithm for Z-Buffer Method (a)  Initialize every pixel in the viewport to the smallest value of z, namely z0 the z-value of the rear clipping plane or "back-ground". Store a

File organisation might be described as a method of storing records in file. Also, the subsequent implications approaching these records can be accessed. Given are the factors invo

Full Binary Trees: A binary tree of height h that had 2h -1 elements is called a Full Binary Tree. Complete Binary Trees: A binary tree whereby if the height is d, and all of

What is a Binary Search Tree (BST)? A binary search tree B is a binary tree every node of which satisfies the three conditions: 1.  The value of the left-subtree of 'x' is le

Q. The degree of a node is defined as the number of children it has. Shear show that in any binary tree, the total number of leaves is one more than the number of nodes of degree 2

Ans: A procedure to reverse the singly linked list: reverse(struct node **st) { struct node *p, *q, *r; p = *st; q = NULL; while(p != NULL) { r =q;