CN115883508B - Number processing method and device, electronic equipment and storage medium - Google Patents

Number processing method and device, electronic equipment and storage medium Download PDF

Info

Publication number
CN115883508B
CN115883508B CN202111129906.XA CN202111129906A CN115883508B CN 115883508 B CN115883508 B CN 115883508B CN 202111129906 A CN202111129906 A CN 202111129906A CN 115883508 B CN115883508 B CN 115883508B
Authority
CN
China
Prior art keywords
segment
existing
added
value information
information
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Active
Application number
CN202111129906.XA
Other languages
Chinese (zh)
Other versions
CN115883508A (en
Inventor
袁满
高艺力
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
China Mobile Communications Group Co Ltd
China Mobile IoT Co Ltd
Original Assignee
China Mobile Communications Group Co Ltd
China Mobile IoT Co Ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by China Mobile Communications Group Co Ltd, China Mobile IoT Co Ltd filed Critical China Mobile Communications Group Co Ltd
Priority to CN202111129906.XA priority Critical patent/CN115883508B/en
Publication of CN115883508A publication Critical patent/CN115883508A/en
Application granted granted Critical
Publication of CN115883508B publication Critical patent/CN115883508B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Landscapes

  • Information Retrieval, Db Structures And Fs Structures Therefor (AREA)

Abstract

The application discloses a number processing method, a device, electronic equipment and a storage medium, wherein the method comprises the following steps: determining whether the attribute value of the object to be newly added is the same as the attribute value of the existing object; the object to be newly added is a number to be newly added and/or a number segment to be newly added, and the existing object is an existing number and/or an existing number segment; and under the condition that the attribute value of the object to be added is the same as the attribute value of the existing object, determining whether to merge the object to be added with the existing object based on the relation between the numerical information of the object to be added and the numerical information of the existing object.

Description

Number processing method and device, electronic equipment and storage medium
Technical Field
The embodiment of the application relates to the technical field of computers, in particular to a number processing method, a number processing device, electronic equipment and a storage medium.
Background
In many internet, internet of things, telecommunications, etc. systems, some kind of identification number (ID, identity Document) is commonly used to identify a type of information, such as a mobile phone number, a communication software account, etc. For each ID, many tag information is attached. For example, in an internet of things capability center system, it is necessary to maintain hundreds of pieces of different attribute information of over 10 hundred million internet of things equipment terminals, and how to quickly and accurately query a value of a specific attribute corresponding to a certain ID from massive data often becomes one of key performance bottlenecks of many systems.
Disclosure of Invention
In order to solve the technical problems, the embodiment of the application provides a number processing method, a device, electronic equipment and a storage medium.
The embodiment of the application provides a number processing method, which comprises the following steps:
Determining whether the attribute value of the object to be newly added is the same as the attribute value of the existing object; the object to be newly added is a number to be newly added and/or a number segment to be newly added, and the existing object is an existing number and/or an existing number segment;
And under the condition that the attribute value of the object to be added is the same as the attribute value of the existing object, determining whether to merge the object to be added with the existing object based on the relation between the numerical information of the object to be added and the numerical information of the existing object.
In an optional embodiment of the present application, the determining whether to merge the object to be added with the existing object based on the relationship between the numerical information of the object to be added and the numerical information of the existing object includes:
determining whether the numerical information of the number to be added is adjacent to the numerical information of the existing number or not under the condition that the object to be added is the number to be added and the existing object is the existing number;
Generating a target number segment based on the numerical information of the number to be added and the numerical information of the existing number under the condition that the numerical information of the number to be added is adjacent to the numerical information of the existing number;
and under the condition that the numerical information of the number to be added is not adjacent to the numerical information of the existing number, not merging the number to be added and the existing number.
In an optional embodiment of the present application, the determining whether to merge the object to be added with the existing object based on the relationship between the numerical information of the object to be added and the numerical information of the existing object includes:
Determining the relation between the numerical information of the number to be added and the initial numerical information and the ending numerical information of the existing number segment under the condition that the object to be added is the number to be added and the existing object is the existing number segment;
combining the number to be added with the existing number segment and updating the initial value information of the existing number segment to be the initial value information of the new number under the condition that the value information of the number to be added is adjacent to the initial value information and the value information of the number to be added is smaller than the initial value information;
Combining the number to be added with the existing number segment and updating the ending numerical value information of the existing number segment to be the ending numerical value information of the new number under the condition that the numerical value information of the number to be added is adjacent to the ending numerical value information and the numerical value information of the number to be added is larger than the initial numerical value information;
when the number value information to be added is positioned between the initial value information and the ending value information, keeping the initial value information and the ending value information of the existing number unchanged, and merging the number to be added into the existing number segment.
In an optional embodiment of the present application, the determining whether to merge the object to be added with the existing object based on the relationship between the numerical information of the object to be added and the numerical information of the existing object includes:
determining the relation between the numerical information of the existing number and the initial numerical information and the ending numerical information of the number waiting section under the condition that the object to be added is the number to be added Duan Ju and the existing object is the existing number;
Combining the existing number with the number waiting segment and updating the initial value information of the number waiting segment to be newly added to be the value information of the existing number under the condition that the value information of the existing number is adjacent to the initial value information of the number waiting segment to be newly added and the value information of the existing number is smaller than the initial value information of the number waiting segment to be newly added;
Combining the existing number with the number waiting segment and updating the ending numerical information of the number waiting segment to be newly added to the numerical information of the existing number under the condition that the numerical information of the existing number is adjacent to the ending numerical information of the number waiting segment to be newly added and the numerical information of the existing number is larger than the ending numerical information of the number waiting segment to be newly added;
when the numerical value information of the existing number is located between the starting numerical value information and the ending numerical value information of the to-be-added number segment, keeping the starting numerical value information and the ending numerical value information of the to-be-added number segment unchanged, and combining the existing number to the to-be-added number segment.
In an optional embodiment of the present application, the determining whether to merge the object to be added with the existing object based on the relationship between the numerical information of the object to be added and the numerical information of the existing object includes:
determining the relation between the initial value information and the ending value information of the number waiting segment and the initial value information and the ending value information of the existing number segment under the condition that the object to be added is the number to be added Duan Ju and the existing object is the existing number segment;
if the ending numerical value information of the number to be added is smaller than the starting numerical value information of the existing number segment, and the ending numerical value information of the number to be added is not adjacent to the starting numerical value information of the existing number segment, the number to be added and the existing number segment are not combined;
continuously comparing the initial value information of the number to be added with the initial value information of the existing number segment under the condition that the end value information of the number to be added is larger than the initial value information of the existing number segment and the end value information of the number to be added is smaller than the end value information of the existing number segment, and combining the number to be added with the existing number segment under the condition that the initial value information of the number to be added is smaller than or larger than the initial value information of the existing number segment;
Combining the number to be added with the existing number segment under the condition that the ending numerical information of the number to be added is larger than the ending numerical information of the existing number segment and the starting numerical information of the number to be added is smaller than the starting numerical information of the existing number segment;
Combining the number to be added with the existing number segment under the condition that the ending numerical value information of the number to be added is larger than the ending numerical value information of the existing number segment and the starting numerical value information of the number to be added is located between the starting numerical value information and the ending numerical value information of the existing number segment;
And under the condition that the initial value information of the number to be added is larger than the ending value information of the existing number segment, not merging the number to be added and the existing number segment.
In an alternative embodiment of the present application, the method further includes: storing at least one existing number segment in a balanced binary tree structure;
Wherein each parent node in the balanced binary tree structure comprises a left child node and a right child node; the starting numerical information of the number segment positioned at the right child node is larger than the ending numerical information of the number segment positioned at the father node, and the starting numerical information of the number segment of the right child node is not adjacent to the ending numerical information of the number segment positioned at the father node; for the number segment of each node in the balanced binary tree structure, the number information of the number segment of the node on the left side of the node is smaller than the initial number information of the node number segment, and the number information of the number segment of the node on the right side of the node is larger than the end number information of the node number segment in the balanced binary tree structure.
In an optional embodiment of the present application, after the merging the object to be newly added and the existing object, a newly added number segment is generated, where the newly added number segment includes a new number segment and/or a number segment after updating the existing number segment, and the method further includes:
Storing the newly added number segments in a storage rule of a balanced binary tree structure, wherein the mode for storing the newly added number segments comprises the following steps: and merging the newly added number segment with one of at least one existing number segment stored in a balanced binary tree structure.
In an optional embodiment of the present application, the storing the number added segment in a storage rule of a balanced binary tree structure includes:
Comparing the start value information and the end value information of the newly added number segment with the start value information and the end value information of the first number segment in the at least one existing number segment stored in the balanced binary tree structure; the first number segment is a number segment positioned at the top of the tree of the balanced binary tree structure;
Determining the second number segment as a new first number segment under the condition that the ending numerical information of the newly added number segment is smaller than the starting numerical information of the first number segment; further comparing the initial value information and the ending value information of the newly added number segment with the ending value information of the new first number segment until determining whether the attribute values of the newly added number segment and the final first number segment are the same or not under the condition that the initial value information and the ending value information of the newly added number segment are adjacent to the number of the ending value information of the final first number segment, and if so, merging the newly added number segment with the final first number segment; the second number segment is a number segment of the left subtree positioned in the first number segment.
In an alternative embodiment of the present application, the method further includes:
Inquiring an object to be inquired by utilizing a storage rule of a balanced binary tree structure, and determining a number segment to which the object to be inquired belongs; wherein the object to be queried is a number to be queried and/or a number segment to be queried;
And determining the attribute value of the object to be queried based on the number segment to which the object to be queried belongs.
The embodiment of the application also provides a number processing device, which comprises:
A first determining unit, configured to determine whether an attribute value of an object to be newly added is the same as an attribute value of an existing object; the object to be newly added is a number to be newly added and/or a number segment to be newly added, and the existing object is an existing number and/or an existing number segment;
And the second determining unit is used for determining whether to merge the object to be added with the existing object based on the relation between the numerical information of the object to be added and the numerical information of the existing object under the condition that the attribute value of the object to be added is the same as the attribute value of the existing object.
In an optional embodiment of the present application, the second determining unit is specifically configured to:
determining whether the numerical information of the number to be added is adjacent to the numerical information of the existing number or not under the condition that the object to be added is the number to be added and the existing object is the existing number;
Generating a target number segment based on the numerical information of the number to be added and the numerical information of the existing number under the condition that the numerical information of the number to be added is adjacent to the numerical information of the existing number;
and under the condition that the numerical information of the number to be added is not adjacent to the numerical information of the existing number, not merging the number to be added and the existing number.
In an optional embodiment of the present application, the second determining unit is specifically configured to:
Determining the relation between the numerical information of the number to be added and the initial numerical information and the ending numerical information of the existing number segment under the condition that the object to be added is the number to be added and the existing object is the existing number segment;
combining the number to be added with the existing number segment and updating the initial value information of the existing number segment to be the initial value information of the new number under the condition that the value information of the number to be added is adjacent to the initial value information and the value information of the number to be added is smaller than the initial value information;
Combining the number to be added with the existing number segment and updating the ending numerical value information of the existing number segment to be the ending numerical value information of the new number under the condition that the numerical value information of the number to be added is adjacent to the ending numerical value information and the numerical value information of the number to be added is larger than the initial numerical value information;
when the number value information to be added is positioned between the initial value information and the ending value information, keeping the initial value information and the ending value information of the existing number unchanged, and merging the number to be added into the existing number segment.
In an optional embodiment of the present application, the second determining unit is specifically configured to:
determining the relation between the numerical information of the existing number and the initial numerical information and the ending numerical information of the number waiting section under the condition that the object to be added is the number to be added Duan Ju and the existing object is the existing number;
Combining the existing number with the number waiting segment and updating the initial value information of the number waiting segment to be newly added to be the value information of the existing number under the condition that the value information of the existing number is adjacent to the initial value information of the number waiting segment to be newly added and the value information of the existing number is smaller than the initial value information of the number waiting segment to be newly added;
Combining the existing number with the number waiting segment and updating the ending numerical information of the number waiting segment to be newly added to the numerical information of the existing number under the condition that the numerical information of the existing number is adjacent to the ending numerical information of the number waiting segment to be newly added and the numerical information of the existing number is larger than the ending numerical information of the number waiting segment to be newly added;
when the numerical value information of the existing number is located between the starting numerical value information and the ending numerical value information of the to-be-added number segment, keeping the starting numerical value information and the ending numerical value information of the to-be-added number segment unchanged, and combining the existing number to the to-be-added number segment.
In an optional embodiment of the present application, the second determining unit is specifically configured to:
determining the relation between the initial value information and the ending value information of the number waiting segment and the initial value information and the ending value information of the existing number segment under the condition that the object to be added is the number to be added Duan Ju and the existing object is the existing number segment;
if the ending numerical value information of the number to be added is smaller than the starting numerical value information of the existing number segment, and the ending numerical value information of the number to be added is not adjacent to the starting numerical value information of the existing number segment, the number to be added and the existing number segment are not combined;
continuously comparing the initial value information of the number to be added with the initial value information of the existing number segment under the condition that the end value information of the number to be added is larger than the initial value information of the existing number segment and the end value information of the number to be added is smaller than the end value information of the existing number segment, and combining the number to be added with the existing number segment under the condition that the initial value information of the number to be added is smaller than or larger than the initial value information of the existing number segment;
Combining the number to be added with the existing number segment under the condition that the ending numerical information of the number to be added is larger than the ending numerical information of the existing number segment and the starting numerical information of the number to be added is smaller than the starting numerical information of the existing number segment;
Combining the number to be added with the existing number segment under the condition that the ending numerical value information of the number to be added is larger than the ending numerical value information of the existing number segment and the starting numerical value information of the number to be added is located between the starting numerical value information and the ending numerical value information of the existing number segment;
And under the condition that the initial value information of the number to be added is larger than the ending value information of the existing number segment, not merging the number to be added and the existing number segment.
In an alternative embodiment of the present application, the apparatus further includes:
A first storage unit for storing at least one existing number segment in a balanced binary tree structure;
Wherein each parent node in the balanced binary tree structure comprises a left child node and a right child node; the starting numerical information of the number segment positioned at the right child node is larger than the ending numerical information of the number segment positioned at the father node, and the starting numerical information of the number segment of the right child node is not adjacent to the ending numerical information of the number segment positioned at the father node; for the number segment of each node in the balanced binary tree structure, the number information of the number segment of the node on the left side of the node is smaller than the initial number information of the node number segment, and the number information of the number segment of the node on the right side of the node is larger than the end number information of the node number segment in the balanced binary tree structure.
In an optional embodiment of the present application, after the merging the object to be newly added and the existing object, a newly added number segment is generated, where the newly added number segment includes a new number segment and/or a number segment after updating the existing number segment, and the apparatus further includes:
the second storage unit stores the newly added number segment in a storage rule of a balanced binary tree structure, wherein the mode for storing the newly added number segment comprises the following steps: and merging the newly added number segment with one of at least one existing number segment stored in a balanced binary tree structure.
In an optional embodiment of the present application, the second storage unit is specifically configured to:
Comparing the start value information and the end value information of the newly added number segment with the start value information and the end value information of the first number segment in the at least one existing number segment stored in the balanced binary tree structure; the first number segment is a number segment positioned at the top of the tree of the balanced binary tree structure;
Determining the second number segment as a new first number segment under the condition that the ending numerical information of the newly added number segment is smaller than the starting numerical information of the first number segment; further comparing the initial value information and the ending value information of the newly added number segment with the ending value information of the new first number segment until determining whether the attribute values of the newly added number segment and the final first number segment are the same or not under the condition that the initial value information and the ending value information of the newly added number segment are adjacent to the number of the ending value information of the final first number segment, and if so, merging the newly added number segment with the final first number segment; the second number segment is a number segment of the left subtree positioned in the first number segment.
In an alternative embodiment of the present application, the apparatus further includes:
The query unit is used for querying the object to be queried by utilizing a storage rule of a balanced binary tree structure and determining the number segment to which the object to be queried belongs; wherein the object to be queried is a number to be queried and/or a number segment to be queried; and determining the attribute value of the object to be queried based on the number segment to which the object to be queried belongs.
The embodiment of the application also provides electronic equipment, which comprises: the computer-executable instructions of the memory may be stored in the memory, and the processor may implement the method described in the above embodiment when executing the computer-executable instructions of the memory.
The embodiment of the application also provides a computer storage medium, wherein executable instructions are stored on the storage medium, and when the executable instructions are executed by a processor, the method of the embodiment is realized.
According to the technical scheme provided by the embodiment of the application, whether the attribute value of the object to be newly added is the same as the attribute value of the existing object is determined; the object to be newly added is a number to be newly added and/or a number segment to be newly added, and the existing object is an existing number and/or an existing number segment; and under the condition that the attribute value of the object to be added is the same as the attribute value of the existing object, determining whether to merge the object to be added with the existing object based on the relation between the numerical information of the object to be added and the numerical information of the existing object. Therefore, the finely divided number and number segments can be fused to the greatest extent by judging the blood relationship (namely whether the attributes are the same) of the number and the number segments and the mutual relationship of the numerical values corresponding to the number and the number segments, so that the aims of accurately compressing the number segments and saving storage space resources are fulfilled.
Drawings
Fig. 1 is a schematic diagram of a number query process according to an embodiment of the present application;
Fig. 2 is a schematic diagram two of a number query process according to an embodiment of the present application;
fig. 3 is a flow chart of a number processing method according to an embodiment of the present application;
FIG. 4 is a schematic diagram of a collision process between a number to be added and an existing number according to an embodiment of the present application;
FIG. 5 is a schematic diagram of storing existing number segments based on a balanced binary tree structure according to an embodiment of the present application;
FIG. 6 is a schematic diagram of storing newly added number segments in a storage rule of a balanced binary tree structure according to an embodiment of the present application;
FIG. 7 is a schematic diagram of a process for querying a number according to an embodiment of the present application;
fig. 8 is a schematic structural diagram of a number processing device according to an embodiment of the present application;
fig. 9 is a schematic structural diagram of an electronic device according to an embodiment of the present application.
Detailed Description
For a more complete understanding of the nature and the technical content of the embodiments of the present application, reference should be made to the following detailed description of embodiments of the application, taken in conjunction with the accompanying drawings, which are meant to be illustrative only and not limiting of the embodiments of the application.
For the number 861440898200004, the number corresponds to a real-time temperature and wind power detection device, a server in a certain area is used for connection and data management, when the data of the current device is required to be queried in real time, the server address corresponding to the number is required to be rapidly positioned from tens of thousands of related area servers in the whole country through the number, and a request instruction is sent to the server address to acquire the data of the current device.
In one approach, the number 861440898200004 may be queried using the query process shown in FIG. 1.
Specifically, a record can be created for each ID, and related attribute information is recorded, and when certain attribute state information of a certain ID needs to be queried, an attribute value (specifically, a server address) can be directly obtained through the ID; furthermore, in the field of telecommunications, some attributes are that card number resources are planned according to ten-thousand number segments, in which case, the ID may be stored in consecutive ten-thousand units to store attribute information. For example, the number can be stored as 86144089820 (the last 4 bits are omitted) and the corresponding relation of the attribute, the number can be removed by the last 4 bits when inquiring, then the database is inquired for routing, and the processing thought of the ten-thousand-number section depends on the special rule of number division and is an upgrade version of a single number.
In this scheme, if one piece of data record attribute information is created for each ID and hash calculation is performed by a hash method, if 10 hundred million IDs are needed, 10 hundred million pieces of data will be stored, which will cause a high storage cost and a large storage space consumption. 10 hundred million pieces of data need to be stored and managed by more than 10 memory server clusters and nearly 70G memory space; as the improvement scheme of this scheme, ten thousand number sections can compress storage space as a special circumstances to a certain extent, but ten thousand number section scenes are lower, through continuous 10 bit to the higher one compression number section, will lead to the inconsistent number section length, and calculation logic is inconsistent, and under the circumstances that the data volume is big, also can have the space waste of a certain extent.
In another embodiment, the query procedure shown in fig. 2 may be used to query the number 861440898200004.
As shown in fig. 2, when a batch of continuous IDs is newly generated, the new number segments are stored in the form of beginning number and ending number mark segments, the new number segments are attached with related attribute values, and when the target ID falls in a certain number segment interval, the number Duan Liebiao is traversed in sequence, and when the target ID falls in a certain number segment interval, the attribute value of the number segment to which the ID belongs is acquired for routing.
The scheme can accurately compress the number segment storage space to a large extent by recording the start number and the end number for storage, and saves storage resources. But has the following problems: 1. when a number segment to which an ID belongs is positioned, a number segment table is required to be traversed in a full quantity, the ID and all the number segment tables are compared one by one, whether the ID falls in a number segment table section or not is checked, and the time complexity O (n) is high; 2. when the number segment data is newly added or migrated (attribute capacity expansion or merging), fragments are easily caused, the time is accumulated and the month is accumulated, the fragment rate is higher and higher, and the traversing time complexity and the storage space loss are further increased.
According to the technical scheme, the number segment fragment rate and the time complexity of route searching can be reduced, the storage space is saved, and the number routing efficiency is improved by adopting the number segment compression and routing method of collision fusion of adjacent numbers and number segments.
Fig. 3 is a flow chart of a number processing method according to an embodiment of the present application, as shown in fig. 1, where the number processing method includes the following steps:
Step 101: it is determined whether the attribute value of the object to be newly added is the same as the attribute value of the existing object.
In the embodiment of the application, the object to be newly added is a number to be newly added and/or a number segment to be newly added, and the existing object is an existing number and/or an existing number segment.
In the embodiment of the application, the attribute value of the object to be added is the same as the attribute value of the existing object, and represents that the object to be added and the existing object are the same in blood margin.
In the embodiment of the present application, if the attribute value of the object to be newly added is different from the attribute value of the existing object, it may be determined that the collision between the object to be newly added and the existing object is ended, which may also be referred to as collision flicking. The end of the collision or the collision flick is specifically understood as that the object to be newly added and the existing object do not have a condition for merging.
And under the condition that the collision of the object to be newly added and a certain existing object is finished, further continuing to judge whether the attribute value of the object to be newly added is the same as that of other existing objects until the existing object with the same attribute as that of the object to be newly added is determined, and continuing to judge in the step 102.
Step 102: and under the condition that the attribute value of the object to be added is the same as the attribute value of the existing object, determining whether to merge the object to be added with the existing object based on the relation between the numerical information of the object to be added and the numerical information of the existing object.
In the embodiment of the application, under the condition that the object to be added is a number to be added, the numerical information of the object to be added is the specific number information of the number to be added; under the condition that the object to be added is a number section to be added, the numerical information of the object to be added comprises start numerical information and end numerical information, wherein the start numerical information is also called a start number of the number section to be added and is a number with the minimum numerical value in numbers included in the number section to be added; the ending numerical information is also called as the ending number of the number to be added, and is the number with the largest numerical value in the numbers included in the number to be added section. The numerical information of the existing object can be understood in the same manner as the numerical information of the number to be newly added, and will not be described here again.
In the embodiment of the present application, it is assumed that an existing number a exists, and its attribute value is attr1; in addition, there is a segment A whose value is (begin: b, end: c) and whose attribute value is attr2; and, number a and number segment a do not match (i.e., number a does not belong to the number in number segment a). In addition, the number to be newly added is number d, the number to be newly added is number segment B (begin: e, end: f), and the attribute value is attr2.
In an alternative embodiment of the present application, the step 102 includes:
determining whether the numerical information of the number to be added is adjacent to the numerical information of the existing number or not under the condition that the object to be added is the number to be added and the existing object is the existing number;
Generating a target number segment based on the numerical information of the number to be added and the numerical information of the existing number under the condition that the numerical information of the number to be added is adjacent to the numerical information of the existing number;
and under the condition that the numerical information of the number to be added is not adjacent to the numerical information of the existing number, not merging the number to be added and the existing number.
Specifically, the collision process of the number d to be added and the existing number a is shown in fig. 4, and specifically described as follows:
Step 1-1: firstly checking whether the attribute values of the number d and the number a are the same, if so, continuing to check whether the number d is adjacent to the number a (a+1=d or a-1=d), if so, for example, a+1=d; collision fusion number segment B (begin: a, end: d), if a-1 = d, collision fusion number segment B (begin: d, end: a);
Step 1-2: if the attribute values of the number d and the number a are different, the collision flicks, and the number d continuously collides with other numbers or number segments;
Step 1-3: if the attribute values of the number d and the number a are the same but not adjacent, the collision flicks off, and the number d continues to collide with other numbers or number segments;
step 1-4: if the number d and all other numbers and number segments cannot be fused, the number d is stored as a record alone.
In an alternative embodiment of the present application, the step 102 includes:
Determining the relation between the numerical information of the number to be added and the initial numerical information and the ending numerical information of the existing number segment under the condition that the object to be added is the number to be added and the existing object is the existing number segment;
combining the number to be added with the existing number segment and updating the initial value information of the existing number segment to be the initial value information of the new number under the condition that the value information of the number to be added is adjacent to the initial value information and the value information of the number to be added is smaller than the initial value information;
Combining the number to be added with the existing number segment and updating the ending numerical value information of the existing number segment to be the ending numerical value information of the new number under the condition that the numerical value information of the number to be added is adjacent to the ending numerical value information and the numerical value information of the number to be added is larger than the initial numerical value information;
when the number value information to be added is positioned between the initial value information and the ending value information, keeping the initial value information and the ending value information of the existing number unchanged, and merging the number to be added into the existing number segment.
Specifically, the collision process of the newly added number d and the existing number segment A is introduced as follows:
Step 2-1: checking whether the attribute values of the number d and the number segment A are the same, if so, the number d continuously collides with other numbers or number segments;
Step 2-2: if the attribute values of the number d and the number segment A are the same, collision is carried out on the number d and the initial number b of the number segment A;
(1) If d+1=b, merging the number d into the number segment a, which becomes more (begin: d, end: c), while deleting the separate number record d;
(2) If the number d is larger than the starting number b of the number segment A and smaller than the ending number c and d of the number segment A, merging the number segment A, deleting the independent number record d without any change of the number segment A;
(3) If d-1=c, the number d is fused into the number segment a, which becomes more (begin: b, end: d) while deleting the separate number record d.
In an alternative embodiment of the present application, the step 102 includes:
determining the relation between the numerical information of the existing number and the initial numerical information and the ending numerical information of the number waiting section under the condition that the object to be added is the number to be added Duan Ju and the existing object is the existing number;
Combining the existing number with the number waiting segment and updating the initial value information of the number waiting segment to be newly added to be the value information of the existing number under the condition that the value information of the existing number is adjacent to the initial value information of the number waiting segment to be newly added and the value information of the existing number is smaller than the initial value information of the number waiting segment to be newly added;
Combining the existing number with the number waiting segment and updating the ending numerical information of the number waiting segment to be newly added to the numerical information of the existing number under the condition that the numerical information of the existing number is adjacent to the ending numerical information of the number waiting segment to be newly added and the numerical information of the existing number is larger than the ending numerical information of the number waiting segment to be newly added;
when the numerical value information of the existing number is located between the starting numerical value information and the ending numerical value information of the to-be-added number segment, keeping the starting numerical value information and the ending numerical value information of the to-be-added number segment unchanged, and combining the existing number to the to-be-added number segment.
Specifically, the collision process of the number section B to be newly added and the existing number a can be understood by referring to the collision process of the number d to be newly added and the existing number section a.
In an alternative embodiment of the present application, the step 102 includes:
determining the relation between the initial value information and the ending value information of the number waiting segment and the initial value information and the ending value information of the existing number segment under the condition that the object to be added is the number to be added Duan Ju and the existing object is the existing number segment;
if the ending numerical value information of the number to be added is smaller than the starting numerical value information of the existing number segment, and the ending numerical value information of the number to be added is not adjacent to the starting numerical value information of the existing number segment, the number to be added and the existing number segment are not combined;
continuously comparing the initial value information of the number to be added with the initial value information of the existing number segment under the condition that the end value information of the number to be added is larger than the initial value information of the existing number segment and the end value information of the number to be added is smaller than the end value information of the existing number segment, and combining the number to be added with the existing number segment under the condition that the initial value information of the number to be added is smaller than or larger than the initial value information of the existing number segment;
Combining the number to be added with the existing number segment under the condition that the ending numerical information of the number to be added is larger than the ending numerical information of the existing number segment and the starting numerical information of the number to be added is smaller than the starting numerical information of the existing number segment;
Combining the number to be added with the existing number segment under the condition that the ending numerical value information of the number to be added is larger than the ending numerical value information of the existing number segment and the starting numerical value information of the number to be added is located between the starting numerical value information and the ending numerical value information of the existing number segment;
And under the condition that the initial value information of the number to be added is larger than the ending value information of the existing number segment, not merging the number to be added and the existing number segment.
Specifically, the collision process of the segment B to be newly added and the existing segment A is introduced as follows:
step 3-1: firstly, judging whether the number segment B and the number segment A have the same attribute, if so, ending the collision, and continuing to collide with other numbers and number segments;
Step 3-2: if the attribute values of the number segment B and the number segment A are the same, comparing the ending number f of the number segment B with the starting number B of the number segment A;
step 3-3: if f is smaller than b and f and b are not adjacent, the collision of the same number segment A is ended;
Step 3-4: if f is larger than the initial number B of the number segment A and f is smaller than the end number c of the number segment A, the initial number e of the number segment B is continuously used for comparing with the initial number B of the number segment A, if the initial number e of the number segment B is smaller than the initial number B of the number segment A, the number segment B and the number segment A are fused into a new number segment A (begin: e, end: c), and the record of the original number segment B is deleted;
Step 3-5: if f is larger than the initial number B of the number segment A and f is smaller than the end number c of the number segment A, continuously comparing the initial number e of the number segment B with the initial number B of the number segment A, if e is larger than B, directly fusing the number segment B into the number segment A, keeping the content of the number segment A unchanged, and deleting the record of the original number segment B;
Step 3-6: if f is greater than the end number c of the number segment A, and the start number e of the number segment B is less than the start number B of the number segment A, the number segment A is fused into the number segment B, the number segment B is not changed, and the original number segment A record is deleted;
step 3-7: if f is greater than the end number c of the number segment A, and the start number e of the number segment B is in the number segment A, the number segment B is fused into the number segment A, A becomes a new number segment A (begin: B, end: f), and the original number segment B record is deleted;
Step 3-8: if the start number segment e of the B number segment is greater than the end number segment f of the A number segment, the collision of the B number Duan Tong A number segment ends.
In the embodiment of the application, through the mutual collision modes of the numbers and the number segments listed above, absolute independent number segment records with the same blood edges (the same attribute) can be finally generated, all fragments (repeated number segments, crossed number segments and adjacent number segments) can be eliminated in the collision process, and the number segment data quantity is compressed to the greatest extent.
In an optional embodiment of the present application, the method for processing a number further includes: at least one existing number segment is stored in a balanced binary tree structure.
Here, each parent node in the balanced binary tree structure includes a left child node and a right child node; the starting numerical information of the number segment positioned at the right child node is larger than the ending numerical information of the number segment positioned at the father node, and the starting numerical information of the number segment of the right child node is not adjacent to the ending numerical information of the number segment positioned at the father node; for the number segment of each node in the balanced binary tree structure, the number information of the number segment of the node on the left side of the node is smaller than the initial number information of the node number segment, and the number information of the number segment of the node on the right side of the node is larger than the end number information of the node number segment in the balanced binary tree structure.
Specifically, based on the number and number segment collision basic method, the compressed (i.e. combined) number segments can be further stored in a balanced binary tree data structure, and fig. 5 is a schematic diagram of storing the existing number segments based on the balanced binary tree structure according to the embodiment of the present application.
The basic rules of the balanced binary tree based on the number segments are as follows:
(1) Each node has only two child nodes on the left and right;
(2) The end (i.e., end number) value of the left child node (i.e., left child node) of each node is less than the begin (i.e., start number) value of the parent node and is not adjacent;
(3) The begin value of the right child node (i.e., right child node) of each node is greater than the end value of the parent node and is not adjacent;
(4) Once each node is adjacent to the own father node or child node (for example, end+1=begin of father node of the left child node), the two nodes are fused into one node, and the balanced binary tree structure carries out self-balancing adjustment again according to the rules from (1) to (3);
(5) All values of all nodes on the left side of each node in the balanced binary tree structure are smaller than begin values;
(6) All values of all nodes to the right of each node in the balanced binary tree structure are greater than their end values.
In an optional embodiment of the present application, after the merging the object to be newly added and the existing object, a newly added number segment is generated, where the newly added number segment includes a new number segment and/or a number segment after updating the existing number segment, and the method for processing a number further includes:
Storing the newly added number segments in a storage rule of a balanced binary tree structure, wherein the mode for storing the newly added number segments comprises the following steps: and merging the newly added number segment with one of at least one existing number segment stored in a balanced binary tree structure.
In an optional embodiment of the present application, storing the newly added number segment in a storage rule of a balanced binary tree structure includes:
Comparing the start value information and the end value information of the newly added number segment with the start value information and the end value information of the first number segment in the at least one existing number segment stored in the balanced binary tree structure; the first number segment is a number segment positioned at the top of the tree of the balanced binary tree structure;
Determining the second number segment as a new first number segment under the condition that the ending numerical information of the newly added number segment is smaller than the starting numerical information of the first number segment; further comparing the initial value information and the ending value information of the newly added number segment with the ending value information of the new first number segment until determining whether the attribute values of the newly added number segment and the final first number segment are the same or not under the condition that the initial value information and the ending value information of the newly added number segment are adjacent to the number of the ending value information of the final first number segment, and if so, merging the newly added number segment with the final first number segment; the second number segment is a number segment of the left subtree positioned in the first number segment.
Specifically, fig. 6 is a schematic diagram of storing a new number segment in a storage rule with a balanced binary tree structure according to an embodiment of the present application, and the following description describes a storage process of the new number segment:
1. For a newly added number segment (begin: 14411110457, end: 14411110495), firstly, collision is carried out between the newly added number segment and a tree top number segment (begin: 14411110457, end: 14411110495), the number of the newly added number segment is larger than the end number of a target number segment, and collision is continued to the right sub tree number segment;
2. the end number of the newly added number segment is smaller than the initial number begin of the target number segment, and the newly added number segment continuously collides with the left sub-tree number segment of the target number segment;
3. the new number segment begin number is adjacent to the end number of the target number segment, the blood-edge relationship (attribute value) is continuously judged to be the same, the new number segment and the old number segment are fused into a number segment, and the collision is ended.
According to the number segment table formed by storing the number segments in the mode, under the worst condition of the number segment table, the target number segment can be searched only by 3 times of collision, the time complexity is reduced from the original O (n) to O (logn), the time for fusing (combining) the number segments is greatly shortened, the number segments can be compressed accurately, and fragments are avoided.
In an optional embodiment of the present application, the method for processing a number further includes:
Inquiring an object to be inquired by utilizing a storage rule of a balanced binary tree structure, and determining a number segment to which the object to be inquired belongs; wherein the object to be queried is a number to be queried and/or a number segment to be queried;
And determining the attribute value of the object to be queried based on the number segment to which the object to be queried belongs.
Specifically, fig. 7 is a schematic diagram of a process of querying a number according to an embodiment of the present application, when a specific attribute is queried by querying a number, by traversing a number segment routing table of a tree structure of a balanced binary tree structure, when a number is queried, the number can be quickly routed to a corresponding attribute value with the time complexity of log (n) (in a number segment table formed by the balanced binary tree structure shown in fig. 7, a number segment to which the number belongs needs to be searched, and in the worst case, only at most 3 collisions need to be passed).
According to the technical scheme, the number segments are fused with the number segments to the greatest extent by judging the blood relationship and the adjacent condition of the number segments and the number segments, so that the purpose of accurately compressing the number segments and saving storage space resources is achieved.
In addition, the embodiment of the application takes the start number and the end number of the number segment as comparison parameters, takes the attribute of the number segment as a blood relationship, stores scattered number segments in a balanced binary tree data structure, and provides a data structure foundation for rapid and effective compression of the number segments and rapid routing of the number.
In addition, in the embodiment of the application, for the newly added number, the newly added number segment and the number Duan Cafen of the number segment table, under the mode of collision fusion of the balanced binary tree and the number segment, the efficiency of newly adding the number segment, the number and the splitting is higher, the accuracy is higher, and the probability of the occurrence of the fragment number segment is lower.
In addition, under the condition that the number segments are combined in a collision mode and stored in a balanced binary tree structure, when the related attribute of a special ID is required to be searched from the number segment table corresponding to the balanced binary tree, the ID can be rapidly routed to the corresponding number segment in a traversing mode of the balanced binary tree number segment table, and the related attribute is rapidly acquired.
In a word, the technical scheme of the embodiment of the application can compress and route the number segments, and obviously improves the space dimension and the time dimension.
Compared with the scheme one shown in fig. 1, if there are 10 continuous numbers or number segments of 00-09 in the number segments, the 10 number segments are compressed to become a number segment, and the number segment is saved as a number in a mode of removing the lowest bit, so that the scheme of the embodiment of the application is more flexible, for example, 1001-1998 total 998 data, and only one record is needed to be saved by using the scheme of the embodiment of the application; compared with the scheme shown in fig. 2, 10xx,11xx,12xx, 18xx,190x,191x,192x are required, 198x,1990, 1991, 1992, and 27 records in total are saved, and the compression rate of the scheme of the embodiment of the application is higher and the space is saved.
In addition, compared with the scheme of storing numbers in the number segment manner shown in fig. 2, a record is newly added to the common number segment, and whether the numbers fall on the corresponding number segments is compared one by one in the list manner in traversing, the time complexity is O (n), fragments are easy to appear in the number segment table, and the number segments become more after the time is long; the scheme of the embodiment of the application can effectively reduce the fragment rate, simultaneously promote the complexity of the routing time of the number to O (log), save the storage space through collision fusion, and simultaneously promote the routing efficiency of the number. (e.g., a segment list with 3 ten thousand segments, recorded with more than 10 hundred million data attributes), if an ID is routed through the scheme shown in fig. 2, 3 ten thousand segment matching computations are required to find the home segment in the worst case, but if the scheme of the embodiment of the present application is adopted, only up to 15 collisions are required to accurately route to the home segment).
Fig. 8 is a schematic structural diagram of a number processing apparatus according to an embodiment of the present application, as shown in fig. 8, where the apparatus includes:
A first determining unit 801, configured to determine whether an attribute value of an object to be newly added is the same as an attribute value of an existing object; the object to be newly added is a number to be newly added and/or a number segment to be newly added, and the existing object is an existing number and/or an existing number segment;
A second determining unit 802, configured to determine whether to merge the object to be added with the existing object based on a relationship between the numerical information of the object to be added and the numerical information of the existing object, when the attribute value of the object to be added is the same as the attribute value of the existing object.
In an alternative embodiment of the present application, the second determining unit 802 is specifically configured to:
determining whether the numerical information of the number to be added is adjacent to the numerical information of the existing number or not under the condition that the object to be added is the number to be added and the existing object is the existing number;
Generating a target number segment based on the numerical information of the number to be added and the numerical information of the existing number under the condition that the numerical information of the number to be added is adjacent to the numerical information of the existing number;
and under the condition that the numerical information of the number to be added is not adjacent to the numerical information of the existing number, not merging the number to be added and the existing number.
In an alternative embodiment of the present application, the second determining unit 802 is specifically configured to:
Determining the relation between the numerical information of the number to be added and the initial numerical information and the ending numerical information of the existing number segment under the condition that the object to be added is the number to be added and the existing object is the existing number segment;
combining the number to be added with the existing number segment and updating the initial value information of the existing number segment to be the initial value information of the new number under the condition that the value information of the number to be added is adjacent to the initial value information and the value information of the number to be added is smaller than the initial value information;
Combining the number to be added with the existing number segment and updating the ending numerical value information of the existing number segment to be the ending numerical value information of the new number under the condition that the numerical value information of the number to be added is adjacent to the ending numerical value information and the numerical value information of the number to be added is larger than the initial numerical value information;
when the number value information to be added is positioned between the initial value information and the ending value information, keeping the initial value information and the ending value information of the existing number unchanged, and merging the number to be added into the existing number segment.
In an alternative embodiment of the present application, the second determining unit 802 is specifically configured to:
determining the relation between the numerical information of the existing number and the initial numerical information and the ending numerical information of the number waiting section under the condition that the object to be added is the number to be added Duan Ju and the existing object is the existing number;
Combining the existing number with the number waiting segment and updating the initial value information of the number waiting segment to be newly added to be the value information of the existing number under the condition that the value information of the existing number is adjacent to the initial value information of the number waiting segment to be newly added and the value information of the existing number is smaller than the initial value information of the number waiting segment to be newly added;
Combining the existing number with the number waiting segment and updating the ending numerical information of the number waiting segment to be newly added to the numerical information of the existing number under the condition that the numerical information of the existing number is adjacent to the ending numerical information of the number waiting segment to be newly added and the numerical information of the existing number is larger than the ending numerical information of the number waiting segment to be newly added;
when the numerical value information of the existing number is located between the starting numerical value information and the ending numerical value information of the to-be-added number segment, keeping the starting numerical value information and the ending numerical value information of the to-be-added number segment unchanged, and combining the existing number to the to-be-added number segment.
In an alternative embodiment of the present application, the second determining unit 802 is specifically configured to:
determining the relation between the initial value information and the ending value information of the number waiting segment and the initial value information and the ending value information of the existing number segment under the condition that the object to be added is the number to be added Duan Ju and the existing object is the existing number segment;
if the ending numerical value information of the number to be added is smaller than the starting numerical value information of the existing number segment, and the ending numerical value information of the number to be added is not adjacent to the starting numerical value information of the existing number segment, the number to be added and the existing number segment are not combined;
continuously comparing the initial value information of the number to be added with the initial value information of the existing number segment under the condition that the end value information of the number to be added is larger than the initial value information of the existing number segment and the end value information of the number to be added is smaller than the end value information of the existing number segment, and combining the number to be added with the existing number segment under the condition that the initial value information of the number to be added is smaller than or larger than the initial value information of the existing number segment;
Combining the number to be added with the existing number segment under the condition that the ending numerical information of the number to be added is larger than the ending numerical information of the existing number segment and the starting numerical information of the number to be added is smaller than the starting numerical information of the existing number segment;
Combining the number to be added with the existing number segment under the condition that the ending numerical value information of the number to be added is larger than the ending numerical value information of the existing number segment and the starting numerical value information of the number to be added is located between the starting numerical value information and the ending numerical value information of the existing number segment;
And under the condition that the initial value information of the number to be added is larger than the ending value information of the existing number segment, not merging the number to be added and the existing number segment.
In an alternative embodiment of the present application, the apparatus further includes:
a first storage unit 803 for storing at least one existing number segment in a balanced binary tree structure;
Wherein each parent node in the balanced binary tree structure comprises a left child node and a right child node; the starting numerical information of the number segment positioned at the right child node is larger than the ending numerical information of the number segment positioned at the father node, and the starting numerical information of the number segment of the right child node is not adjacent to the ending numerical information of the number segment positioned at the father node; for the number segment of each node in the balanced binary tree structure, the number information of the number segment of the node on the left side of the node is smaller than the initial number information of the node number segment, and the number information of the number segment of the node on the right side of the node is larger than the end number information of the node number segment in the balanced binary tree structure.
In an optional embodiment of the present application, after the merging the object to be newly added and the existing object, a newly added number segment is generated, where the newly added number segment includes a new number segment and/or a number segment after updating the existing number segment, and the apparatus further includes:
The second storage unit 804 stores the newly added number segment in a storage rule with a balanced binary tree structure, where a manner of storing the newly added number segment includes: and merging the newly added number segment with one of at least one existing number segment stored in a balanced binary tree structure.
In an alternative embodiment of the present application, the second storage unit 804 is specifically configured to:
Comparing the start value information and the end value information of the newly added number segment with the start value information and the end value information of the first number segment in the at least one existing number segment stored in the balanced binary tree structure; the first number segment is a number segment positioned at the top of the tree of the balanced binary tree structure;
Determining the second number segment as a new first number segment under the condition that the ending numerical information of the newly added number segment is smaller than the starting numerical information of the first number segment; further comparing the initial value information and the ending value information of the newly added number segment with the ending value information of the new first number segment until determining whether the attribute values of the newly added number segment and the final first number segment are the same or not under the condition that the initial value information and the ending value information of the newly added number segment are adjacent to the number of the ending value information of the final first number segment, and if so, merging the newly added number segment with the final first number segment; the second number segment is a number segment of the left subtree positioned in the first number segment.
In an alternative embodiment of the present application, the apparatus further includes:
the query unit 805 is configured to query an object to be queried using a storage rule of a balanced binary tree structure, and determine a number segment to which the object to be queried belongs; wherein the object to be queried is a number to be queried and/or a number segment to be queried; and determining the attribute value of the object to be queried based on the number segment to which the object to be queried belongs.
It will be appreciated by those skilled in the art that the implementation functions of the units in the number processing apparatus shown in fig. 8 can be understood with reference to the foregoing description of the number processing method. The functions of the respective units in the number processing apparatus shown in fig. 8 may be realized by a program running on a processor or by a specific logic circuit.
The embodiment of the application also provides electronic equipment. Fig. 9 is a schematic hardware structure of an electronic device according to an embodiment of the present application, where, as shown in fig. 9, the electronic device includes: a communication component 903 for data transmission, at least one processor 901 and a memory 902 for storing a computer program capable of running on the processor 901. The various components in the terminal are coupled together by a bus system 904. It is appreciated that the bus system 904 is used to facilitate connected communications between these components. The bus system 904 includes a power bus, a control bus, and a status signal bus in addition to a data bus. But for clarity of illustration, the various buses are labeled as bus system 904 in fig. 9.
Wherein the processor 901, when executing the computer program, performs at least the steps of the method shown in fig. 3.
It is to be appreciated that the memory 902 can be either volatile memory or nonvolatile memory, and can include both volatile and nonvolatile memory. The non-volatile Memory may be, among other things, a Read Only Memory (ROM), a programmable Read Only Memory (PROM, programmable Read-Only Memory), erasable programmable Read-Only Memory (EPROM, erasable Programmable Read-Only Memory), electrically erasable programmable Read-Only Memory (EEPROM, ELECTRICALLY ERASABLE PROGRAMMABLE READ-Only Memory), Magnetic random access Memory (FRAM, ferromagnetic random access Memory), flash Memory (Flash Memory), magnetic surface Memory, optical disk, or compact disk-Only (CD-ROM, compact Disc Read-Only Memory); the magnetic surface memory may be a disk memory or a tape memory. The volatile memory may be random access memory (RAM, random Access Memory) which acts as external cache memory. By way of example and not limitation, many forms of RAM are available, such as static random access memory (SRAM, static Random Access Memory), synchronous static random access memory (SSRAM, synchronous Static Random Access Memory), dynamic random access memory (DRAM, dynamic Random Access Memory), synchronous dynamic random access memory (SDRAM, synchronous Dynamic Random Access Memory), and, Double data rate synchronous dynamic random access memory (DDRSDRAM, double Data Rate Synchronous Dynamic Random Access Memory), enhanced synchronous dynamic random access memory (ESDRAM, enhanced Synchronous Dynamic Random Access Memory), synchronous link dynamic random access memory (SLDRAM, syncLink Dynamic Random Access Memory), Direct memory bus random access memory (DRRAM, direct Rambus Random Access Memory). The memory 902 described by embodiments of the present application is intended to comprise, without being limited to, these and any other suitable types of memory.
The method disclosed in the above embodiment of the present application may be applied to the processor 901 or implemented by the processor 901. Processor 901 may be an integrated circuit chip with signal processing capabilities. In implementation, the steps of the above method may be performed by integrated logic circuits of hardware in the processor 901 or instructions in the form of software. The processor 901 may be a general purpose processor, DSP, or other programmable logic device, discrete gate or transistor logic device, discrete hardware components, or the like. Processor 901 may implement or perform the methods, steps and logic blocks disclosed in embodiments of the present application. The general purpose processor may be a microprocessor or any conventional processor or the like. The steps of the method disclosed in the embodiment of the application can be directly embodied in the hardware of the decoding processor or can be implemented by combining hardware and software modules in the decoding processor. The software modules may be located in a storage medium in a memory 902 and the processor 901 reads information in the memory 902, in combination with its hardware, performing the steps of the method as described above.
In an exemplary embodiment, the electronic device may be implemented by one or more Application-specific integrated circuits (ASICs), DSPs, programmable logic devices (PLDs, programmable Logic Device), complex programmable logic devices (CPLDs, complex Programmable Logic Device), FPGAs, general purpose processors, controllers, MCUs, microprocessors, or other electronic components for performing the aforementioned call recording method.
An embodiment of the application also provides a computer-readable storage medium, on which a computer program is stored, characterized in that the program, when being executed by a processor, is at least adapted to carry out the steps of the method shown in fig. 3. The computer readable storage medium may be a memory in particular. The memory may be the memory 902 shown in fig. 9.
The technical schemes described in the embodiments of the present application may be arbitrarily combined without any collision.
In several embodiments provided by the present application, it should be understood that the disclosed method and intelligent device may be implemented in other manners. The above described device embodiments are only illustrative, e.g. the division of the units is only one logical function division, and there may be other divisions in practice, such as: multiple units or components may be combined or may be integrated into another system, or some features may be omitted, or not performed. In addition, the various components shown or discussed may be coupled or directly coupled or communicatively coupled to each other via some interface, whether indirectly coupled or communicatively coupled to devices or units, whether electrically, mechanically, or otherwise.
The units described as separate units may or may not be physically separate, and units displayed as units may or may not be physical units, may be located in one place, or may be distributed on a plurality of network units; some or all of the units may be selected according to actual needs to achieve the purpose of the solution of this embodiment.
In addition, each functional unit in each embodiment of the present application may be integrated in one second processing unit, or each unit may be separately used as one unit, or two or more units may be integrated in one unit; the integrated units may be implemented in hardware or in hardware plus software functional units.
The foregoing is merely illustrative of the present application, and the present application is not limited thereto, and any person skilled in the art will readily recognize that variations or substitutions are within the scope of the present application.

