0% found this document useful (0 votes)
862 views

Final

This document contains 10 questions about algorithms and data structures concepts from 10 different chapters: 1) Find if there is an integer in a sorted array that is equal to its index. Estimate the running time. 2) Write a procedure to print elements from one linked list that are in positions specified by another linked list. 3) Represent a tree using child/sibling pointers and write a traversal procedure. 4) Show open and closed hash tables with different probing for a given input and hash functions. 5) Merge two leftist heaps and two binomial queues from figures in the textbook. 6) Analyze the running time of insertion sort if all keys are equal. 7

Uploaded by

Chandu Satuluri
Copyright
© Attribution Non-Commercial (BY-NC)
Available Formats
Download as DOC, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
862 views

Final

This document contains 10 questions about algorithms and data structures concepts from 10 different chapters: 1) Find if there is an integer in a sorted array that is equal to its index. Estimate the running time. 2) Write a procedure to print elements from one linked list that are in positions specified by another linked list. 3) Represent a tree using child/sibling pointers and write a traversal procedure. 4) Show open and closed hash tables with different probing for a given input and hash functions. 5) Merge two leftist heaps and two binomial queues from figures in the textbook. 6) Analyze the running time of insertion sort if all keys are equal. 7

Uploaded by

Chandu Satuluri
Copyright
© Attribution Non-Commercial (BY-NC)
Available Formats
Download as DOC, PDF, TXT or read online on Scribd
You are on page 1/ 1

CHAPTER 2

1. Give an efficient algorithm to determine if there exists an entry in a sorted array of integers that occupies that location in the array. That is, is there an integer i such that Ai = i? If i=3, then is A[3] = 3? Estimate the running time of your algorithm. (10 pts)

CHAPTER 3
2. You are given a linked list, L, and another linked list, P, containing integers sorted in ascending order. The operation PrintLots(L,P) will print the elements in L that are in positions specified by P. For instance, if P = 1, 3, 4, 6, the first, third, fourth, and sixth elements of L will be printed. Write the procedure PrintLots(L,P). You should use only the basic list operations on page 46 of the textbook. (10 pts)

CHAPTER 4
3. Show how the tree in Figure 4.62 in the textbook is represented using a child/sibling pointer implementation. Write a procedure to traverse a tree stored with child/sibling links so the relationships are expressed. (5 pts)

CHAPTER 5
4. Given input {4371, 1323, 6173, 4199, 4344, 9679, 1989} and a hash function h(x) = x(mod 10), show the resulting: (10 pts) a. open hash table b. closed hash table using linear probing c. closed hash table using quadratic probing d. closed hash table with second hash function h2(x) = 7 - (x mod 7)

CHAPTER 6
5. Merge the two leftist heaps in Figure 6.58 in the textbook. (5 pts) 6. Merge the two binomial queues in Figure 6.59 in the textbook. (5 pts)

CHAPTER 7
7. What is the running time of insertion sort if all keys are equal? (5 pts)

CHAPTER 8
8. Show the result of the following sequence of instructions after each instruction: Union(1,2), Union(3,4), Union(3,5), Union(1,7), Union(3,6), Union(8,9), Union(1,8), Union(3,10), Union(3,11,) Union(3,12), Union(3,13), Union(14,15), Union(16,17), Union(14,16), Union(1,3), Union(1,14) when the Unions are performed by size. (5 pts)

CHAPTER 9
9. Find the strongly connected components in the graph of Figure 9.84 in the textbook. (10 pts)

CHAPTER 10
10. Show how the recursive multiplication algorithm computes XY, where X = 1234 and Y = 4321. Include all recursive computations.

You might also like