16
1 VALLIAMMAI ENGINEERING COLLEGE SRM Nagar, Kattankulathur 603 203 DEPARTMENT OF COMPUTER SCIENCE AND ENGINEERING QUESTION BANK I SEMESTER CP7102 ADVANCED DATA STRUCTURES AND ALGORITHMS Regulation 2013 Academic Year 2017 18 Prepared by Ms.A.VIDHYA, Assistant Professor

VALLIAMMAI ENGINEERING COLLEGE Semester/CP7102-Advanced... · Dual Hill Climbing- Steepest Ascent Hill Climbing-Linear Programming-Recursive ... 3 RTell the computational complexity

  • Upload
    lamnhu

  • View
    222

  • Download
    2

Embed Size (px)

Citation preview

Page 1: VALLIAMMAI ENGINEERING COLLEGE Semester/CP7102-Advanced... · Dual Hill Climbing- Steepest Ascent Hill Climbing-Linear Programming-Recursive ... 3 RTell the computational complexity

1

VALLIAMMAI ENGINEERING COLLEGE

SRM Nagar, Kattankulathur – 603 203

DEPARTMENT OF

COMPUTER SCIENCE AND ENGINEERING

QUESTION BANK

I SEMESTER

CP7102 ADVANCED DATA STRUCTURES AND ALGORITHMS

Regulation – 2013

Academic Year 2017 – 18

Prepared by

Ms.A.VIDHYA, Assistant Professor

Page 2: VALLIAMMAI ENGINEERING COLLEGE Semester/CP7102-Advanced... · Dual Hill Climbing- Steepest Ascent Hill Climbing-Linear Programming-Recursive ... 3 RTell the computational complexity

2

VALLIAMMAI ENGINEERING COLLEGE

(A member of SRM Group of Institutions)

SRM Nagar, Kattankulathur– 603203

DEPARTMENT OF COMPUTER SCIENCE AND ENGINEERING

Year and Semester : I / I Section

: ME CSE 1

Subject Code : CP7102

Subject Name : ADVANCED DATA STRUCTURE AND ALGORITHM

Degree and Branch : ME-CSE

Staff Incharge : Ms.A.VIDHYA

UNIT I

ITERATIVE AND RECURSIVE ALGORITHMS

Iterative Algorithms: Measures of Progress and Loop Invariants-Paradigm Shift: Sequence of

Actions versus Sequence of Assertions- Steps to Develop an Iterative Algorithm-Different Types

of Iterative Algorithms--Typical Errors-Recursion-Forward versus Backward- Towers Of Hanoi-

Checklist for Recursive Algorithms-The Stack Frame-Proving Correctness with Strong

Induction- Examples of Recursive Algorithms-Sorting and Selecting Algorithms Operations on

Integers- Ackermann’s Function- Recursion on Trees-Tree Traversals- Examples- Generalizing

the Problem - Heap Sort and Priority Queues-Representing Expressions.

PART - A

S.

No.

Question

Competence BTL

1 Define sequence of action and sequence of assertion. Remember BTL 1

2 Show how to prove the correctness of each step and an

algorithm.

Apply

BTL 3

3 Discover the recurrence relation for Ackermann’s function. Apply BTL 3

4 What do you mean by ‘Loop Invariant’? Remember BTL 1

5 Give the proof of correction with Strong induction. Understand BTL 2

6 Define recursion and Iteration with an example. Remember BTL 1

7 Explain Recursive algorithm to count the number of nodes in

a Binary Tree.

Analyze

BTL 4

8 Define precondition and Postcondition. Remember BTL 1

9 Classify the main requi rement s o f an iterative algorithm. Analyze BTL 4

10 Summarize the technical error in iterative algorithm. Evaluate BTL 5

11 Develop an example with more of input and more of output. Create BTL 6

Page 3: VALLIAMMAI ENGINEERING COLLEGE Semester/CP7102-Advanced... · Dual Hill Climbing- Steepest Ascent Hill Climbing-Linear Programming-Recursive ... 3 RTell the computational complexity

3

12 Describe exit condition. Understand BTL 2

13 Assess on recursive programme to find GCD of two numbers. Evaluate BTL5

