Page 10 - Cs_withBlue_J_C11_Flipbook
P. 10

10.   Arrays, Strings
                       Structured  data  types  –  arrays  (single  and  multi-  dimensional),  strings.  Example  algorithms    that  use
                       structured  data  types  (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. 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).

                                                               SECTION C
                   11.   Basic input/output Data File Handling (Binary and Text)

                       (a)  Basic input/output using Scanner and Printer classes.
                             Input/output exceptions. Tokens in an input stream, concept of whitespace, extracting tokens from an
                           input stream (String Tokenizer class). The Scanner class can be used for input of various types of data
                           (e.g. int, float, char etc.) from the standard input stream. Similarly, the Printer class handles output.
                           Only basic input and output using these classes should be covered.
                           Discuss the concept of a token (a delimited continuous stream of characters that is meaningful in
                           the application program – e.g. words in a sentence where the delimiter is the blank character). This
                           naturally leads to the idea of delimiters and in particular whitespace and user defined characters as
                           delimiters. As an example show how the StringTokenizer class allows one to extract a sequence of
                           tokens from a string with user defined delimiters.
                       (b)  Data File Handling.
                           Need for Data file, Input Stream, Output Stream, Byte Stream (FileInputStream and FileOutputStream),
                           Character Stream (FileReader, FileWriter), Operations- Creation, Reading, Writing, Appending, and
                           Searching.
                   12.   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.

                   13.   Implementation of algorithms to solve problems
                       The students are required to do lab assignments in the computer lab concurrently with the lectures.
                       Programming assignments should be done such that each major topic is covered in at least one assignment.
                       Assignment problems should be designed so that they are sufficiently challenging and make the student
                       do algorithm design, address correctness issues, implement and execute the algorithm in Java and debug
                       where necessary.
                       Self-explanatory.
   5   6   7   8   9   10   11   12   13   14   15