Suppose I want to allow users of my app to rank holidays by attaching a number to each of them, then I want my app to sort them, what is the easiest way of achieving this? Please see below
I thought about concatenating a number to each string and then placing the strings in an array. Then loop through the array, checking if the string in each array index contains a number. Next sort the strings using bubble sort. Finally remove the numbers from these strings.
Is this the easiest way of ranking and then sorting them or is there a better way?
By supplying an override of ToString, I can still just write out the item without having to specify ImportantDate outside of this structure, so I would still appear to be following the semantics of the string type that you are used to. Now, sorting is as simple as:
Another easy way to do this is using Dictionary<int, string>[^] type. This type will hold the weight assigned to vacation, as well as the name of it in string. Then you can easily sort them using their key.
You need to store both of values (name + weight given) to the dictionary, no additional type generation is required as the dictionary object is a generic type.
This[^] link has a wonderful example of what you are trying to achieve.
The sh*t I complain about
It's like there ain't a cloud in the sky and it's raining out - Eminem
~! Firewall !~
This algorithms are text based.Do not tell me convert image to base64 because suppose that an image 10 mb convert base64 than output is 15 mb so image represent 15 mb ,algortihms compress then compresed file is 12 mb this is reverse compression.I want better compressionCould you help me ?
Basically? Don't. Huffman and RLE are text based - they only work at all well with data in which there there are "commonly used" characters and "uncommonly used" characters, or "runs" of identical data - binary data such as an image does not generally exhibit this, except in unusual circumstances. When you add in that PNG and CR2 files are already compressed using a lossless method, and you will find that basic (or even advanced) compression techniques do not work well in gaining further size reduction anyway. Bitmaps compress well using normal compression for binary data such as ZIP, but PNG and CR2 don't. None of them will give significant results with Huffman or RLE compression.
Bad command or file name. Bad, bad command! Sit! Stay! Staaaay...
You have to cherry pick the image. Most image formats are already compressed and will not compress further with huffman and/or RLE.
Stop looking at the image itself and start looking at the data in the file if you want to look at how you're going to compress what has already been compressed.
In a compressed image, there are no "run lengths". They've already been compressed, so RLE isn't going to do anything at all. Also, Huffman, or some derivative of it, has probably already been used on the image so that's not going to get you anywhere either.
The algorithms you've chosen will only work on uncompressed formats, like .BMP.
I want to know how to compress the image in the uncompressed form. These algorithms are text based. Base64 does not work. There must be another way. You are asking me to repeat the questions instead of helping me.
I'm not asking you to repeat the questions; I'm saying that the answers you get aren't going to change just because you ask them again. Apart from bitmaps and RAW files, graphics files tend to be compressed which means that you're not going to get the benefits you think you're going to get. You do understand graphic file formats don't you? If not, I suggest that you need to go and read up on them before you try anything else.
This space for rent
Last Visit: 31-Dec-99 19:00 Last Update: 23-Feb-17 23:49