14 Discuss stack frame. Understand BTL 2

15 Examine tree of stack frame. Apply BTL 3

16 Define the algorithm for Tower of Hanoi problem and give its running time.

Remember BTL 1

17 Pointout algorithm for power of integer. Analyze BTL 4

18 Define forward and backward recursive. Remember BTL 1

19 Generalize sub instance and sub solution. Create BTL 6

20 Summarize algorithm for three tree traversal method. Understand BTL 2

PART-B

1 i) Describe briefly about steps to develop iterative 7 algorithm.

Understand

BTL2 ii) Differentiate sequence of actions Vs. sequence of assertions. 6

2 i) Apply the Towers of Honai problem with three disk. 7 State the time complexity of the algorithm.

Apply

BTL3

ii) Illustrate about the checklist of recursive algorithms. 6

3 i) Write down the recursive algorithm for heap sort 6 problem.

Remember

BTL1 ii) Write and describe an algorithm to search a key k in a N * N matrixin which each row is sorted in ascending order. What is the time complexity of your algorithm. 7

4 i) Give a recursive algorithm to find the kth smallest element of a set S. Write the recurrence equation and 7 perform asymptotic analysis for worst case.

Remember

BTL1 ii) Write an algorithm and examine how to find the next least node in a binary search tree given a node and assess the time complexity of the algorithm. 6

5

i) Given a set of integers with repeated occurrences of

elements. Write an algorithm and identify how to print the

power set of S ensuring that the repeated elements are printed

only once.For example S= {1,2,2} . For the above set S the power

set will be {NULL,{1},{2},{2},{1,2},{1,2},{2,2},{1,2,2}}.

The final output should print {NULL,

{1},{2},{1,2},{2,2},{1,2,2}}. 7

Remember

BTL1

ii) Write a recursive algorithm to find the Kth smallest one

from a set of elements. Also illustrate the above algorithm 6

with suitable examples.

6 i)Explain Ackermann's function using suitable algorithm.how is 7 it used in algorithm analysis?

Analyze

BTL4

ii) Explain in detail about strassen's matrix multiplication algorithm. 6

Page 4: VALLIAMMAI ENGINEERING COLLEGE Semester/CP7102-Advanced... · Dual Hill Climbing- Steepest Ascent Hill Climbing-Linear Programming-Recursive ... 3 RTell the computational complexity

4

7

i) Write and An al y ze recurrence routines to : a. Return the maximum of data fields of nodes in a

binary tree. 13

b. Return the height of the binary tree. c. Return the number of leaves in binary tree.

Analyze

BTL4

8 i) Develop a Pre and Post conditions, checklist and 13 recursive algorithm for Towers of Hanoi problem.

Create BTL6

9 i)Examine the different types of iterative algorithm.Explain each

types with suitable examples.analyse the running time complexities

of the chosen examples. 7

Remember

BTL1

ii)Identify and quote the contrast between backward working

algorithms with forward working algorithm. 6

10

i) Justify the Towers of Hanoi is recursive algorithm and 7 explain the steps.

Evaluate

BTL5 ii)What is priority Queue? Write its advantages. Assess it with an example. 6

11 i) Classify the different types of iterative algorithms.Expalin each types with suitable examples.Analyze the running time complexities of the chosen examples. 13

Apply BTL3

12 i) Describe any searching algorithm in recursive 7 algorithm with basic steps.

Understand

BTL2 ii) Describe any sorting algorithm in recursive algorithm 6 with basic steps.

13 (i)what are types of heap sort strategy? Show Analyze that the heap sort requires o(n log n) number of operations regardless of the order of input. 7

Analyze

BTL4

(ii)explain how recursion can be implemented on trees with suitable example 6

14 i) How can you represent multivariate expressions with binary

trees?Discuss with examples. 13

Understand BTL2

PART-C

Q.NO

Question

Competence BTL

1 Analyse the running time of quick sort for best, worst, 15 average case

Analyze BTL4

2

Convert the given expression into expression tree. Evaluate the expression tree using recursive algorithm. 15 Take your own values of the operands in the expression.

i. ((a+b)*(c/d)/e)

