How much time will it take to sort the array

Assignment Help Data Structure & Algorithms
Reference no: EM131032724

1. In general which of the following algorithms requires the most extra memory when running?

a) Insertion sort

b) Merge sort

c) Quick sort

d) Shell sort

e) All wold use the same amount of extra memory.

2. Which of the following algorithms runs in 0(AP) average time?

a. insertion sort

b) merge sort

c) quick sort

d) heap sort

e) none of the above

3. Which of the following algorithms runs in 0(N log N) average time but quadratic worst-case time?

a) insertion sort

b) merge sort

c) heap sort

d) Shell sort

e) quick sort

4. The -median-of-three" partitioning strategy is often used in a QuickSort implementation because:

a) The Quicksort always needs three pivot values

b) It helps prevent "degenerate input" sequences from degrading the algorithm's performance. C) The array is usually of an unknown length

d) It prevents empty arrays from crashing the system

e) The median value will never have to be swapped to a new location.

5. Which algorithm provides the best "real-world" performance on data that is already sorted or "mostly" sorted

a) InsertionSort

b) MergeSort

c) HeapSort

d) ShellSort

e) QuickSort

6. Which algorithm provides the most consistent performance when sorting data. (The actual number of operations is the most independent of the input order of the data.)

a) InsertionSort

b) HeapSort

C) QuickSort

d) None are affected significantly by the original ordering.

e) All can vary greatly, depending on order of the supplied data.

7. If an arbitrary item is added to the end of an already sorted list, how much time will it take to sort the array again using insertion sort?

a) o( 1 )

b) 0( log N )

c) 0( N )

d) O (N log N )

e) 0( N2 )

8. Which of the following is true about the height of a node?

a) The height of a node is always one less than the height of its parent

b) The height of an empty tree is 1

C) The height of a leaf is always 0

d) The maxim height of a tree can be larger than its maximum depth

e) all of the above are false

9. Insertions and lookups on a Hash-map may operate in 0(1) time whereas Search Tree's require 0(log n) time. BRIEFLY explain: How/why Hash-maps may operate in a lower computation complexity than Tress and why Trees might still be preferable over Hash-maps in many cases.

10. List the following algorithms in order from Slowest to Fastest (in terms of their general "real world" AND theoretical average performance) and provide the key reason why each successive algorithm is faster than its predecessor; no more than 5 or so words! If there is a "tie", indicate such briefly mention why.

QuickSort, BubbleSort, MergeSort, HeapSort, SelectionSort, ShellShort, InsertionSort, CountingSort.

11. The first stage of a Heap-Sort is to represent an input sequence as a "Binary Heap", Given a list (4, 3, 1, 2, 9, .6,. 7, 8, 5)

a) Show the "Binary MAX Heap" Representation (assuming the items are added to the heap in the order given) as both a tree and as a new array.

"Heap" Array:

9

8

7

6

5

4

3

2

1

 

b) Show the Heap after the removal of the largest element (eg. the first item positioning of the "Heap Sort".)

"Heap" Array:

9

8

7

6

5

4

3

2

1

 

12. The two nodes marked *'s in the tree below have a height difference greater than one (two, to be precise). Does the tree have the structural properties of a valid AVL tree? Why or why not?

536_Tree Graph.png

The next four questions relate to the tree below:

1215_Tree Graph1.png

1. Which of the following traversals yields ABCDE?

a) inorder

b) level (bredth) order

C) postorder

d) preorder

e) two of the above

2. Which of the following is an inorder traversal of the tree?

a) ABCDE

b) ABDCE

c) BDECA

d) EDCBA

e) none of the above

13. Using the following tree:

449_Tree Graph2.png

a) Show a post-order traversal (the nodes as they are displayed) of the above tree

b) Show a pre-order traversal (the nodes as they are displayed) of the above tree

C) Show an in-order traversal (the nodes as they are displayed) of the above tree

14. Show the resulting .AVL Tree after the insertion of the following elements - in order - into a new AVL tree: 30, 20, 10, 5, 6, 15, 2

15. Assuming a Quick Sort, where a first element of any "sub array" is always the pivot show the resulting array after the first "pivot value" has been swapped into it's correct location (ie, after the first partitioning of the array into the first two "sub arrays"):

[4, 1, 7, 8, 6, 9, 3, 5, 0]

16. Assuming an radix sort is used to sort the elements below. Show each of the resulting "intermediate" arrays as the array is placed into sorted order.

[123, 122, 222, 111, 132, 133]

17. Assume characters have the following values: a=1, b=2, c=3, d=4, e=5 and a string hashing function that simply adds the character values and mods with 5: (0k Chark)mod 5

For example "abae" = (1+2+1+5)965 => 4

Show the addition of the following strings to a "Closed" Hash table (in order):

"abc" , "bbb" , "cb", "ee", "abcde"

0

 

1

 

2

abc

3

cb

4

bbb

5

ee

6

abcde

18. Show the addition of the following strings to an "Open" Hash table (in order): "abc", "bbb", "cb" , "ee", "abcde"

 

 

 

 

 

 

 

 

 

 

 

 

 

 

Reference no: EM131032724

Questions Cloud

Impact of credit crises on us financial market liquidity : BUS422 - Spring2015 - Impact of Lehman Brother's bankruptcy on Individual wealth and impact of credit crises on US Financial market liquidity.
Determine the power input to the ice machine : Water enters the ice machine at 55°F and leaves as ice at 25°F. For an ice production rate of 15 lbm/h, determine the power input to the ice machine (169 Btu of heat needs to be removed from each lbm of water at 55°F to turn it into ice at 25°F).
Describe data collection and analysis methods : The initial research proposal will consist of the following SIX (6) items: Identify a business research topic and Define the research questions for the identified problem or opportunity
Discuss how you will eliminate bias from your observation : Discuss whether you will be using this tool to observe social/emotional development, physical development, cognitive development, or language development. Explain the purpose for using this tool to assess your chosen domain.
How much time will it take to sort the array : If an arbitrary item is added to the end of an already sorted list, how much time will it take to sort the array again using insertion sort?
Impact of social media on contemporary businesscommunication : You are required to write an essay on "The impact of social media on contemporary business communication." How have these changes impacted the way modern business operates today
Discuss the importance of senior management : Discuss the importance of senior management in setting the tone at the top for honesty and integrity within a company. Identify at least two consequences of management not establishing a code of ethics.
Evaluate the performance of capital projects : Determine the rate of return you could expect from your investment and the method you would use to evaluate the investment decision.
What is the purpose of a swot and pest analysis : What relevant legislation does your organisation adhere to that could affect strategic planning? What is the purpose of a SWOT and PEST analysis? Why is it important to have knowledge of the competitors

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