I am trying to get a count of all the times when byte sequences occur in other byte sequences. However, he cannot reuse bytes if he has already counted them. For example, for the string kkkkkk , suppose the byte sequence was kk , then it will find only 3 occurrences, not 5, because they will be split as: [kk].[kk].[kk]. and not like [k.[k].[k].[k].[k].k] , where they are above the circle and essentially just shift 2 to the right.
Ideally, the idea is to get an idea of ββwhat a compression dictionary or runtime encoding might look like. so the goal would be to get
kkkkkk in two parts, since (kkk) is the largest and best character you can have.
Here is the source:
using System; using System.Collections.Generic; using System.Collections; using System.Linq; using System.Text; using System.IO; static class Compression { static int Main(string[] args) { List<byte> bytes = File.ReadAllBytes("ok.txt").ToList(); List<List<int>> list = new List<List<int>>(); // Starting Numbers of bytes - This can be changed manually. int StartingNumBytes = bytes.Count; for (int i = StartingNumBytes; i > 0; i--) { Console.WriteLine("i: " + i); for (int ii = 0; ii < bytes.Count - i; ii++) { Console.WriteLine("ii: " + i); // New pattern comes with refresh data. List<byte> pattern = new List<byte>(); for (int iii = 0; iii < i; iii++) { pattern.Add(bytes[ii + iii]); } DisplayBinary(bytes, "red"); DisplayBinary(pattern, "green"); int matches = 0; // foreach (var position in bytes.ToArray().Locate(pattern.ToArray())) for (int position = 0; position < bytes.Count; position++) { if (pattern.Count > (bytes.Count - position)) { continue; } for (int iiii = 0; iiii < pattern.Count; iiii++) { if (bytes[position + iiii] != pattern[iiii]) { //Have to use goto because C
Refer to the message to get a non-binary file, here are the binary data: 011010110010111001101011001011100110101100101110011010110010111001101011001011100110101100101110 I hope that it will be less than it started.
source share