Evaluate

BTL 5

3 Develop an algorithm to search a key K in N*N matrix in which

each row is stored in ascending order. Examine the time 15

complexity of your algorithm.

Create

BTL 6

4 Specify and formulate some recursive algorithms which matches for 15 some problems.

Create BTL 6

Page 5: VALLIAMMAI ENGINEERING COLLEGE Semester/CP7102-Advanced... · Dual Hill Climbing- Steepest Ascent Hill Climbing-Linear Programming-Recursive ... 3 RTell the computational complexity

5

UNIT II

OPTIMISATION ALGORITHMS

S. Optimization Problems-Graph Search Algorithms-Generic Search-Breadth-First Search

Dijkstra’s Shortest-Weighted-Path -Depth-First Search-Recursive Depth-First Search-Linear

Ordering of a Partial Order- Network Flows and Linear Programming-Hill Climbing-Primal

Dual Hill Climbing- Steepest Ascent Hill Climbing-Linear Programming-Recursive

Backtracking-Developing Recursive Backtracking Algorithm- Pruning Branches-Satisfiability

Question

Competence

BTL

par PART - A PART

Q.NO

Question

Competence BTL

1 List the ingredients and specification of optimization problem.

Remember

BTL 1

2 Show the difference between Breadth-First search and Depth-

First search. Apply BTL 3

3 Solve optimization specification for longest common subsequence problem.

Apply

BTL 3

4 write an algorithm to find strongly connected components of a graph.

Remember

BTL 1

5 Give flow problems. Understand BTL 2

6

What is exit condition for dijkstras's algorithm? Remember BTL 1

7

Analyze the ingredients of Optimization problem. Analyze BTL 4

8

Define local and global maximum. Remember BTL 1

9

Explain optimization algorithm. Analyze BTL 4

10

Evaluate on How to prove path is shortest. Evaluate BTL 5

11

What is network flow problem? Generalize its

specification.

Create BTL 6

12

Summarize pruning path and bipartite. Understand BTL 2

13

Compare forward edges and cross edges. Evaluate BTL5

14

Distinguish primal dual hill climbing and steepest ascent hill

climbing.

Understand BTL 2

15

Illustrate min cut specification. Apply BTL 3

16

Define map coloring problem is solved using Recursive Backtracking algorithm.

Remember BTL 1

17

Analyze on satisfiability. Analyze BTL 4

18

What is the running time complexity of 8 Queen’s problem?

Remember BTL 1

19

Compose pruning branch. Create BTL 6

20

Give the steps to fixing the algorithm. Understand BTL 2

Page 6: VALLIAMMAI ENGINEERING COLLEGE Semester/CP7102-Advanced... · Dual Hill Climbing- Steepest Ascent Hill Climbing-Linear Programming-Recursive ... 3 RTell the computational complexity

6

1 i) Using Breadth First Search and optimization techniques describe and solve the shortest path problem. 7

Understand

BTL2 ii)Discuss and write the depth first search iterative algorithm to traverse graph and optimize the same in terms of space and time. 6

2 i) Explain the reachability problem of Graphs with 7 appropriate algorithm and running time analysis.

Analyze

BTL4 ii) which graph search algorithm is more appropriate to test if a graph is bipartite? explain.

3 Tell the computational complexity of single source

shortest path algorithm for the following graph representations.

a. Adjacency matrix representation. 7 b. Adjacency list representation. 6

Remember BTL1

4

i)Write an algorithm and explain the sum of any path from root to leaf such that the sum of all nodes along the path 7 is maximum compared to all other path. Analyze the

algorithm. ii)Explain briefly about network flows with an example. 6

Analyze

BTL4

5

What is acyclic path? Write an algorithm to print all

acyclic paths in a given graph from a node a.

13

Remember

BTL1

6 i) Illustrate DFS with the help of a graph with seven nodes. 7 ii) Demonstrate t he i t e ra t ive and Recursive a lgo r i thm fo r DFS on the same graph ,and compare the i r running t ime . 6

Apply

BTL3

7 i) Judge wh e th e r the problem BFS is belong to graph search algorithm. 7 ii) Linear order consistent can be foundwith given partial order using problem DFS .Justify with example. 6

