Presentation is loading. Please wait.

Presentation is loading. Please wait.

Sorts and Searching.

Similar presentations


Presentation on theme: "Sorts and Searching."— Presentation transcript:

1 Sorts and Searching

2 Reminder PA4 – Due on Thursday to submit by 10pm. Penalties apply after this date.

3 Inheritance and default constructors
If a class has no default constructor (a constructor that takes in no arguments), but does contain explicit value constructors, the child classes MUST make an explicit call to “super’s” constructor. If a class has a default constructor or no constructor (meaning that the system will supply the default constructor), then it is not necessary to make an explicit call to super’s constructor.

4 Rationale If the parent can only be constructed using explicit values, then its children must provide those values just like any user of the class must provide the values. If the compiler does not see this explicit call in the children, it will provide an error message.

5 Stuff from lab 19 The ArrayList is a generic class.
Without specifying a substitution type (<Double>), you get warning messages. If you specify a substitution type, they go away. Moral of the story, use a specific type when you build your ArrayLists. You may still make ArrayLists that will hold any kind of object; just specify Object as the type. toArray method – see Java API.

6 Sorts and Searches Traditional algorithms Many algorithms for sorting
You will study some of these in more detail next semester. We will look at a couple of the simpler algorithms.

7 You will be responsible for:
Insertion sort Selection sort Bubble sort Linear search Binary search

8 Resources Web Introduction to Computer Science, chapter 6.4 and 6.5
Lewis and Loftus 9.4 and 9.5

9 Visual demonstrations of sorts


Download ppt "Sorts and Searching."

Similar presentations


Ads by Google