Is there a fast method for doing this?
-
Hi, I have a data structure as followings. I need that insert some data in order to make the data looks completely. In the data, the x[0], x[1], x[2] and x[3] are timecode: represents hour, minutes, second and frame (here 1 second = 30 frames), respectively. The other important data is x[5], when you insert some new timecode with contimuous frame, the x[5] should also be inserted with a Linear insert method. The rest data should be same with others. I found that it is slowly when the length of the data is large. So is there a fast method for doing this ? The data looks like this: ------------------------------------------------------------ x[0] x[1] x[2] x[3] x[4] x[5] x[6], ... x[13] 00 02 14 19 0 41 0 4 2 3 0 15 15 0 00 02 14 20 0 42 0 4 2 3 0 15 15 0 00 02 14 22 0 44 0 4 2 3 0 15 15 0 00 02 14 23 0 46 0 4 2 3 0 15 15 0 00 02 14 25 0 47 0 4 2 3 0 15 15 0 00 02 14 26 0 48 0 4 2 3 0 15 15 0 00 02 14 27 0 49 0 4 2 3 0 15 15 0 00 02 14 28 0 50 0 4 2 3 0 15 15 0 00 02 15 00 0 51 0 4 2 3 0 15 15 0 00 02 15 01 0 53 0 4 2 3 0 15 15 0 00 02 15 02 0 54 0 4 2 3 0 15 15 0 00 02 15 03 0 56 0 4 2 3 0 15 15 0 00 02 15 04 0 57 0 4 2 3 0 15 15 0 00 02 15 05 0 58 0 4 2 3 0 15 15 0 00 02 15 06 0 59 0 4 2 3 0 15 15 0 00 02 15 07 0 60 0 4 2 3 0 15 15 0 00 02 15 08 0 61 0 4 2 3 0 15 15 0 00 02 15 09 0 63 0 4 2 3 0 15 15 0 00 02 15 10 0 64 0 4 2 3 0 15 15 0 00 02 15 12 0 68 0 4 2 3 0 15 15 0 00 02 15 13 0 69 0 4 2 3 0 15 15 0 00 02 15 14 0 71 0 4 2 3 0 15 15 0 00 02 15 15 0 72 0 4 2 3 0 15 15 0 00 02 15 16 0 73 0 4 2 3 0 15 15 0 00 02 15 17 0 74 0 4 2 3 0 15 15 0 00 02 15 18 0 75 0 4 2 3 0 15 15 0 00 02 15 19 0 77 0 4 2 3 0 15 15 0 00 02 15 24 0 89 0 4 2 3 0 15 15 0 00 02 15 25 0 90 0 4 2 3 0 15 15 0 00 02 15 26 0 91 0 4 2 3 0 15 15 0 00 02 15 27 0 93 0 4 2 3 0 15 15 0 00 02 15 28 0 95 0 4 2 3 0 15 15 0 00 02 15 29 0 96 0 4 2 3 0 15 15 0 ............ --------------------------------------------------- For example, for the first three raws: it should be changed as follows: 00 02 14 19 0 41 0 4 2 3 0 15 15 0 00 02 14 20 0 42 0 4 2 3 0 15 15 0 00 02 14 21 0 43 0 4 2 3 0 15 15 0 ==> inserted line 00 02 14 22 0 44 0 4 2 3 0 15 15 0 ======================================= Thanks in advance!
-
Hi, I have a data structure as followings. I need that insert some data in order to make the data looks completely. In the data, the x[0], x[1], x[2] and x[3] are timecode: represents hour, minutes, second and frame (here 1 second = 30 frames), respectively. The other important data is x[5], when you insert some new timecode with contimuous frame, the x[5] should also be inserted with a Linear insert method. The rest data should be same with others. I found that it is slowly when the length of the data is large. So is there a fast method for doing this ? The data looks like this: ------------------------------------------------------------ x[0] x[1] x[2] x[3] x[4] x[5] x[6], ... x[13] 00 02 14 19 0 41 0 4 2 3 0 15 15 0 00 02 14 20 0 42 0 4 2 3 0 15 15 0 00 02 14 22 0 44 0 4 2 3 0 15 15 0 00 02 14 23 0 46 0 4 2 3 0 15 15 0 00 02 14 25 0 47 0 4 2 3 0 15 15 0 00 02 14 26 0 48 0 4 2 3 0 15 15 0 00 02 14 27 0 49 0 4 2 3 0 15 15 0 00 02 14 28 0 50 0 4 2 3 0 15 15 0 00 02 15 00 0 51 0 4 2 3 0 15 15 0 00 02 15 01 0 53 0 4 2 3 0 15 15 0 00 02 15 02 0 54 0 4 2 3 0 15 15 0 00 02 15 03 0 56 0 4 2 3 0 15 15 0 00 02 15 04 0 57 0 4 2 3 0 15 15 0 00 02 15 05 0 58 0 4 2 3 0 15 15 0 00 02 15 06 0 59 0 4 2 3 0 15 15 0 00 02 15 07 0 60 0 4 2 3 0 15 15 0 00 02 15 08 0 61 0 4 2 3 0 15 15 0 00 02 15 09 0 63 0 4 2 3 0 15 15 0 00 02 15 10 0 64 0 4 2 3 0 15 15 0 00 02 15 12 0 68 0 4 2 3 0 15 15 0 00 02 15 13 0 69 0 4 2 3 0 15 15 0 00 02 15 14 0 71 0 4 2 3 0 15 15 0 00 02 15 15 0 72 0 4 2 3 0 15 15 0 00 02 15 16 0 73 0 4 2 3 0 15 15 0 00 02 15 17 0 74 0 4 2 3 0 15 15 0 00 02 15 18 0 75 0 4 2 3 0 15 15 0 00 02 15 19 0 77 0 4 2 3 0 15 15 0 00 02 15 24 0 89 0 4 2 3 0 15 15 0 00 02 15 25 0 90 0 4 2 3 0 15 15 0 00 02 15 26 0 91 0 4 2 3 0 15 15 0 00 02 15 27 0 93 0 4 2 3 0 15 15 0 00 02 15 28 0 95 0 4 2 3 0 15 15 0 00 02 15 29 0 96 0 4 2 3 0 15 15 0 ............ --------------------------------------------------- For example, for the first three raws: it should be changed as follows: 00 02 14 19 0 41 0 4 2 3 0 15 15 0 00 02 14 20 0 42 0 4 2 3 0 15 15 0 00 02 14 21 0 43 0 4 2 3 0 15 15 0 ==> inserted line 00 02 14 22 0 44 0 4 2 3 0 15 15 0 ======================================= Thanks in advance!
-
Hi, I have a data structure as followings. I need that insert some data in order to make the data looks completely. In the data, the x[0], x[1], x[2] and x[3] are timecode: represents hour, minutes, second and frame (here 1 second = 30 frames), respectively. The other important data is x[5], when you insert some new timecode with contimuous frame, the x[5] should also be inserted with a Linear insert method. The rest data should be same with others. I found that it is slowly when the length of the data is large. So is there a fast method for doing this ? The data looks like this: ------------------------------------------------------------ x[0] x[1] x[2] x[3] x[4] x[5] x[6], ... x[13] 00 02 14 19 0 41 0 4 2 3 0 15 15 0 00 02 14 20 0 42 0 4 2 3 0 15 15 0 00 02 14 22 0 44 0 4 2 3 0 15 15 0 00 02 14 23 0 46 0 4 2 3 0 15 15 0 00 02 14 25 0 47 0 4 2 3 0 15 15 0 00 02 14 26 0 48 0 4 2 3 0 15 15 0 00 02 14 27 0 49 0 4 2 3 0 15 15 0 00 02 14 28 0 50 0 4 2 3 0 15 15 0 00 02 15 00 0 51 0 4 2 3 0 15 15 0 00 02 15 01 0 53 0 4 2 3 0 15 15 0 00 02 15 02 0 54 0 4 2 3 0 15 15 0 00 02 15 03 0 56 0 4 2 3 0 15 15 0 00 02 15 04 0 57 0 4 2 3 0 15 15 0 00 02 15 05 0 58 0 4 2 3 0 15 15 0 00 02 15 06 0 59 0 4 2 3 0 15 15 0 00 02 15 07 0 60 0 4 2 3 0 15 15 0 00 02 15 08 0 61 0 4 2 3 0 15 15 0 00 02 15 09 0 63 0 4 2 3 0 15 15 0 00 02 15 10 0 64 0 4 2 3 0 15 15 0 00 02 15 12 0 68 0 4 2 3 0 15 15 0 00 02 15 13 0 69 0 4 2 3 0 15 15 0 00 02 15 14 0 71 0 4 2 3 0 15 15 0 00 02 15 15 0 72 0 4 2 3 0 15 15 0 00 02 15 16 0 73 0 4 2 3 0 15 15 0 00 02 15 17 0 74 0 4 2 3 0 15 15 0 00 02 15 18 0 75 0 4 2 3 0 15 15 0 00 02 15 19 0 77 0 4 2 3 0 15 15 0 00 02 15 24 0 89 0 4 2 3 0 15 15 0 00 02 15 25 0 90 0 4 2 3 0 15 15 0 00 02 15 26 0 91 0 4 2 3 0 15 15 0 00 02 15 27 0 93 0 4 2 3 0 15 15 0 00 02 15 28 0 95 0 4 2 3 0 15 15 0 00 02 15 29 0 96 0 4 2 3 0 15 15 0 ............ --------------------------------------------------- For example, for the first three raws: it should be changed as follows: 00 02 14 19 0 41 0 4 2 3 0 15 15 0 00 02 14 20 0 42 0 4 2 3 0 15 15 0 00 02 14 21 0 43 0 4 2 3 0 15 15 0 ==> inserted line 00 02 14 22 0 44 0 4 2 3 0 15 15 0 ======================================= Thanks in advance!
-
There are lots of implementation of linked lists, you could try STL containers, they are very fast if they are used in a good way. There must be examples & tutorials here at CodeProject. You could also implement it yourself. Basically it should look like this :
struct myList { long somedata; struct myList *next; };
"640K ought to be enough for anybody." Bill Gates