 |
07-01-2008, 09:15 PM
|
#1 (permalink)
|
|
Right Off the Assembly Line
Join Date: Jul 2007
Posts: 26
|
Run length Encoding And Decoding
Example input: 123334455555AAA
Output for above input: 1\12\13\34\25\5A\3
Last edited by garv84; 12-01-2008 at 11:08 AM.
|
|
|
|
Advertisements. Register and be a member of the community to get rid of them.
|
|
Advertisement
|
|
07-01-2008, 11:25 PM
|
#2 (permalink)
|
|
Commander in Chief
Join Date: Jul 2005
Posts: 6,658
|
Re: RLE Encoding And Decoding using C..plz help.
[edited as requested]
__________________
Harsh J
www.harshj.com
Last edited by QwertyManiac; 15-01-2008 at 11:31 PM.
|
|
|
08-01-2008, 03:42 PM
|
#3 (permalink)
|
|
Right Off the Assembly Line
Join Date: Jul 2007
Posts: 26
|
Re: RLE Encoding And Decoding using C..plz help.
thats great bro.
Last edited by garv84; 12-01-2008 at 11:08 AM.
|
|
|
08-01-2008, 04:33 PM
|
#4 (permalink)
|
|
18 Till I Die............
Join Date: Jul 2004
Location: India, Mumbai, Marine Lines
Posts: 5,792
|
Re: RLE Encoding And Decoding using C..plz help.
How about him giving your exams?
__________________
http://www.bash.org/?258908
|
|
|
08-01-2008, 04:57 PM
|
#5 (permalink)
|
|
Wahahaha~!
Join Date: Dec 2006
Location: Pune/there
Posts: 7,675
|
Re: RLE Encoding And Decoding using C..plz help.
Quote:
Originally Posted by mehulved
How about him giving your exams?
|
lol...
|
|
|
08-01-2008, 06:19 PM
|
#6 (permalink)
|
|
Commander in Chief
Join Date: Jul 2005
Posts: 6,658
|
Re: RLE Encoding And Decoding using C..plz help.
Quote:
Originally Posted by garv84
thats great bro.cn u plz post the decoding code too..thanxx a lot dudes.. 
|
No, I need 50$ for that please.
__________________
Harsh J
www.harshj.com
|
|
|
08-01-2008, 07:20 PM
|
#7 (permalink)
|
|
Right Off the Assembly Line
Join Date: Jul 2007
Posts: 26
|
Re: RLE Encoding And Decoding using C..plz help.
Quote:
Originally Posted by QwertyManiac
No, I need 50$ for that please. 
|
Lol..
Really..?
|
|
|
08-01-2008, 07:25 PM
|
#8 (permalink)
|
|
Commander in Chief
Join Date: Jul 2005
Posts: 6,658
|
Re: RLE Encoding And Decoding using C..plz help.
Yeh, decoding is a piece of cake thats why. Try making something up and post it here if it doesn't work out. We'll help from there on.
__________________
Harsh J
www.harshj.com
|
|
|
08-01-2008, 08:13 PM
|
#9 (permalink)
|
|
Wahahaha~!
Join Date: Dec 2006
Location: Pune/there
Posts: 7,675
|
Re: RLE Encoding And Decoding using C..plz help.
Quote:
Originally Posted by QwertyManiac
|
why dont u try topcoder and freelance.
I hope u will make enuff for ur work.
Last edited by Faun; 08-01-2008 at 09:05 PM.
|
|
|
08-01-2008, 08:17 PM
|
#10 (permalink)
|
|
Commander in Chief
Join Date: Jul 2005
Posts: 6,658
|
Re: RLE Encoding And Decoding using C..plz help.
Whoa, people pay for getting their homeworks done? Am rich then! $$$$-)
__________________
Harsh J
www.harshj.com
|
|
|
08-01-2008, 08:34 PM
|
#11 (permalink)
|
|
Right Off the Assembly Line
Join Date: Jul 2007
Posts: 26
|
Re: RLE Encoding And Decoding using C..plz help.
Quote:
Originally Posted by QwertyManiac
Yeh, decoding is a piece of cake thats why. Try making something up and post it here if it doesn't work out. We'll help from there on. 
|
ok bro..i'll try it up.
Last edited by garv84; 12-01-2008 at 11:09 AM.
|
|
|
08-01-2008, 08:38 PM
|
#12 (permalink)
|
|
Commander in Chief
Join Date: Jul 2005
Posts: 6,658
|
Re: RLE Encoding And Decoding using C..plz help.
Yeah try and post the problem you face along with what you did here.
__________________
Harsh J
www.harshj.com
|
|
|
10-01-2008, 10:11 PM
|
#13 (permalink)
|
|
Right Off the Assembly Line
Join Date: Jul 2007
Posts: 26
|
Re: RLE Encoding And Decoding using C..plz help.
plz tell me something..
say for ex : 1\125
all thses are characters.we are to print 1 125 tyms.how can we conver characters 125 into integar..??
|
|
|
11-01-2008, 11:04 AM
|
#14 (permalink)
|
|
In The Zone
Join Date: Nov 2005
Location: Bangalore
Posts: 487
|
Re: RLE Encoding And Decoding using C..plz help.
i am not getting this question, can anyone help me understand it?
__________________
eXPerience is what a MAN learn's fROM.....
|
|
|
11-01-2008, 04:40 PM
|
#15 (permalink)
|
|
Commander in Chief
Join Date: Jul 2005
Posts: 6,658
|
Re: RLE Encoding And Decoding using C..plz help.
Quote:
Originally Posted by garv84
plz tell me something..
say for ex : 1\125
all thses are characters.we are to print 1 125 tyms.how can we conver characters 125 into integar..??
|
Use the atoi() function.
@ayush_chh - Run-Length Encoding is used to compress files in which a particular character is repeated several times in succession. Like say we have a file with the content:
Code:
LOOOOOOOOOOOOOOOOOOOOL
Total size: 22 Bytes
Thus using RLE compression technique, we can shorten it as:
Code:
LO\20L
Comment: O\20 means O repeated 20 times. A decoder would look for the \ and the value after it and while expanding it, it'd print it that many times to get the output back in the actual form.
Total size: 6 Bytes
__________________
Harsh J
www.harshj.com
|
|
|
11-01-2008, 07:32 PM
|
#16 (permalink)
|
|
Right Off the Assembly Line
Join Date: Jul 2007
Posts: 26
|
Re: RLE Encoding And Decoding using C..plz help.
ya.got it.thanx QM..
|
|
|
11-01-2008, 08:38 PM
|
#17 (permalink)
|
|
Commander in Chief
Join Date: Jul 2005
Posts: 6,658
|
Re: RLE Encoding And Decoding using C..plz help.
Great, so your solution is ready?
__________________
Harsh J
www.harshj.com
|
|
|
11-01-2008, 10:10 PM
|
#18 (permalink)
|
|
Commander in Chief
Join Date: Jul 2005
Posts: 6,658
|
Re: RLE Encoding And Decoding using C..plz help.
Scalability would mean basically some kind of increase. Maybe you can add an option of including more than one file into the program for compression in one go and that would make it scalable.
Optimizing the program for more power at less CPU cost would also mean the same in certain cases.
Modularity would mean dividing the program into sub-programs (read as: functions). So make a function for encoding, decoding, 255 chop, and so on. Just split them so that if there is a new function to be added, it can make use of certain feature of this entire RLE exclusively.
Basically speaking, divide your program into sub programs. One function for decode, another for encode and so on. And collectively call them in main() to do a task thus accomplishing 'modularity'.
__________________
Harsh J
www.harshj.com
|
|
|
11-01-2008, 10:16 PM
|
#19 (permalink)
|
|
Right Off the Assembly Line
Join Date: Jul 2007
Posts: 26
|
Re: RLE Encoding And Decoding using C..plz help.
But i have implemented the encoding and the decoding in two different programs.will it be possible to call them as seperate functions in the main() method of a single program ..? or you mean to say calling a func encode() from main() in one and the other from the other prgrm..?
and hw to find the performance..do i need to calculate the complexity..?
|
|
|
11-01-2008, 10:20 PM
|
#20 (permalink)
|
|
Commander in Chief
Join Date: Jul 2005
Posts: 6,658
|
Re: RLE Encoding And Decoding using C..plz help.
Two programs is fine too. But you can make it more easier by combining it into one can't you? You can detect the type of input file and perform the necessary execution (Encode or Decode) appropriately? Thats just my idea. But having 2 different programs is fine too, in modularity terms.
You can try increasing performance by modifying certain parts of your program. Its your style dependent. A small example (Unrelated to RLE perhaps) would be to replace that if-else ladder with a more optimized switch-case block. Things like that.
__________________
Harsh J
www.harshj.com
|
|
|
15-01-2008, 09:26 PM
|
#21 (permalink)
|
|
In The Zone
Join Date: Nov 2005
Location: Bangalore
Posts: 487
|
Re: RLE Encoding And Decoding using C..plz help.
thank you for explaining me the stuff.....
__________________
eXPerience is what a MAN learn's fROM.....
|
|
|
| Thread Tools |
|
|
| Display Modes |
Linear Mode
|
Posting Rules
|
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts
HTML code is Off
|
|
|
|
|
|