473,411 Members | 1,923 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,411 software developers and data experts.

Your Suggestion

Dear All

I want your suggestion on below implementation so that i can have the most
optimised solution for the below

Lets assume I have the data to encode at the transmitter and decode at the
reciver.

suppose we have high range of data varing from -infity to + infinity

what i decide is that i take the certain range of the above and do the
encoding into the 5 bit.

like the below operation :

00000 -12
00001 -4
00010 0
00011 4
00100 8
00101 12
00110 16
00111 18
01000 20
01001 22
01010 24
01011 26
01100 28
01101 30
01110 32
01111 34
10000 36
10001 38
10010 40
10011 42
10100 44
10101 46
10110 48
10111 50
11000 52
11001 54
11010 56
11011 58
11100 60
11101 62
11110 64
11111 66

the value all below -12 will be taken as 000000
the value all belo -4 will be take as 00001

and so on.........

Now my question is that how to implement this in best fashion????
keeping in all the computation and the memory used into the
system.

My approach that I will enocde the data simple by checking the
values (if it lies with in the range then I will take the above
corresponding Index.)

then I will search the same index (at the decoder end) by making the
look up table in which i will search the corresponding index and
get the data from it.

means if i get the index ( 00101) means 5 then i will
decode this index as the 12.

Now Is this the correct way or what are the issue I have to consider
while facing such problem ( that wheather we have to maintain the
table or just put the values into the memeory and make the search)

Which search algo is the best one while searching the above index values
in the above case. ??

Regards
Ranjeet
Nov 14 '05 #1
2 1298
ranjeet <ra***********@gmail.com> wrote:
I want your suggestion on below implementation so that i can have the most
optimised solution for the below
That's question about an algorithm, not one about C. It would be on-
topic e.g. in comp.programming but not here.

<OT> Lets assume I have the data to encode at the transmitter and decode at the
reciver.
suppose we have high range of data varing from -infity to + infinity
Then you're going to have problems using a computer;-)
what i decide is that i take the certain range of the above and do the
encoding into the 5 bit.
like the below operation : 00000 -12
00001 -4
00010 0
00011 4
00100 8 .... 11011 58
11100 60
11101 62
11110 64
11111 66 the value all below -12 will be taken as 000000
the value all belo -4 will be take as 00001
Using a look-up table is probably the fastest solution and with that
range of data memory consumption normally shouldn't be an issue.

static unsigned char encode_table[ 79 ] = { 1, 1, ...};

unsigned char encode( long int data ) {
if ( ( data += 13 ) < 0 )
return 0;
else if ( data >= 79 )
return 31;
return encode_table[ data ];
}

static long int decode_table[ 32 ] = { -12, -4,... };

long int decode( unsigned char encoded_data ) {
return decode_table[ encoded_data ];
}

Setting up the look-up tables is left as an exercise to the reader;-)
Now Is this the correct way or what are the issue I have to consider
while facing such problem ( that wheather we have to maintain the
table or just put the values into the memeory and make the search)


That sentence doesn't seem to make sense. The table is going to be in
memory and I have no idea what kind of "search" you're talking above.
</OT>
Regards, Jens
--
\ Jens Thoms Toerring ___ Je***********@physik.fu-berlin.de
\__________________________ http://www.toerring.de
Nov 14 '05 #2

"ranjeet" <ra***********@gmail.com> wrote in message
news:77**************************@posting.google.c om...
Dear All

I want your suggestion on below implementation so that i can have the most optimised solution for the below

Lets assume I have the data to encode at the transmitter and decode at the reciver.

suppose we have high range of data varing from -infity to + infinity

what i decide is that i take the certain range of the above and do the
encoding into the 5 bit.

like the below operation :

00000 -12
00001 -4
00010 0
00011 4
00100 8
00101 12
00110 16
00111 18
01000 20
01001 22
01010 24
01011 26
01100 28
01101 30
01110 32
01111 34
10000 36
10001 38
10010 40
10011 42
10100 44
10101 46
10110 48
10111 50
11000 52
11001 54
11010 56
11011 58
11100 60
11101 62
11110 64
11111 66

the value all below -12 will be taken as 000000
the value all belo -4 will be take as 00001

and so on.........

Now my question is that how to implement this in best fashion????
keeping in all the computation and the memory used into the
system.

My approach that I will enocde the data simple by checking the
values (if it lies with in the range then I will take the above
corresponding Index.)

then I will search the same index (at the decoder end) by making the
look up table in which i will search the corresponding index and
get the data from it.

means if i get the index ( 00101) means 5 then i will
decode this index as the 12.

Now Is this the correct way or what are the issue I have to consider
while facing such problem ( that wheather we have to maintain the
table or just put the values into the memeory and make the search)

Which search algo is the best one while searching the above index values
in the above case. ??

There are many studies for to search efficiency, to the best of my
understanding : if your dataset really is huge "suppose we have high range
of data varing from -infity to + infinity" then binary search is the only
way to travel, but this does mean you will need a sorted list, sorted by
data at the transmit side and sorted by encoded data at the recieve side. If
your data set is smaller, such as the sample size you have provided then the
overhead of binary searches are not worth the effort. The other issue is
that if your data set is massive then you need to look at the memory usage,
everything is quicker in RAM but you cant necessarily load it all into RAM.

If you have a clear idea of how large your data set is then this will
determin the search required, unless of course you can establish a
relationship between data and encoded data which can be described by an
expression....

Regards
Ranjeet

Nov 14 '05 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

11
by: John Wellesz | last post by:
Hello, It would be great if there was an option to tell PHP to let the user manage all the HTTP headers instead of sending what it thinks is good for the programmer... For example when you...
7
by: J.Marsch | last post by:
I don't know whether this is the appropriate place to give product feedback, but here goes: I would love to see some kind of diagnostic to let me know when implicit boxing has occurred. We...
192
by: Vortex Soft | last post by:
http://www.junglecreatures.com/ Try it and tell me what's happenning in the Microsoft Corporation. Notes: VB, C# are CLS compliant
1
by: msnews.microsoft.com | last post by:
Hi Every one, I need your suggestion. I want to implement a scenario. The Scenario is "I build a web site. I deploy it to web server. Now I want and auto email alter. The responsibility of...
17
by: Jedrzej Miadowicz | last post by:
I recently (re)discovered data binding in Windows Forms thanks to its advances in Visual Studio 2005. As I looked a little deeper, however, I realize that it still suffers from an irksome tendency...
20
by: Allan Ebdrup | last post by:
I have a suggestion for C# I would like reader/writer locks to be built in to the language. When you want to aquire a loct on an object o you write lock(o) { ...//critical region } I would...
13
by: umpsumps | last post by:
Hello, Here is my code for a letter frequency counter. It seems bloated to me and any suggestions of what would be a better way (keep in my mind I'm a beginner) would be greatly appreciated.. ...
9
by: mgrubbs | last post by:
#include <iostream> using std::cout; using std::cin; using std::endl; int main() { int code = 0; int charges = 0;
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...
0
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.