Evaluate

BTL5

8 i) Demonstrate the concept of Dijkstras shortest weighted path. 6

ii) Examine briefly about generic search algorithm. 7

Analyze

BTL3

9 i)Describe Travelling Salesman Problem with Hill 6 Climbing Algorithm. Discuss the solution.

ii) Write notes on linear programming. 6

Remember

BTL1

10 i) How the primal dual hill climbing achieving 7 global maximum and explain it. ii)Write and Explain down the steps involved in developing a recursive backtracking algorithm for queens problem.6

Remember

BTL1

11 Describe the Steepest hill climbing achieving global 13 maximum and explain it.

Understand BTL2

12 Solve and discuss the shortest path problem using

Optimization techniques & Dijkstra’s shortest weighted 13 path algorithm?

Understand

BTL2

Page 7: VALLIAMMAI ENGINEERING COLLEGE Semester/CP7102-Advanced... · Dual Hill Climbing- Steepest Ascent Hill Climbing-Linear Programming-Recursive ... 3 RTell the computational complexity

7

13 Develop the Dijkstra’s shortest weighted path algorithm with

suitable code, example and l oop invariants. 13

Create BTL6

14 Explain the concept of pruning branches and satisfiability problem 13

Analyze BTL4

PART C

S.

No. Question

Competence BTL

1

Consider a computation of Dijkstra’s algorithm on the

following graph. The algorithm should use Graph search

algorithm.

path weight

1-2 5

1-3 6

1-4 12

2-5 2

2-6 16

3-6 7

4-8 9

5-8 11

6-7 4

6-9 3

7-8 8

7-9 15

15 Evaluate BTL 5

2

Trace BFS and DFS on the following two graphs. For each

do the following:

i. Start at the node s, and when there is a choice,

follow edges from left to right. Number the

node 1, 2, 3…in the order that they are found,

starting with node s=1.

ii. What is the data structure used by each search to

store nodes that are found but not yet handled?

iii. Circle the nodes that are in this data

structure when node 8 is first found

Source node

15 Create BTL 6

3 Starting with the flow given below; complete the network

flow algorithm.(for any graph) 15 Apply BTL 3

Page 8: VALLIAMMAI ENGINEERING COLLEGE Semester/CP7102-Advanced... · Dual Hill Climbing- Steepest Ascent Hill Climbing-Linear Programming-Recursive ... 3 RTell the computational complexity

8

4

How using Optimization techniques & Dijkstra’s shortest

weighted path algorithm are supported for solving the

shortest path problem?

15 Analyze BTL4

UNIT-3

DYNAMIC PROGRAMMING ALGORITHMS

Developing a Dynamic Programming Algorithm-Subtle Points - Question for the Little Bird

Sub-instances and Sub-solutions - Set of Substances-Decreasing Time and Space-Number of

Solutions-Code. Reductions and NP-Completeness – Satisfiability - Proving NP – Completeness

- 3-Coloring - Bipartite Matching. Randomized Algorithms - Randomness to Hide Worst Cases

Optimization Problems with a Random Structure.

Q.NO

Question

Competence BTL

1 Pointout the purpose of two nested loops in dynamic programming.

Analyze

BTL 4

2

Explain about little bird. Evaluate BTL 5

3

Create the chromatic number of a graph.Give example. Create BTL 6

4

Differentiate Monte Carlo and Las Vegas algorithms. Understand BTL 2

5

Summarize the classifications made based on reductions. Evaluate BTL5

6 Describe the format definition of three models of randomized

algorithms.

Understand

BTL 2

7

Illustrate on how can you write a faster dynamic programming

algorithm.

Apply BTL 3

8

Tell how sub instances are created in dynamic programming. Remember BTL 1

9

Analyze ‘Halting problem’. Analyze BTL 4

10

Give an example of print neatly problem. Remember BTL 1

11 Compose reduction problem? List the classification made based on reductions?

Create

BTL 6

12

Discuss circuit satisfiability problem. Understand BTL 2

13

What is memorization? Remember BTL 1

14 Solve NP complete problem. List the three example for NP Complete problem.