Claims (10)

1. A method of number processing, the method comprising:
Determining whether the attribute value of the object to be newly added is the same as the attribute value of the existing object; the object to be newly added is a number to be newly added and/or a number segment to be newly added, and the existing object is an existing number and/or an existing number segment;
Determining whether to merge the object to be added with the existing object based on the relation between the numerical information of the object to be added and the numerical information of the existing object under the condition that the attribute value of the object to be added is the same as the attribute value of the existing object;
The method further comprises the steps of: storing at least one existing number segment in a balanced binary tree structure;
Wherein each parent node in the balanced binary tree structure comprises a left child node and a right child node; the starting numerical information of the number segment positioned at the right child node is larger than the ending numerical information of the number segment positioned at the father node, and the starting numerical information of the number segment of the right child node is not adjacent to the ending numerical information of the number segment positioned at the father node; for the number segment of each node in the balanced binary tree structure, the numerical information of the number segment of the node positioned at the left side of the node is smaller than the initial numerical information of the number segment of the node, and the numerical information of the number segment of the node positioned at the right side of the node is larger than the end numerical information of the number segment of the node;
After the object to be newly added is combined with the existing object, a newly added number segment is generated, wherein the newly added number segment comprises a new number segment and/or a number segment after updating the existing number segment; storing the newly added number segments in a storage rule of a balanced binary tree structure, wherein the mode for storing the newly added number segments comprises the following steps: and merging the newly added number segment with one of at least one existing number segment stored in a balanced binary tree structure.
2. The method of claim 1, wherein the determining whether to merge the object to be added with the existing object based on the relationship between the numerical information of the object to be added and the numerical information of the existing object comprises:
determining whether the numerical information of the number to be added is adjacent to the numerical information of the existing number or not under the condition that the object to be added is the number to be added and the existing object is the existing number;
Generating a target number segment based on the numerical information of the number to be added and the numerical information of the existing number under the condition that the numerical information of the number to be added is adjacent to the numerical information of the existing number;
and under the condition that the numerical information of the number to be added is not adjacent to the numerical information of the existing number, not merging the number to be added and the existing number.
3. The method of claim 1, wherein the determining whether to merge the object to be added with the existing object based on the relationship between the numerical information of the object to be added and the numerical information of the existing object comprises:
Determining the relation between the numerical information of the number to be added and the initial numerical information and the ending numerical information of the existing number segment under the condition that the object to be added is the number to be added and the existing object is the existing number segment;
combining the number to be added with the existing number segment and updating the initial value information of the existing number segment to be the initial value information of the new number under the condition that the value information of the number to be added is adjacent to the initial value information and the value information of the number to be added is smaller than the initial value information;
Combining the number to be added with the existing number segment and updating the ending numerical value information of the existing number segment to be the ending numerical value information of the new number under the condition that the numerical value information of the number to be added is adjacent to the ending numerical value information and the numerical value information of the number to be added is larger than the initial numerical value information;
when the number value information to be added is positioned between the initial value information and the ending value information, keeping the initial value information and the ending value information of the existing number unchanged, and merging the number to be added into the existing number segment.
4. The method of claim 1, wherein the determining whether to merge the object to be added with the existing object based on the relationship between the numerical information of the object to be added and the numerical information of the existing object comprises:
determining the relation between the numerical information of the existing number and the initial numerical information and the ending numerical information of the number waiting section under the condition that the object to be added is the number to be added Duan Ju and the existing object is the existing number;
Combining the existing number with the number waiting segment and updating the initial value information of the number waiting segment to be newly added to be the value information of the existing number under the condition that the value information of the existing number is adjacent to the initial value information of the number waiting segment to be newly added and the value information of the existing number is smaller than the initial value information of the number waiting segment to be newly added;
Combining the existing number with the number waiting segment and updating the ending numerical information of the number waiting segment to be newly added to the numerical information of the existing number under the condition that the numerical information of the existing number is adjacent to the ending numerical information of the number waiting segment to be newly added and the numerical information of the existing number is larger than the ending numerical information of the number waiting segment to be newly added;
when the numerical value information of the existing number is located between the starting numerical value information and the ending numerical value information of the to-be-added number segment, keeping the starting numerical value information and the ending numerical value information of the to-be-added number segment unchanged, and combining the existing number to the to-be-added number segment.
5. The method of claim 1, wherein the determining whether to merge the object to be added with the existing object based on the relationship between the numerical information of the object to be added and the numerical information of the existing object comprises:
determining the relation between the initial value information and the ending value information of the number waiting segment and the initial value information and the ending value information of the existing number segment under the condition that the object to be added is the number to be added Duan Ju and the existing object is the existing number segment;
if the ending numerical value information of the number to be added is smaller than the starting numerical value information of the existing number segment, and the ending numerical value information of the number to be added is not adjacent to the starting numerical value information of the existing number segment, the number to be added and the existing number segment are not combined;
continuously comparing the initial value information of the number to be added with the initial value information of the existing number segment under the condition that the end value information of the number to be added is larger than the initial value information of the existing number segment and the end value information of the number to be added is smaller than the end value information of the existing number segment, and combining the number to be added with the existing number segment under the condition that the initial value information of the number to be added is smaller than or larger than the initial value information of the existing number segment;
Combining the number to be added with the existing number segment under the condition that the ending numerical information of the number to be added is larger than the ending numerical information of the existing number segment and the starting numerical information of the number to be added is smaller than the starting numerical information of the existing number segment;
Combining the number to be added with the existing number segment under the condition that the ending numerical value information of the number to be added is larger than the ending numerical value information of the existing number segment and the starting numerical value information of the number to be added is located between the starting numerical value information and the ending numerical value information of the existing number segment;
And under the condition that the initial value information of the number to be added is larger than the ending value information of the existing number segment, not merging the number to be added and the existing number segment.
6. The method of claim 1, wherein storing the appended number segments in a balanced binary tree structured storage rule comprises:
Comparing the start value information and the end value information of the newly added number segment with the start value information and the end value information of the first number segment in the at least one existing number segment stored in the balanced binary tree structure; the first number segment is a number segment positioned at the top of the tree of the balanced binary tree structure;
determining a second number segment as a new first number segment under the condition that the ending numerical information of the newly added number segment is smaller than the starting numerical information of the first number segment; further comparing the initial value information and the ending value information of the newly added number segment with the ending value information of the new first number segment until determining whether the attribute values of the newly added number segment and the final first number segment are the same or not under the condition that the initial value information and the ending value information of the newly added number segment are adjacent to the number of the ending value information of the final first number segment, and if so, merging the newly added number segment with the final first number segment; the second number segment is a number segment of the left subtree positioned in the first number segment.
7. The method according to claim 1, wherein the method further comprises:
Inquiring an object to be inquired by utilizing a storage rule of a balanced binary tree structure, and determining a number segment to which the object to be inquired belongs; wherein the object to be queried is a number to be queried and/or a number segment to be queried;
And determining the attribute value of the object to be queried based on the number segment to which the object to be queried belongs.
8. A number processing apparatus, the apparatus comprising:
A first determining unit, configured to determine whether an attribute value of an object to be newly added is the same as an attribute value of an existing object; the object to be newly added is a number to be newly added and/or a number segment to be newly added, and the existing object is an existing number and/or an existing number segment;
A second determining unit, configured to determine whether to merge the object to be added with the existing object based on a relationship between numerical information of the object to be added and numerical information of the existing object, when the attribute value of the object to be added is the same as the attribute value of the existing object;
The apparatus further comprises:
A first storage unit for storing at least one existing number segment in a balanced binary tree structure; wherein each parent node in the balanced binary tree structure comprises a left child node and a right child node; the starting numerical information of the number segment positioned at the right child node is larger than the ending numerical information of the number segment positioned at the father node, and the starting numerical information of the number segment of the right child node is not adjacent to the ending numerical information of the number segment positioned at the father node; for the number segment of each node in the balanced binary tree structure, the numerical information of the number segment of the node positioned at the left side of the node is smaller than the initial numerical information of the number segment of the node, and the numerical information of the number segment of the node positioned at the right side of the node is larger than the end numerical information of the number segment of the node;
after the object to be newly added is combined with the existing object, a newly added number segment is generated, the newly added number segment comprises a new number segment and/or a number segment after updating the existing number segment, and the device further comprises:
The second storage unit is configured to store the newly added number segment in a storage rule with a balanced binary tree structure, where a manner of storing the newly added number segment includes: and merging the newly added number segment with one of at least one existing number segment stored in a balanced binary tree structure.
9. An electronic device, the electronic device comprising: a memory having stored thereon computer executable instructions which when executed by a processor perform the method of any of claims 1 to 7.
10. A computer storage medium having stored thereon executable instructions which when executed by a processor implement the method of any of claims 1 to 7.
CN202111129906.XA 2021-09-26 2021-09-26 Number processing method and device, electronic equipment and storage medium Active CN115883508B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202111129906.XA CN115883508B (en) 2021-09-26 2021-09-26 Number processing method and device, electronic equipment and storage medium

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202111129906.XA CN115883508B (en) 2021-09-26 2021-09-26 Number processing method and device, electronic equipment and storage medium

