Академический Документы
Профессиональный Документы
Культура Документы
1. What is event-driven programming? 2. How is delegation-based event handling better than traditional, procedural event-handling? Explain. 3. What is an Interface class? Why does Java have classes like this for us the client programmers? 4. What are the three main concepts in event-driven programming? Event sources, event listeners, event handlers. Describe them. And discuss how event handling can be achieved using these three concepts. Can you draw a diagram to show this? 5. What is a prototype method? Provide one example. Why does a client programmer need to use "implements" when using, say, the ActionListener class? What are the "impositions" on a client programmer that come with "implements"? ==============================================================================
Java distinguish these two exceptions? 10. What are some examples of checked exceptions? What are some examples of unchecked exceptions? ==============================================================================
Assuming sorting in ascending order: What does the list look like after 4 passes of insertion sort? What does the list look like after 4 passes of exchange sort? What does the list look like after 4 passes of selection sort? Then by looking at the partially sorted lists of these three, can you recognize interesting differences among the three algorithms? For example, if say, Alibaba is in a hurry, and would like to be able to announce the largest number as soon as possible, the second largest number as soon as possible after that, etc., which algorithm would be the MOST appropriate for Alibaba to use? 3. What is heapsort? Explain the algorithm of heapsort. a. What is a heap? b. What are the two key phases? c. Under each phase, what are the steps? d. Can you describe the algorithm from beginning to the end (precisely so that others can implement it without any ambiguity)? 4. Why is heapsort faster than basic sorting algorithms? 5. In terms of complexity, what are the Big-O values for linear search, binary search, basic sorts, and heapsort? 6. How does one implement in-place selection sort? in-place heapsort? 7. How does one represent a binary tree like a heap in an array?