Apply

BTL 3

Page 9: VALLIAMMAI ENGINEERING COLLEGE Semester/CP7102-Advanced... · Dual Hill Climbing- Steepest Ascent Hill Climbing-Linear Programming-Recursive ... 3 RTell the computational complexity

9

15

Demonstrate randomized algorithm. Apply BTL 3

16

What is expander graph? Remember BTL 1

17

Express graph colouring. Understand BTL 2

18

How to prove the solution is optimization? Remember BTL 1

19

Compare and contrast cook vs Karp defined reductions. Analyze BTL 4

20

Describe instance map and solution map. Remember BTL 1

PART-B

Q.N

O

Question

Competen

ce

BTL

1 i) Discuss the steps involved in developing dynamic programming algorithm with an example. 7 ii) Write an algorithm for solving 3 coloring problem and reduce time and space complexity of the

algorithm. 6

Understand

BTL2

2 i) Develop an efficient algorithm to calculate the length of the longest common substring in the given two

strings. 7 ii) Consider a bipartite graph G = (V,E) with bipartition (A,B) : V = A U B. Assume that, for some

vertex sets A1 A and B1 B, there exists a matching 6 MA covering all vertices in A1 and a matching MB

covering all vertices in B1. Prove that there always exists a matching covering all vertices in A1 U B1.

Create

BTL6

3 What is the three-color problem? Check whether the given graph is

3-colorable.

Remember BTL1

Page 10: VALLIAMMAI ENGINEERING COLLEGE Semester/CP7102-Advanced... · Dual Hill Climbing- Steepest Ascent Hill Climbing-Linear Programming-Recursive ... 3 RTell the computational complexity

10

4 What is the smallest cut in the graph? Write an algorithm to compute

the minimal cut in the graph shown below and show the output.

Remember BTL1

5 i) Explain on how to decrease time and space in dynamic programming problems. 7 ii) Pointout the steps needed to prove NP 6 completeness and apply it to the 3 Coloring problems.

Analyze BTL4

6

i) What do you mean by “Question of the Little

Bird”? What are the local and global considerations in it? Also assess about repeated Questions and reversing the order. 7

Evaluate

BTL5

ii) “A dynamic programming algorithm is fast only

if the given instance does not have many sub instances”. 6 Justify and prove this statement.

7 i) Demonatrate NP complete problem.Explain the steps for

proving that a computational problem is NP complete with an

example. 7

Apply

BTL3

ii) Justify the problem network flows can use in 6 linear programming and explain it.

8 Demonstrate Randomized Algorithms? Examine how 13 Randomness to Hide Worst Cases.

Apply BTL3

9

Discuss in details about the models for randomness to

hide worst cases in an optimization problem. Highlight 13 any

of the models using quick sort and randomized

counting problem.

Understand

BTL2

10 i) Describe and Reduce the NP Completeness 7 problem and prove it 3-Col < = Poly Course Scheduling

Remember

BTL1 ii) Examine and Reduce the NP Completeness 6 problem and prove it Bipartite < = Poly Network flow.

11 i) Define NP Completeness problem and prove it 7 CIR-SAT < = Poly 3-COL .

Remember

BTL1 ii) Examine how to decrease time and space in dynamic programming problems. 6

12 How randomized primality testing could be performed? 13 Explain with example.

Analyze BTL4

13 Discuss how Bipartie matching could be performed? 13 Explain with an example.

Understand BTL2

14 (i)Explain the concept of about little bird, sub instances and 7 sub-solution.

Analyze BTL4

(ii) write and analyze an algorithm to shuffle an array of length N using randomized approach. 6

Page 11: VALLIAMMAI ENGINEERING COLLEGE Semester/CP7102-Advanced... · Dual Hill Climbing- Steepest Ascent Hill Climbing-Linear Programming-Recursive ... 3 RTell the computational complexity

11

Part C

Q.NO

Question

Question

Competence

Competence

B

T

L

BTL

1

Consider printing neatly the text “this week has seven dates in it ok” in a column with width M=11 and analyse. This

is represented as the printing neatly instance {M; l1,….,ln} = {11;4,4,3,5,5,2,2,2}.

