Ask Computer Engineering Expert

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"

 

 

 

 

 

 

 

 

 

 

 

 

 

 

Computer Engineering, Engineering

  • Category:- Computer Engineering
  • Reference No.:- M91757214

Have any Question?


Related Questions in Computer Engineering

Does bmw have a guided missile corporate culture and

Does BMW have a guided missile corporate culture, and incubator corporate culture, a family corporate culture, or an Eiffel tower corporate culture?

Rebecca borrows 10000 at 18 compounded annually she pays

Rebecca borrows $10,000 at 18% compounded annually. She pays off the loan over a 5-year period with annual payments, starting at year 1. Each successive payment is $700 greater than the previous payment. (a) How much was ...

Jeff decides to start saving some money from this upcoming

Jeff decides to start saving some money from this upcoming month onwards. He decides to save only $500 at first, but each month he will increase the amount invested by $100. He will do it for 60 months (including the fir ...

Suppose you make 30 annual investments in a fund that pays

Suppose you make 30 annual investments in a fund that pays 6% compounded annually. If your first deposit is $7,500 and each successive deposit is 6% greater than the preceding deposit, how much will be in the fund immedi ...

Question -under what circumstances is it ethical if ever to

Question :- Under what circumstances is it ethical, if ever, to use consumer information in marketing research? Explain why you consider it ethical or unethical.

What are the differences between four types of economics

What are the differences between four types of economics evaluations and their differences with other two (budget impact analysis (BIA) and cost of illness (COI) studies)?

What type of economic system does norway have explain some

What type of economic system does Norway have? Explain some of the benefits of this system to the country and some of the drawbacks,

Among the who imf and wto which of these governmental

Among the WHO, IMF, and WTO, which of these governmental institutions do you feel has most profoundly shaped healthcare outcomes in low-income countries and why? Please support your reasons with examples and research/doc ...

A real estate developer will build two different types of

A real estate developer will build two different types of apartments in a residential area: one- bedroom apartments and two-bedroom apartments. In addition, the developer will build either a swimming pool or a tennis cou ...

Question what some of the reasons that evolutionary models

Question : What some of the reasons that evolutionary models are considered by many to be the best approach to software development. The response must be typed, single spaced, must be in times new roman font (size 12) an ...

  • 4,153,160 Questions Asked
  • 13,132 Experts
  • 2,558,936 Questions Answered

Ask Experts for help!!

Looking for Assignment Help?

Start excelling in your Courses, Get help with Assignment

Write us your full requirement for evaluation and you will receive response within 20 minutes turnaround time.

Ask Now Help with Problems, Get a Best Answer

Why might a bank avoid the use of interest rate swaps even

Why might a bank avoid the use of interest rate swaps, even when the institution is exposed to significant interest rate

Describe the difference between zero coupon bonds and

Describe the difference between zero coupon bonds and coupon bonds. Under what conditions will a coupon bond sell at a p

Compute the present value of an annuity of 880 per year

Compute the present value of an annuity of $ 880 per year for 16 years, given a discount rate of 6 percent per annum. As

Compute the present value of an 1150 payment made in ten

Compute the present value of an $1,150 payment made in ten years when the discount rate is 12 percent. (Do not round int

Compute the present value of an annuity of 699 per year

Compute the present value of an annuity of $ 699 per year for 19 years, given a discount rate of 6 percent per annum. As