Home » Ask & Discuss » Board Exams - CBSE, ICSE, State Boards » Computer Science « Back to Discussion



Computer Science

anchal singhal's Avatar
Blazing goIITian

Joined: 21 Aug 2008
Post: 380
22 Apr 2009 22:40:20 IST
0 People liked this
2
288 View Post
Write an algorithm to shift all the odd integers of a linear array towards left hand side and all th
None

Write an algorithm to shift all the odd integers of a linear array towards left hand side and all the even integers towards Rigth hand side..


Share this article on:

Comments (2)

anchal singhal's Avatar

Blazing goIITian

Joined: 21 Aug 2008
Posts: 380
23 Apr 2009 20:03:21 IST
0 people liked this

plz reply..
Gautham's Avatar

New kid on the Block

Joined: 10 Mar 2008
Posts: 24
2 May 2009 13:11:18 IST
0 people liked this

create a new temporary array (same size as original array) using pointers and new operator.

check for oddness of elements in original array using a loop (from left to right) and copy them into temporary array from left to right.

then check for even nos in original array from left to right and fill them in temporary array from where you stopped.

Copy contents of temporary array into original array.

delete temporary array.

close function.

SIMPLE




Quick Reply


Reply

Some HTML allowed.
Keep your comments above the belt or risk having them deleted.
Signup for a avatar to have your pictures show up by your comment
If Members see a thread that violates the Posting Rules, bring it to the attention of the Moderator Team
Free Sign Up!

Preparing for IIT-JEE ?

Arihant Revision Package for IIT JEE - Books, Practice Tests + Rank Predictor


@ INR 1,995/-

For Quick Info

Name

Mobile No.

Find Posts by Topics

Physics.

Topics

Mathematics.

Chemistry.

Biology

Parents

Board

Fun Zone

Sponsored Ads