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 2 1314
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.programmin g 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***********@p hysik.fu-berlin.de
\______________ ____________ http://www.toerring.de
"ranjeet" <ra***********@ gmail.com> wrote in message
news:77******** *************** ***@posting.goo gle.com... 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 This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics |
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 write:
header("Status: 200 OK");
header("Location: /my_internal_redirected_page.php");
|
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 have had a few instances where one developer or another was working on
code, and did not realize that by passing their value type to a method that
accepted an object parameter (or in many cases, a delegate).
|
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
|
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 this alter is that it will send the emails to registered users whether my site is hit by the user or not. It will work independently."
For that what you suggest me to implement it in .NET Technology.
Can I implement it using .NET Web Services.
|
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 to stick a whole
bunch of literal strings in my code. Quite frankly, I consider them a
plague imposed on developers by the RAD designers that come with Visual
Studio. The problem with using literal strings to refer to controls, data
sources,...
| |
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 like to be able to write:
readlock(o)
|
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..
def valsort(x):
res =
for key, value in x.items():
res.append((value, key))
|
by: mgrubbs |
last post by:
#include <iostream>
using std::cout;
using std::cin;
using std::endl;
int main()
{
int code = 0;
int charges = 0;
|
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, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look !
Part I. Meaning of...
|
by: Hystou |
last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it.
First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
|
by: Oralloy |
last post by:
Hello folks,
I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>".
The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed.
This is as boiled down as I can make it.
Here is my compilation command:
g++-12 -std=c++20 -Wnarrowing bit_field.cpp
Here is the code in...
| |
by: Hystou |
last post by:
Overview:
Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
|
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, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own....
Now, this would greatly impact the work of software developers. The idea...
|
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 presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules.
He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms.
Adolph will...
|
by: adsilva |
last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
|
by: 6302768590 |
last post by:
Hai team
i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
|
by: bsmnconsultancy |
last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...
| |