Forum     

Go Back   Digit Technology Discussion Forum > Software > Programming
Register FAQ Calendar Mark Forums Read

Programming The destination for developers - C, C++, Java, Python and the lot


Closed Thread
 
LinkBack Thread Tools Display Modes
Old 07-01-2008, 09:15 PM   #1 (permalink)
Right Off the Assembly Line
 
Join Date: Jul 2007
Posts: 26
Default 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.
garv84 is offline  
Advertisements. Register and be a member of the community to get rid of them.
Advertisement

Old 07-01-2008, 11:25 PM   #2 (permalink)
Commander in Chief
 
QwertyManiac's Avatar
 
Join Date: Jul 2005
Posts: 6,658
Default 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.
QwertyManiac is offline  
Old 08-01-2008, 03:42 PM   #3 (permalink)
Right Off the Assembly Line
 
Join Date: Jul 2007
Posts: 26
Thumbs up Re: RLE Encoding And Decoding using C..plz help.

thats great bro.

Last edited by garv84; 12-01-2008 at 11:08 AM.
garv84 is offline  
Old 08-01-2008, 04:33 PM   #4 (permalink)
18 Till I Die............
 
Join Date: Jul 2004
Location: India, Mumbai, Marine Lines
Posts: 5,792
Default Re: RLE Encoding And Decoding using C..plz help.

How about him giving your exams?
__________________
http://www.bash.org/?258908
mehulved is offline  
Old 08-01-2008, 04:57 PM   #5 (permalink)
Wahahaha~!
 
Faun's Avatar
 
Join Date: Dec 2006
Location: Pune/there
Posts: 7,675
Default Re: RLE Encoding And Decoding using C..plz help.

Quote:
Originally Posted by mehulved View Post
How about him giving your exams?
lol...
__________________
Blog | Flickr | Battlelog
Spoiler:
Asus Z68 V-Pro|i5 2500k|TRUE Black|Ripjaws X|U2311H|N560GTX|D7000|XONAR STX|RE272|RE0|CC51|XE200PRO Walnut| TD II V2| Ultraphile|N5800

Mono
Faun is online now  
Old 08-01-2008, 06:19 PM   #6 (permalink)
Commander in Chief
 
QwertyManiac's Avatar
 
Join Date: Jul 2005
Posts: 6,658
Default Re: RLE Encoding And Decoding using C..plz help.

Quote:
Originally Posted by garv84 View Post
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
QwertyManiac is offline  
Old 08-01-2008, 07:20 PM   #7 (permalink)
Right Off the Assembly Line
 
Join Date: Jul 2007
Posts: 26
Default Re: RLE Encoding And Decoding using C..plz help.

Quote:
Originally Posted by QwertyManiac View Post
No, I need 50$ for that please.
Lol..
Really..?
garv84 is offline  
Old 08-01-2008, 07:25 PM   #8 (permalink)
Commander in Chief
 
QwertyManiac's Avatar
 
Join Date: Jul 2005
Posts: 6,658
Default 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
QwertyManiac is offline  
Old 08-01-2008, 08:13 PM   #9 (permalink)
Wahahaha~!
 
Faun's Avatar
 
Join Date: Dec 2006
Location: Pune/there
Posts: 7,675
Default Re: RLE Encoding And Decoding using C..plz help.

Quote:
Originally Posted by QwertyManiac View Post
why dont u try topcoder and freelance.

I hope u will make enuff for ur work.
__________________
Blog | Flickr | Battlelog
Spoiler:
Asus Z68 V-Pro|i5 2500k|TRUE Black|Ripjaws X|U2311H|N560GTX|D7000|XONAR STX|RE272|RE0|CC51|XE200PRO Walnut| TD II V2| Ultraphile|N5800

Mono

Last edited by Faun; 08-01-2008 at 09:05 PM.
Faun is online now  
Old 08-01-2008, 08:17 PM   #10 (permalink)
Commander in Chief
 
