Dale - Computer Science Illuminated 342

# Dale - Computer Science Illuminated 342 - access structure...

This preview shows page 1. Sign up to view the full content.

Exercises 315 Questions 14 through 15 use the following list of values. 14. How many comparisons does it take using a sequential search to find the following values or determine that the item is not in the list? a. 4 d. 105 b. 44 e. 106 c. 45 15. How many comparisons does it take using a binary search to find the following values or determine that the item is not in the list? a. 4 d. 105 b. 44 e. 106 c. 45 16. A binary search is a natural recursive algorithm. It can also be written as an iterative algorithm. Write the iterative version of the algorithm. 17. What are the characteristics of the ADT stack? 18. What are the characteristics of the ADT queue? 19. Which of the following is true of stacks and queues? a. A stack is a last-in, first-out structure, and a queue is a first-in, first-out structure. b. A stack is a first-in, first-out structure, and both structures are random access structures. c. A stack is a last-in, first-out structure, and a queue is a random-
This is the end of the preview. Sign up to access the rest of the document.

Unformatted text preview: access structure. d. A queue is a last-in, first-out structure, and a stack is a first-in, first-out structure. e. A queue is a first-in, first-out structure, and a stack is a random-access structure. 20. Write the algorithm for Push in an array-based implementation. 21. Write the algorithm for Pop in an array-based implementation. 22. Write the algorithm for Enque in an array-based implementation. 23. Write the algorithms for Deque in an array-based implementation. 24. Write the algorithm for Push in a linked implementation. 25. Write the algorithm for Pop in a linked implementation. 26. Write the algorithm for Enque in a linked implementation. 27. Write the algorithms for Deque in a linked implementation. 10 length [0] list [1] [2] [3] [4] [5] [6] [7] [8] [9] [10] 5 7 20 33 44 46 48 99 101 102 105...
View Full Document

{[ snackBarMessage ]}

Ask a homework question - tutors are online