a. Fill in the birdAdvice[0.. n] and cost[0..n] tables for 15 this example the origina l instance, its solution, and

its cost are in the bottom row.

b. When filling in this last row, give solutions

and costs associated with each of the possible bird answers.

ANALYSIS

BTL 4

2

For each of the following problems, Evaluate I, S, Valid(I,S), and Cost(S).

i. Graph coloring: given a graph, color its nodes

so that two nodes do not have the same color

if they have an edge between them. Use as

few colors as possible.

ii. Independent set: given a graph, find a largest

subset of the nodes for which there are no

edges between any pair in the set.

15

iii. Airplane: given the requirements of

an airplane, design it, optimizing its

performance.

iv. Business: given a description of a business,

make a business plan to maximize its profits. v. Factoring: given an integer, factor it, e.g., 6=2x3.

vi. Cryptography: given an encrypted message3,

decode it.

Apply

BTL 5

3 15 Develop Optimization Problems with a Random Structure.

Create BTL6

4 Design network flows and give the use in linear 15 programming and explain it.

Create BTL6

UNIT-IV

SHARED OBJECTS AND CONCURRENT OBJECTS

Shared Objects and Synchronization -Properties of Mutual Exclusion-The Mora l- The

Producer–Consumer Problem -The Readers–Writers Problem-Realities of Parallelization Parallel

Programming- Principles- Mutual Exclusion-Time- Critical Sections—Thread Solutions-The

Filter Lock-Fairness-Lamport’s Bakery Algorithm-Bounded Timestamps-Lower Bounds on the

Number of Locations-Concurrent Objects- Concurrency and Correctness Sequential Objects-

Quiescent Consistency- Sequential Consistency-Linearizability- Formal Definitions- Progress

Conditions- The Java Memory Model

PART -A

Q.NO

Question

Competence BTL

Page 12: VALLIAMMAI ENGINEERING COLLEGE Semester/CP7102-Advanced... · Dual Hill Climbing- Steepest Ascent Hill Climbing-Linear Programming-Recursive ... 3 RTell the computational complexity

12

1 What is mutual exclusion? Show the properties of mutual

exclusion.

Apply

BTL 3

2

List the drawbacks in Bakery lock algorithm. Remember BTL 1

3

Differentiate Transient and Persistent Communication. Understand BTL 2

4.

Tell the principal drawbacks of Sequential Consistency. Remember BTL 1

5. Analyze the need to synchronize producer and consumer in the shared object concepts.

Analyze

BTL 4

6.

Examine the use of quiescent consistency. Remember BTL 1

7.

Describe Lamport's Bakery algorithm. Understand BTL 2

8.

Show the structure of petri net. Apply BTL 3

9.

Define shared object and linearizability. Remember BTL 1

10.

Explain starvation freedom. Analyze BTL 4

11.

List the communication occur in concurrent system. Remember BTL 1

12.

Develop reader and writer problem. Create BTL 6

13.

Express Amdal law. Understand BTL 2

14

What is monitors and semaphores? Remember BTL 1

15

Classify danger zone and end of danger zone. Apply BTL 3

16

Classify the requirements of solution to critical section problem. Analyze BTL 4

17

Compare filter lock with Peterson lock. Evaluate BTL 5

18

Compose fairness. Create BTL 6

19.

Distinguish Lock object state and covering state. Understand BTL 2

20.

Summarize bounded timestamps. Evaluate BTL5

Part B

Q.N

O

Question

Competence BTL

1 i) Write an algorithm for Filter Lock mutual

exclusion protocol and show how it achieves mutual 7 exclusion property.

ii) What is Linearizablity? Explain with example. 6

Remember

BTL1

2 i) Write short notes on Parallel Programming. 7

ii) Explain in detail about the java memory model.how

concurrency is handled is handled in this model? 6

Remember

BTL1

3 Analyse 2-Thread solutions with respect to LockOne,

13 LockTwo and Peterson Lock algorithm.

Analyze BTL4

4

i) Evaluate the Java Memory model with Locks, 7 Volatile and Final fields. ii) Explain Lamport’s bakery algorithm in detail 6 with respect to deadlocks.