Publications (2)

Publication Number Publication Date
CN115883508A CN115883508A (en) 2023-03-31
CN115883508B true CN115883508B (en) 2024-06-07

Family

ID=85762585

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202111129906.XA Active CN115883508B (en) 2021-09-26 2021-09-26 Number processing method and device, electronic equipment and storage medium

Country Status (1)

Country Link
CN (1) CN115883508B (en)

Citations (9)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN1878331A (en) * 2006-07-07 2006-12-13 华为技术有限公司 Switched network bureau data centralized processing method and system
CN1917667A (en) * 2006-09-08 2007-02-21 华为技术有限公司 System for processing numbers and processing method in service of sending grouped short message
CN101751475A (en) * 2010-01-08 2010-06-23 联动优势科技有限公司 Method for compressing section records and device therefor
CN103188649A (en) * 2011-12-29 2013-07-03 北京新媒传信科技有限公司 Method and device for searching attribution place of mobile phone number and service processing method
CN103345469A (en) * 2013-05-24 2013-10-09 联动优势科技有限公司 Storing and inquiring method and device of number sets
CN103906039A (en) * 2012-12-27 2014-07-02 中国移动通信集团福建有限公司 Method and device for preventing leakage of mobile phone numbers
CN110532295A (en) * 2019-08-01 2019-12-03 北京三快在线科技有限公司 A kind of method and device of computer-implemented information processing, information inquiry
CN110737663A (en) * 2019-10-15 2020-01-31 腾讯科技(深圳)有限公司 data storage method, device, equipment and storage medium
CN111694835A (en) * 2019-06-13 2020-09-22 上海寻梦信息技术有限公司 Number section access method, system, equipment and storage medium of logistics electronic bill