QwertyManiac's Avatar
 
Join Date: Jul 2005
Posts: 6,658
Default 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
QwertyManiac is offline  
Old 08-01-2008, 08:34 PM   #11 (permalink)
Right Off the Assembly Line
 
Join Date: Jul 2007
Posts: 26
Default Re: RLE Encoding And Decoding using C..plz help.

Quote:
Originally Posted by QwertyManiac View Post
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.
garv84 is offline  
Old 08-01-2008, 08:38 PM   #12 (permalink)
Commander in Chief
 
QwertyManiac's Avatar
 
Join Date: Jul 2005
Posts: 6,658
Default 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
QwertyManiac is offline  
Old 10-01-2008, 10:11 PM   #13 (permalink)
Right Off the Assembly Line
 
Join Date: Jul 2007
Posts: 26
Default 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..??
garv84 is offline  
Old 11-01-2008, 11:04 AM   #14 (permalink)
In The Zone
 
ayush_chh's Avatar
 
Join Date: Nov 2005
Location: Bangalore
Posts: 487
Default 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.....
ayush_chh is offline  
Old 11-01-2008, 04:40 PM   #15 (permalink)
Commander in Chief
 
QwertyManiac's Avatar
 
Join Date: Jul 2005
Posts: 6,658
Default Re: RLE Encoding And Decoding using C..plz help.

Quote:
Originally Posted by garv84 View Post
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
QwertyManiac is offline  
Old 11-01-2008, 07:32 PM   #16 (permalink)
Right Off the Assembly Line
 
Join Date: Jul 2007
Posts: 26
Default Re: RLE Encoding And Decoding using C..plz help.

ya.got it.thanx QM..
garv84 is offline  
Old 11-01-2008, 08:38 PM   #17 (permalink)
Commander in Chief
 
QwertyManiac's Avatar
 
Join Date: Jul 2005
Posts: 6,658
Default Re: RLE Encoding And Decoding using C..plz help.

Great, so your solution is ready?
__________________
Harsh J
www.harshj.com
QwertyManiac is offline  
Old 11-01-2008, 10:10 PM   #18 (permalink)
Commander in Chief
 
QwertyManiac's Avatar
 
Join Date: Jul 2005
Posts: 6,658
Default 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
QwertyManiac is offline  
Old 11-01-2008, 10:16 PM   #19 (permalink)
Right Off the Assembly Line
 
Join Date: Jul 2007
Posts: 26
Default 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..?
garv84 is offline  
Old 11-01-2008, 10:20 PM   #20 (permalink)
Commander in Chief
 
QwertyManiac's Avatar
 
Join Date: Jul 2005
Posts: 6,658
Default 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
QwertyManiac is offline  
Old 15-01-2008, 09:26 PM   #21 (permalink)
In The Zone
 
ayush_chh's Avatar
 
Join Date: Nov 2005
Location: Bangalore
Posts: 487
Default Re: RLE Encoding And Decoding using C..plz help.

thank you for explaining me the stuff.....
__________________
eXPerience is what a MAN learn's fROM.....
ayush_chh is offline  
Closed Thread

Bookmarks

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
RLE Encoding And Decoding using C..plz help. garv84 Programming 2 09-01-2008 11:51 AM
Video encoding Cool Buddy Hardware Q&A 4 18-11-2007 12:13 PM
mp3 encoding tukaibatman Software Q&A 4 04-07-2007 11:47 PM
mp3 decoding algorithm setharsh Software Q&A 1 05-06-2007 02:28 PM
about dvd encoding anil_861 Software Q&A 2 08-02-2006 09:42 PM

 
Latest Threads
- by Charan
- by Sarath
- by clmlbx

Advertisement




All times are GMT +5.5. The time now is 12:47 AM.


Powered by vBulletin® Version 3.8.7
Copyright ©2000 - 2012, vBulletin Solutions, Inc.

Search Engine Optimization by vBSEO 3.3.2