Professional Documents
Culture Documents
http://www.guideforschool.com/1611744-advice-on-how-to-write-algor...
Number (http://www.guideforschool.com/category/number-related-programs/)
String (http://www.guideforschool.com/category/string-related-programs/)
Array (http://www.guideforschool.com/category/array-related-programs/)
Date (http://www.guideforschool.com/category/date-related-programs/)
Recursion (http://www.guideforschool.com/category/recursion-related-programs/)
(https://twitter.com
/guideforschool)
(http://www.facebook.com
/guideforschool)
(http://www.guideforschool.com
/feed/)
Inheritance (http://www.guideforschool.com/category/inheritance-relatedprograms/)
I have been getting many queries requesting me to upload tutorials on how to write algorithms for a program in the ISC
Computer Science Practical Examination.
Teaching how to write algorithms by writing an article on it is not that effective, but I decided to put down algorithms of two
different programs which would serve as examples on how you should proceed with writing algorithms of your program.
Note: There are various ways in which you can write algorithms. I am putting down the easiest form of writing algorithm. This
style is completely acceptable in ISC Computer Science Practical Examination and really easy to understand. All you need to
do in order to understand the algorithms and write them, is by having in front of yourself, the program whose algorithm is
given below. Go through the program and the algorithm and you will get an idea on how to write algorithms.
After all, writing algorithms isnt a mammoth task as we see it to be. They are just logical steps written in order in an easy to
understand language which when put together in a programming language will result in the solution.
Also Note: Before writing your program in your answer sheet, you need to write the algorithm for it. Now what I would
suggest you to do is, when you get your answer sheet, solve the program you have selected using pencil at the end of your
paper (last 2-3 pages). Write Rough above the pages.
Once you are done with writing the program in pencil, begin writing your answers in fair from the front page. Begin by writing
the algorithm by seeing the rough program you wrote at the back.
Then Write the program in fair using pen, just after your algorithm. Then erase what you wrote in pencil at the last pages of
your answer sheet.
I know you have to write the program twice but it has its own advantages like:
1) You can easily write the algorithm by seeing the program
2) Your final program in fair will be neat as you will just be copying it from the back pages.
3) If you started a program with pencil and after 10 minutes you realize that you should choose other program, you can do so
as you havent written anything in pen yet.
Example 1:
1 of 10
15-02-2015 19:41
http://www.guideforschool.com/1611744-advice-on-how-to-write-algor...
Step 1 :
Start of algotithm
Step 2 :
Step 3 :
Create an integer square array of size n*n which will be the circular matrix
Step 4 :
Declare and initialize variables k = 0 (for filling the matrix), c1 = 0 (for storing index of first column), c2 =
n-1 (for storing index of last column), r1 = 0 (for storing index of first row), r2 = n-1 (for storing index of last row)
Step 5 :
Step 6 :
(a)
Start a for loop from i = c1 to c2, where i increases by 1 every time and perform step (b)
(b)
Store the natural numbers in the first row using A[r1][i] = k++
Step 7 :
(a)
Start a for loop from j = r1+1 to r2, where j increases by 1 every time and perform step (b)
(b)
Store the natural numbers in the last column using A[j][c2] = k++
Step 8 :
(a)
Start a for loop from i = c2-1 to c1, where i decreases by 1 every time and perform step (b)
(b)
Store the natural numbers in the last row using A[r2][i] = k++
Step 9 :
(a)
Start a for loop from j = r2-1 to r1+1, where j decreases by 1 every time and perform step (b)
(b)
Store the natural numbers in the first column using A[j][c1] = k++
Step 10 :
Step 11 :
Step 12 :
End of Algorithm
Example 2:
Example of Algorithm of a program which contains other methods along with the main() method
First see this program: http://www.guideforschool.com/358-isc-2013-question-3-practical-paper-solved/
(http://www.guideforschool.com/358-isc-2013-question-3-practical-paper-solved/)
Note: In such cases, start with first writing the algorithm for the main() method and then the algorithm for the other methods.
Start of algotithm
Step 2 :
2 of 10
15-02-2015 19:41
http://www.guideforschool.com/1611744-advice-on-how-to-write-algor...
Create a StringTokenizer object str to extract tokens (words) from the sentence using space and other the
Start a for loop from i = 0 to less than c and store the tokens of the sentence into the word [ ] array
Step 7 :
Step 8 :
Step 9 :
Call the function isPalin() as : ob.isPalin(word[i]). If the returned value is true then increase the count
If count of palindromic words is not equal to zero, then print the value stored in the variable count
Step 11 :
Step 2 :
Step 3 :
Declare and initialize a String variable rev= for storing the reverse of the String s
Step 4 :
Step 5 :
Extract characters from the end of the original string and add them to the variable rev
Step 6 :
If the reverse word obtained (rev) is equal to the original String (s), then return true, otherwise return false.
Step 7 :
Similarly if you have more functions, then just write their algorithms in a similar fashion one after the other.
This is how you can write algorithms in your ISC Practical Examination. So, as you see, this is nothing but step wise solution
to the given program in English language. So just relax! It isnt a big deal to write algorithms now. You can easily get a 10/10
in the algorithm part now. Smile.
Share this:
Like
Tweet
13
Related
Tweet
LATEST
3 of 10
15-02-2015 19:41
http://www.guideforschool.com/1611744-advice-on-how-to-write-algor...
(http://www.guideforschool.com
)
242 views
MZA (http://www.guideforschool.com/author/guidefs/)
A teacher whose aim is to make Java a fun to learn experience for the school students by
striving to build clear fundamentals of every concepts and helping students to develop their
ability to reason and logically analyze any given programs.
(http://www.guideforschool.com
/author/guidefs/)
VISHAL TIWARI
February 12, 2015 at 9:08 pm (http://www.guideforschool.com/1611744-advice-on-how-to-write-algorithm-in-isc-computerpractical/#comment-1335) - Reply (/1611744-advice-on-how-to-write-algorithm-in-isc-computer-practical
/?replytocom=1335#respond)
MZA
February 12, 2015 at 9:36 pm (http://www.guideforschool.com/1611744-advice-on-how-to-writealgorithm-in-isc-computer-practical/#comment-1337) - Reply (/1611744-advice-on-how-to-writealgorithm-in-isc-computer-practical/?replytocom=1337#respond)
Yes.
Moon
June 17, 2014 at 9:41 pm (http://www.guideforschool.com/1611744-advice-on-how-to-write-algorithm-in-isc-computerpractical/#comment-648) - Reply (/1611744-advice-on-how-to-write-algorithm-in-isc-computer-practical
/?replytocom=648#respond)
4 of 10
15-02-2015 19:41
http://www.guideforschool.com/1611744-advice-on-how-to-write-algor...
Joseph
February 19, 2014 at 10:02 pm (http://www.guideforschool.com/1611744-advice-on-how-to-write-algorithm-in-isc-computer-
(http://www.guideforschool.com
)
practical/#comment-646)
- Reply (/1611744-advice-on-how-to-write-algorithm-in-isc-computer-practical
/?replytocom=646#respond)
dipanjan
February 19, 2014 at 9:05 pm (http://www.guideforschool.com/1611744-advice-on-how-to-write-algorithm-in-isc-computerpractical/#comment-644) - Reply (/1611744-advice-on-how-to-write-algorithm-in-isc-computer-practical
/?replytocom=644#respond)
megha
February 19, 2014 at 6:19 pm (http://www.guideforschool.com/1611744-advice-on-how-to-write-algorithm-in-isc-computerpractical/#comment-640) - Reply (/1611744-advice-on-how-to-write-algorithm-in-isc-computer-practical
/?replytocom=640#respond)
is it necessary to write comments in the program? or is it okay if we just write the variable description? please reply
asap sir.
megha
February 19, 2014 at 6:41 pm (http://www.guideforschool.com/1611744advice-on-how-to-write-algorithm-in-isc-computer-practical/#comment-642) Reply (/1611744-advice-on-how-to-write-algorithm-in-isc-computer-practical
/?replytocom=642#respond)
u mean just a few comments for the main logic of the program will do?
5 of 10
15-02-2015 19:41
http://www.guideforschool.com/1611744-advice-on-how-to-write-algor...
Yes
(http://www.guideforschool.com
)
Anna
February 19, 2014 at 5:33 pm (http://www.guideforschool.com/1611744-advice-on-how-to-write-algorithm-in-isc-computerpractical/#comment-636) - Reply (/1611744-advice-on-how-to-write-algorithm-in-isc-computer-practical
/?replytocom=636#respond)
No.
Anna
February 19, 2014 at 2:30 pm (http://www.guideforschool.com/1611744-advice-on-how-to-write-algorithm-in-isc-computerpractical/#comment-631) - Reply (/1611744-advice-on-how-to-write-algorithm-in-isc-computer-practical
/?replytocom=631#respond)
The 3rd Instruction in the practical question paper is referred to as the documentation:
3. Document the program using mnemonic names / comments, identifying and clearly
describing the choice of data types and meaning of variables.
In this you need to write comments in your program and after you have finished writing your
program, write the Data Description Table for it which consists of mostly 3 columns
Identifier/Variable Name, Data Type and Purpose.
For example: The data description table for the below given code would be:
Code:
1
2
3
4
5
6
7
8
9
10
11
12
13
void isPrime(int n)
{
int c = 0;
for(int i = 1; i<=n; i++)
{
if(n%i == 0)
c++;
}
if(c == 2)
System.out.println("The number is Prime");
else
System.out.println("The number is Not Prime");
}
Data Description:
LATEST
6 of 10
Identifier
Name Data
Type
Purpose www.guideforschool.com | Designed By ICSE 2014 Computer Applications
Paper Solved
(http://www.guideforschool.com/1923453-icse-2014-compu
MZA Designs
15-02-2015 19:41
http://www.guideforschool.com/1611744-advice-on-how-to-write-algor...
int
int
i
int
(http://www.guideforschool.com
)loop control variable
Hope this helps.
Regards,
guideforschool
gopika (http://www.guideforschool.com)
February 19, 2014 at 1:53 pm (http://www.guideforschool.com/1611744-advice-on-how-to-write-algorithm-in-isc-computerpractical/#comment-630) - Reply (/1611744-advice-on-how-to-write-algorithm-in-isc-computer-practical
/?replytocom=630#respond)
sir can u post a simpler code for extracting a word from a sentence.pls.
Yes Gopika, there are alternative codes for extracting words from a sentence. It is up to you to
judge which is simpler and which is not.
Here is a code which extracts words from a sentence and saves it in a String variable w.
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
Anna
February 19, 2014 at 5:39 pm (http://www.guideforschool.com/1611744-advice-on-how-to-writealgorithm-in-isc-computer-practical/#comment-638) - Reply (/1611744-advice-on-how-to-writealgorithm-in-isc-computer-practical/?replytocom=638#respond)
7 of 10
15-02-2015 19:41
http://www.guideforschool.com/1611744-advice-on-how-to-write-algor...
(http://www.guideforschool.com
)
Just note: If there are 2 spaces in between any words or a fullstop followed by a space as in Java is Fun. Said none, the
above code needs to be modified otherwise it will store null strings also in the array.
Just use this syntax: String word[]=s.split([. ]+); where s is the sentence. Similarly you can use other punctuation marks
by putting them inside like this [?!,;. ]+
mdshadab@live.in (http://dark-hackerz.blogspot.com/)
February 19, 2014 at 1:17 pm (http://www.guideforschool.com/1611744-advice-on-how-to-write-algorithm-in-isc-computerpractical/#comment-629) - Reply (/1611744-advice-on-how-to-write-algorithm-in-isc-computer-practical
/?replytocom=629#respond)
Thank You
megha
February 19, 2014 at 1:45 am (http://www.guideforschool.com/1611744-advice-on-how-to-write-algorithm-in-isc-computerpractical/#comment-627) - Reply (/1611744-advice-on-how-to-write-algorithm-in-isc-computer-practical
/?replytocom=627#respond)
is it not okay if in fair itself we first write the program and then the algorithm? does the order matter?
LATEST
8 of 10
15-02-2015 19:41
http://www.guideforschool.com/1611744-advice-on-how-to-write-algor...
(http://www.guideforschool.com
)
/#comment-628) - Reply (/1611744-advice-on-how-to-write-algorithm-in-isc-computer-practical/?replytocom=628#respond)
The correct order is to write algorithm first and then the program. Even in the question paper you are told to follow this order.
Read the instructions given in ISC Practical Papers. Here is one: http://www.guideforschool.com/wp-content/uploads/2013/04
/ISC-2013-Computer-Science-Paper-2-Practical.pdf (http://www.guideforschool.com/wp-content/uploads/2013/04/ISC-2013Computer-Science-Paper-2-Practical.pdf)
Ankita
February 19, 2014 at 4:17 pm (http://www.guideforschool.com/1611744-advice-on-how-to-write-algorithm-in-isccomputer-practical/#comment-633) - Reply (/1611744-advice-on-how-to-write-algorithm-in-isc-computer-practical
/?replytocom=633#respond)
the correct sequence is wat u r saying but leaving 1-2 pages we can start writing the program nd later write
the algo based on our program. ??? can we do this???
megha
February 19, 2014 at 1:43 am (http://www.guideforschool.com/1611744-advice-on-how-to-write-algorithm-in-isc-computerpractical/#comment-626) - Reply (/1611744-advice-on-how-to-write-algorithm-in-isc-computer-practical
/?replytocom=626#respond)
I always faced a problem in writing algorithms. But this post is really helpful. Thankyou.
Post Comment
Notify me of follow-up comments by email.
Notify me of new posts by email.
LATEST
9 of 10
15-02-2015 19:41
http://www.guideforschool.com/1611744-advice-on-how-to-write-algor...
Follow
Tweets
(http://www.guideforschool.com
)
providing
Computer
which
be
We
(http://www.guideforschool.com
(http://www.guideforschool.com
Class 10
/class-12-isc-computer-science
/class-10-icse-computer-
(http://www.guideforschool.com
/download-isc-computer-
application/download-
/class-10-icse-computer-
science-previous-years-
icse-computer-applications-
application/icse-sample-
question-papers/)
previous-years-question-
papers-computer-applications/)
papers/)
| Class 12
easily
downloaded.
Application
you
with
the
20h
@guideforschool
Java Program to check for
Lower Triangular Matrix
wp.me/p5Jiob-8f0j
Tweet to @guideforschool
(http://www.guideforschool.com
/class-12-isc-computer-science
/isc-sample-papers-computerscience/)
LATEST
10 of 10
15-02-2015 19:41