Evaluate

BTL5

5. i) Prove and describe upper bound on the time required for a particular process to reach its critical region from the time when it enters in the Lamport’s bakery algorithm. 7

Remember

BTL1

Page 13: VALLIAMMAI ENGINEERING COLLEGE Semester/CP7102-Advanced... · Dual Hill Climbing- Steepest Ascent Hill Climbing-Linear Programming-Recursive ... 3 RTell the computational complexity

13

P A R T -

C

ii) What is the role of semaphores in solving 6 producer consumer problem? Explain.

6. Classify the steps in solving mutual exclusion problem among n processes namely p1,p2,…pn. Write an algorithm

for process pi. 13

Apply

BTL3

7. Explain the strategies for developing Parallel Applications.13 Analyze BTL4

8.

i)Explain lamport’s Bakery algorithm for synchronization

problem and compare it with bounded timestamp algorithm. 7 ii) How to correct concurrent FIFO queue, Analyse with the help of algorithm? 6

Analyze

BTL4

9. (i)Illustrate why quiescent consistent is compositional with an

example. 7 (ii)Showthe contrast between quiescent consistent and

sequential consistent. Highlight with an example the execution

that is quiescent consistent but not sequential consistent and

another that is sequential consistent but not quiescent

consistent. 6

Apply

BTL3

10.

i) Define and Explain the concept of mutual 7 exclusion with example . ii) Narrate briefly about critical section problem in parallel programming. Quote your solution with lock algorithm. 6

Remember

BTL1

11 i) Describe concurrent objects. 7

ii) Discuss about on concurrency and correctness. 6

Understand

BTL2

12. Express an algorithm for filter lock mutual exclusion protocol.

and show how it achieves mutual exclusion property. 13

Understand BTL2

13 Describe the use of semapores in solving readers-writers

problem by tracing the reader-writer solution. 13

Understand BTL2

14 Develop an algorithm to solve two thread problem. 13 Create BTL6

Page 14: VALLIAMMAI ENGINEERING COLLEGE Semester/CP7102-Advanced... · Dual Hill Climbing- Steepest Ascent Hill Climbing-Linear Programming-Recursive ... 3 RTell the computational complexity

14

Part -C

1 Analyze r-bounded waiting for a given mutual exclusion algorithm to mean that if DJa->DKB then then CSJA->CSK+rB there a way to define a doorway for the Peterson algorithm such that it provides r -bounded waiting for some value of r? 15

Analyze

BTL4

2 Programmers at the Flaky Computer Corporation designed the

protocol shown below to achieve n-thread mutual

exclusion, for each question, either sketch a proof, or

display and explain an execution where it fails.

i. Does this protocol satisfy mutual exclusion?

ii. Is this protocol starvation-free?

iii. Is this protocol

deadlock-free?

Class Flaky implements

