Page 9 - Computer science 868 Class 12
P. 9
variables. The this Operator. Examples of algorithmic problem solving using methods (number problems,
finding roots of algebraic equations etc.).
10. Arrays, Strings
Structured data types – arrays (single and multi-dimensional), address calculations, strings. Example
algorithms that use structured data types (e.g. searching, finding maximum/minimum, sorting
techniques, solving systems of linear equations, substring, concatenation, length, access to char in
string, etc.).
Storing many data elements of the same type requires structured data types – like arrays. Access in
arrays is constant time and does not depend on the number of elements. Address calculation (row
major and column major), Sorting techniques (bubble, selection, insertion). Structured data types can
be defined by classes – String. Introduce the Java library String class and the basic operations on strings
(accessing individual characters, various substring operations, concatenation, replacement, index of
operations). The class StringBuffer should be introduced for those applications that involve heavy
manipulation of strings.
11. Recursion
Concept of recursion, simple recursive methods (e.g. factorial, GCD, binary search, conversion of
representations of numbers between different bases).
Many problems can be solved very elegantly by observing that the solution can be composed of solutions
to ‘smaller’ versions of the same problem with the base version having a known simple solution.
Recursion can be initially motivated by using recursive equations to define certain methods. These
definitions are fairly obvious and are easy to understand. The definitions can be directly converted to a
program. Emphasize that any recursion must have a base case. Otherwise, the computation can go into
an infinite loop.
The tower of Hanoi is a very good example of how recursion gives a very simple and elegant solution
where as non-recursive solutions are quite complex.
SECTION C
Inheritance, Interface, Polymorphism, Data structures, Computational complexity
12. Inheritance, Interfaces and Polymorphism
(a) Inheritance; super and derived classes; member access in derived classes; redefinition of variables
and methods in subclasses; abstract classes; class Object; protected visibility. Subclass polymorphism
and dynamic binding.
Emphasize inheritance as a mechanism to reuse a class by extending it. Inheritance should not
normally be used just to reuse some methods defined in a class but only when there is a genuine
specialization (or subclass) relationship between objects of the super class and that of the derived
class.
(b) Interfaces in Java; implementing interfaces through a class; interfaces for user defined implementation
of behaviour.

