Click here to Skip to main content
15,916,463 members
Home / Discussions / Algorithms
   

Algorithms

 
GeneralRe: Display Equations in Articles Pin
Ju@ncho14-Nov-07 8:31
Ju@ncho14-Nov-07 8:31 
QuestionStoring more values in single BYTE. Pin
Sameerkumar Namdeo5-Nov-07 22:29
Sameerkumar Namdeo5-Nov-07 22:29 
JokeRe: Storing more values in single BYTE. Pin
CPallini6-Nov-07 2:08
mveCPallini6-Nov-07 2:08 
JokeRe: Storing more values in single BYTE. Pin
El Corazon6-Nov-07 3:29
El Corazon6-Nov-07 3:29 
GeneralRe: Storing more values in single BYTE. Pin
CPallini6-Nov-07 3:33
mveCPallini6-Nov-07 3:33 
JokeRe: Storing more values in single BYTE. Pin
El Corazon6-Nov-07 4:01
El Corazon6-Nov-07 4:01 
AnswerRe: Storing more values in single BYTE. Pin
Dan Neely6-Nov-07 2:14
Dan Neely6-Nov-07 2:14 
AnswerRe: Storing more values in single BYTE. Pin
Sameerkumar Namdeo6-Nov-07 19:33
Sameerkumar Namdeo6-Nov-07 19:33 
Thanks all for correcting my question and giving suggestion.

I am having 2D array of size say 1000*1000
In this 2D array each element has any value between 0 to 999999
So decided to take int Aint[1000][1000] as array.
There are only 300 unique elements in this array and all other elements are repeated,
i.e this array has repeated values with only 300 unique values.

Also this array takes 1000*1000*4 = 4000000 bytes.

So I am trying to construct an array
int u[300] which will contain the unique values from Aint[1000][1000].

And instead of making int Aint[1000][1000] I decided to make BYTE Abyte[1000][1000] as my 2D array.
Now this Abyte 2D array's elements should contain any values from 0 to 299.

Previously:
int value = Aint[750][750] = 999999;

Now I will fetch value in this manner:
Abyte[750][750] = 290;<br />
u[290] = 999999; <br />
int value = u[ Abyte[750][750] ] = 999999;


But problem is Abyte's element can have values between 0 and 255.

I need to store 290 in single BYTE.

This approach has reduced memory requirement from 4000000 Bytes ( sizeof(Aint) )
to
1001200 bytes ( sizeof (Abyte) + sizeof(u) )

With this approach page faults can be reduced.


Thanks & Regards.
GeneralRe: Storing more values in single BYTE. Pin
Dan Neely7-Nov-07 2:19
Dan Neely7-Nov-07 2:19 
GeneralRe: Storing more values in single BYTE. Pin
Sameerkumar Namdeo7-Nov-07 17:04
Sameerkumar Namdeo7-Nov-07 17:04 
AnswerRe: Storing more values in single BYTE. Pin
sgorozco28-Nov-07 19:52
sgorozco28-Nov-07 19:52 
QuestionRelative Speed of Trigonometry functions Pin
MikeMarq4-Nov-07 6:46
MikeMarq4-Nov-07 6:46 
AnswerRe: Relative Speed of Trigonometry functions Pin
Luc Pattyn4-Nov-07 6:59
sitebuilderLuc Pattyn4-Nov-07 6:59 
AnswerRe: Relative Speed of Trigonometry functions Pin
Paul Conrad4-Nov-07 7:31
professionalPaul Conrad4-Nov-07 7:31 
AnswerRe: Relative Speed of Trigonometry functions Pin
cmk4-Nov-07 10:22
cmk4-Nov-07 10:22 
GeneralRe: Relative Speed of Trigonometry functions Pin
Paul Conrad4-Nov-07 10:53
professionalPaul Conrad4-Nov-07 10:53 
GeneralRe: Relative Speed of Trigonometry functions Pin
Dan Neely5-Nov-07 2:20
Dan Neely5-Nov-07 2:20 
GeneralRe: Relative Speed of Trigonometry functions Pin
Paul Conrad5-Nov-07 12:05
professionalPaul Conrad5-Nov-07 12:05 
GeneralRe: Relative Speed of Trigonometry functions Pin
Dan Neely5-Nov-07 12:46
Dan Neely5-Nov-07 12:46 
GeneralRe: Relative Speed of Trigonometry functions Pin
Paul Conrad5-Nov-07 14:05
professionalPaul Conrad5-Nov-07 14:05 
GeneralRe: Relative Speed of Trigonometry functions Pin
Robodroid17-Jan-08 10:15
Robodroid17-Jan-08 10:15 
GeneralRe: Relative Speed of Trigonometry functions Pin
MikeMarq4-Nov-07 19:54
MikeMarq4-Nov-07 19:54 
GeneralRe: Relative Speed of Trigonometry functions Pin
cp98764-Nov-07 22:27
cp98764-Nov-07 22:27 
AnswerRe: Relative Speed of Trigonometry functions Pin
Luc Pattyn5-Nov-07 2:36
sitebuilderLuc Pattyn5-Nov-07 2:36 
AnswerRe: Relative Speed of Trigonometry functions Pin
Alan Balkany29-Nov-07 5:02
Alan Balkany29-Nov-07 5:02 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.