Lock{ Private int

turn; Private Boolean busy=false; Public void lock(){

Int

me=ThreadID.get();

Do{ Do{3

Public void unlock(){ Busy=false;

}

} 15

Evaluate

BTL5

3 15 Design and discuss about Thread with respect tothe Filter Lock.

Create BTL6

4 15 Develop Lamport’s Bakery Algorithm for mutual exclusion.

Create BTL6

Unit 5

CONCURRENT DATA STRUCTURES

Practice-Linked Lists-The Role of Locking-List-Based Sets-Concurrent Reasoning- Coarse

Grained Synchronization-Fine-Grained Synchronization-Optimistic Synchronization- Lazy

Synchronization-Non-Blocking Synchronization-Concurrent Queues and the ABA Problem -

Queues – A Bounded Partial Queue-An Unbounded Total Queue-An Unbounded Lock-Free

Queue-Memory Reclamation and the ABA Problem- Dual Data Structures- Concurrent Stacks

and Elimination- An Unbounded Lock-Free Stack- Elimination-The Elimination Backoff

Stack

Part A

Q.NO

Question

Competence BTL

1

Generalize the concurrent data structures available. Create BTL 6

2

Give the role of locking in sychronization. Understand BTL 2

3

What is lazy synchronization?List its drawback. Remember BTL 1

4

Show the role of locking in synchronization. Apply BTL 3

Page 15: VALLIAMMAI ENGINEERING COLLEGE Semester/CP7102-Advanced... · Dual Hill Climbing- Steepest Ascent Hill Climbing-Linear Programming-Recursive ... 3 RTell the computational complexity

15

5 Explain how do you implement a List based Set? Give examples.

Analyze

BTL 4

6

Summarize the three different pool methods. Evaluate BTL 5

7

Compose Synchronization. Create BTL 6

8

Give the different varieties of pool? Understand BTL 2

9

Compare coarse-gained synchronization with fine-grained. Evaluate BTL5

10

Show the fine grained synchronization. Apply BTL 3

11

How optimization synchronization is works? Remember BTL 1

12

Describe about ABA problem. Understand BTL 2

13

Tell about the role of locking in concurrent data

structure.unlocking.

Remember BTL 1

14

Explain bounded partial queue. Analyze BTL 4

15

What is unbounded total queue? Remember BTL 1

16

Discuss unbounded lock free queue. Understand BTL 2

17

Examine naive synchronization queue. Apply BTL 3

18

What is elimination back of stack? Remember BTL 1

19

Illustrate elimination array. Analyze BTL 4

20

Tell how dual data structures reduce the synchronization overhead. Remember BTL 1

Part B

Q.N

O

Question

Competence BTL

1

i) Would the lazy algorithm still work if we marked a node as removed simply by setting its next field to

null? Why or Why not? What about the lock-free algorithm? 7 ii) The add() method of the lock-free algorithm never finds a marked node with the same key. Tell how the

algorithm be modified so that it will simply insert its new added object into the existing marked node with same key if such a node exists in the list, thus saving the need to insert a new node? 6

Remember

BTL1

2

What is ABA problem? How it related with memory reclamation Show the steps in the process of memory 13 reclamation using diagram and algorithm?

Remember

BTL1

3

i) Discuss and explain the illustration of an Unbounded Lock Free Queue with an example. 7 ii) Compare Coarse grained synchronization with

fine grained synchronization with appropriate routines and examples. 6

Analyze

BTL4

Page 16: VALLIAMMAI ENGINEERING COLLEGE Semester/CP7102-Advanced... · Dual Hill Climbing- Steepest Ascent Hill Climbing-Linear Programming-Recursive ... 3 RTell the computational complexity

16

4

i) Construct elimination back off stack using a lock- free linearizable stack implementation. 7

ii) How a bounded partial queue, differs from an unbounded one? Explain. 6

Apply

BTL3

5 Describe and discuss the data structures and code used

for concurrent queues. 13 Understand BTL2

6 State ABA problem. Explain and apply the solution with

an example. 13 13

Apply BTL3

7

i) Explain why the fine-grained locking algorithm is not

subject to deadlock. 7 ii) Explain why the optimistic and lazy locking algorithms are not subject to deadlock. 6

Analyze

BTL4

8 Summarize and discuss about unbounded lock free stack

and queue with an example. 13 Evaluate BTL5

9

State the synchronization and List its types. 13 Remember BTL1

10

i)Describe about Concurrent stack with an 7

example. ii) Describe about Concurrent queue. With an example.

6

Understand

BTL2

11

Write in brief about the dual data structures. Mention

some of the examples for each of such data structures 13 and Describe their applications.

Remember

BTL1

12 Perform push and pop operation in an unbounded lock

free stack with the help of code and describe. 13

Understand BTL2

13 Design an bounded lock free stack and specify how elimination problem

is implemented with an example.Also comment on elimination back off

stack. 13

Create BTL6

14 Analyse in detail about memory Reclamation and the ABA problem 13

Analyze BTL4

Part C

1 Analyse how to modify each of the linked list

algorithms if object hash codes are not guaranteed to be 15 unique.

Analyze BTL4

2 Design an algorithm for concurrent linked list with suitable 15 example.

Create BTL6

3 Discriminate about concurrent stack and evaluate how to eliminate

15 it.

Evaluate BTL5

4 Give a Generalize note about the lazy synchronization,

Optimistic 15 synchronization.

Create BTL6