Family Cites Families (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US8489669B2 (en) * 2000-06-07 2013-07-16 Apple Inc. Mobile data processing system moving interest radius
JP5538995B2 (en) * 2010-04-30 2014-07-02 キヤノン株式会社 Information processing apparatus, information processing method, and program

Patent Citations (9)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN1878331A (en) * 2006-07-07 2006-12-13 华为技术有限公司 Switched network bureau data centralized processing method and system
CN1917667A (en) * 2006-09-08 2007-02-21 华为技术有限公司 System for processing numbers and processing method in service of sending grouped short message
CN101751475A (en) * 2010-01-08 2010-06-23 联动优势科技有限公司 Method for compressing section records and device therefor
CN103188649A (en) * 2011-12-29 2013-07-03 北京新媒传信科技有限公司 Method and device for searching attribution place of mobile phone number and service processing method
CN103906039A (en) * 2012-12-27 2014-07-02 中国移动通信集团福建有限公司 Method and device for preventing leakage of mobile phone numbers
CN103345469A (en) * 2013-05-24 2013-10-09 联动优势科技有限公司 Storing and inquiring method and device of number sets
CN111694835A (en) * 2019-06-13 2020-09-22 上海寻梦信息技术有限公司 Number section access method, system, equipment and storage medium of logistics electronic bill
CN110532295A (en) * 2019-08-01 2019-12-03 北京三快在线科技有限公司 A kind of method and device of computer-implemented information processing, information inquiry
CN110737663A (en) * 2019-10-15 2020-01-31 腾讯科技(深圳)有限公司 data storage method, device, equipment and storage medium

Non-Patent Citations (3)

* Cited by examiner, † Cited by third party
Title
"A Scalable Attribute Based Encryption for Secure Data Storage and Access in Cloud";Kamalakanta Sethi;《2019 International Conference on Cyber Security and Protection of Digital Services (Cyber Security)》;20191031;全文 *
"高效的手机号码及短信保密系统研究";常青青;《中国优秀硕士学位论文全文数据库 信息科技辑》;20210715;全文 *
人名直接映射电话号码的研究;方贵明;吴志美;赵蔚;;通信学报;20080715(第07期);全文 *

Also Published As

Publication number Publication date
CN115883508A (en) 2023-03-31

Similar Documents

Publication Publication Date Title
CN113064859B (en) Metadata processing method and device, electronic equipment and storage medium
CN110888837B (en) Object storage small file merging method and device
CN107609011B (en) Database record maintenance method and device
CN110647423B (en) Method, device and readable medium for creating storage volume mirror image based on application
CN112559529A (en) Data storage method and device, computer equipment and storage medium
CN109388651B (en) Data processing method and device
KR101640733B1 (en) System for Managing data based In-Memory DataBase and method thereof
CN114297204A (en) Data storage and retrieval method and device for heterogeneous data source
CN111382179B (en) Data processing method and device and electronic equipment
CN115883508B (en) Number processing method and device, electronic equipment and storage medium
CN110569315B (en) Data processing method and device based on data warehouse
CN109542860B (en) Service data management method based on HDFS and terminal equipment
CN113326063B (en) Data processing method, electronic device and storage medium
CN114896641A (en) Data verification method and device, electronic equipment and computer readable storage medium
CN114564501A (en) Database data storage and query methods, devices, equipment and medium
CN113411364B (en) Resource acquisition method and device and server
CN115114289A (en) Data query method and device and electronic equipment
CN114896276A (en) Data storage method and device, electronic equipment and distributed storage system
CN114297196A (en) Metadata storage method and device, electronic equipment and storage medium
CN114490865A (en) Database synchronization method, device, equipment and computer storage medium
CN109739883B (en) Method and device for improving data query performance and electronic equipment
CN113268483A (en) Request processing method and device, electronic equipment and storage medium
CN112487111A (en) Data table association method and device based on KV database
US8788483B2 (en) Method and apparatus for searching in a memory-efficient manner for at least one query data element
CN110334098A (en) A kind of database combining method and system based on script

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication
SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination
GR01 Patent grant