CN115883508A - 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
CN115883508A
CN115883508A CN202111129906.XA CN202111129906A CN115883508A CN 115883508 A CN115883508 A CN 115883508A CN 202111129906 A CN202111129906 A CN 202111129906A CN 115883508 A CN115883508 A CN 115883508A
Authority
CN
China
Prior art keywords
value information
newly added
numerical value
existing
number segment
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.)
Granted
Application number
CN202111129906.XA
Other languages
Chinese (zh)
Other versions
CN115883508B (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

Images

Landscapes

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

Abstract

The application discloses a number processing method, a number processing 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 newly added is the same as the attribute value of the existing object, determining whether to combine the object to be newly added and the existing object or not based on the relationship between the numerical value information of the object to be newly added and the numerical value 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 and device, electronic equipment and a storage medium.
Background
In many systems such as internet, internet of things, and telecommunication, a certain Identity Document (ID) is commonly used to identify a type of information, such as a mobile phone number, a communication software account, and the like. For each ID, a lot of tag information is attached. For example, in an internet-of-things capability middleware system, hundreds of different attribute information exceeding 10 hundred million terminals of the internet-of-things equipment needs to be maintained, and how to quickly and accurately query a value of a specified 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 foregoing technical problem, embodiments of the present application provide a number processing method and apparatus, an electronic device, 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 newly added is the same as the attribute value of the existing object, determining whether to combine the object to be newly added and the existing object based on the relationship between the numerical value information of the object to be newly added and the numerical value information of the existing object.
In an optional implementation manner of this application, determining whether to merge the object to be newly added with the existing object based on a relationship between the numerical information of the object to be newly added and the numerical information of the existing object includes:
under the condition that the object to be newly added is a number to be newly added and the existing object is an existing number, determining whether the numerical information of the number to be newly added is adjacent to the numerical information of the existing number;
under the condition that the numerical information of the number to be newly added is adjacent to the numerical information of the existing number, generating a target number segment based on the numerical information of the number to be newly added and the numerical information of the existing number;
and under the condition that the numerical information of the number to be newly added is not adjacent to the numerical information of the existing number, not combining the number to be newly added and the existing number.
In an optional implementation manner of this application, determining whether to merge the object to be newly added with the existing object based on a relationship between the numerical information of the object to be newly added and the numerical information of the existing object includes:
determining the relationship between the numerical value information of the number to be newly added and the initial numerical value information and the ending numerical value information of the existing number segment under the condition that the object to be newly added is the number to be newly added and the existing object is the existing number segment;
combining the number to be newly added with the existing number segment and updating the initial numerical value information of the existing number segment to be the initial numerical value information of the newly added number under the condition that the numerical value information of the number to be newly added is adjacent to the initial numerical value information and the numerical value information of the number to be newly added is smaller than the initial numerical value information;
combining the number to be newly added with the existing number segment and updating the ending value information of the existing number segment to be the ending value information of the newly added number under the condition that the number value information of the number to be newly added is adjacent to the ending value information and the number value information of the number to be newly added is greater than the initial value information;
and when the numerical value information of the number to be newly added is positioned between the initial numerical value information and the ending numerical value information, keeping the initial numerical value information and the ending numerical value information of the existing number unchanged, and combining the number to be newly added to the existing number section.
In an optional implementation manner of this application, determining whether to merge the object to be newly added with the existing object based on a relationship between the numerical information of the object to be newly added and the numerical information of the existing object includes:
determining the relationship between the numerical value information of the existing number and the initial numerical value information and the ending numerical value information of the number segment to be newly added under the condition that the object to be newly added is the number segment to be newly added and the existing object is the existing number;
combining the existing number and the number segment to be newly added under the condition that the numerical value information of the existing number is adjacent to the initial numerical value information of the number segment to be newly added and the numerical value information of the existing number is smaller than the initial numerical value information of the number segment to be newly added, and updating the initial numerical value information of the number segment to be newly added to be the numerical value information of the existing number;
combining the existing number and the number segment to be newly added under the condition that the numerical value information of the existing number is adjacent to the end numerical value information of the number segment to be newly added and the numerical value information of the existing number is greater than the end numerical value information of the number segment to be newly added, and updating the end numerical value information of the number segment to be newly added into the numerical value information of the existing number;
and when the numerical value information of the existing number is positioned between the initial numerical value information and the ending numerical value information of the number segment to be newly added, keeping the initial numerical value information and the ending numerical value information of the number segment to be newly added unchanged, and merging the existing number into the number segment to be newly added.
In an optional embodiment of the present application, the determining whether to merge the object to be newly added and the existing object based on a relationship between the numerical information of the object to be newly added and the numerical information of the existing object includes:
determining the relationship between the initial numerical value information and the ending numerical value information of the number segment to be added and the initial numerical value information and the ending numerical value information of the existing number segment under the condition that the object to be added is the number segment to be added and the existing object is the existing number segment;
under the condition that the ending numerical value information of the number segment to be newly added is smaller than the initial numerical value information of the existing number segment, and the ending numerical value information of the number segment to be newly added is not adjacent to the initial numerical value information of the existing number segment, the number segment to be newly added and the existing number segment are not combined;
under the condition that the ending numerical value information of the number segment to be newly added is larger than the initial numerical value information of the existing number segment and the ending numerical value information of the number segment to be newly added is smaller than the ending numerical value information of the existing number segment, continuously comparing the initial numerical value information of the number segment to be newly added with the initial numerical value information of the existing number segment, and under the condition that the initial numerical value information of the number segment to be newly added is smaller than or larger than the initial numerical value information of the existing number segment, combining the number segment to be newly added with the existing number segment;
combining the number segment to be newly added with the existing number segment under the condition that the ending numerical value information of the number segment to be newly added is greater than the ending numerical value information of the existing number segment, and the starting numerical value information of the number segment to be newly added is less than the starting numerical value information of the existing number segment;
combining the number segment to be newly added with the existing number segment under the condition that the ending value information of the number segment to be newly added is greater than the ending value information of the existing number segment and the starting value information of the number segment to be newly added is positioned between the starting value information and the ending value information of the existing number segment;
and under the condition that the initial numerical value information of the number segment to be newly added is greater than the end numerical value information of the existing number segment, not combining the number segment to be newly added and the existing number segment.
In an optional 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 value information of the number segment positioned at the right child node is larger than the ending numerical value information of the number segment positioned at the father node, and the starting numerical value information of the number segment of the right child node is not adjacent to the ending numerical value 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 on 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 on the right side of the node is larger than the ending numerical information of the number segment of the node.
In an optional embodiment of the present application, after merging the object to be newly added with 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 obtained by updating the existing number segment, and the method further includes:
storing the new number segment according to a storage rule of a balanced binary tree structure, wherein the mode for storing the new number segment comprises the following steps: and combining the newly added number segment with one of the at least one existing number segment stored in a balanced binary tree structure.
In an optional embodiment of the present application, the storing the newly added number segment according to a storage rule of a balanced binary tree structure includes:
comparing the initial value information and the end value information of the newly added number segment with the initial value information and the end value information of the first number segment in at least one existing number segment stored in a balanced binary tree structure; the first number segment is a number segment positioned at the top of the balanced binary tree structure;
determining the second number segment as a new first number segment under the condition that the ending numerical value information of the newly added number segment is smaller than the starting numerical value information of the first number segment; further comparing the initial numerical value information and the end numerical value information of the newly added number segment with the end numerical 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 numerical value information and the end numerical value information of the newly added number segment are adjacent to the number of the final end numerical value information of the first number segment, and if so, merging the newly added number segment and the final first number segment; and the second number section is the number section of the left subtree positioned in the first number section.
In an optional embodiment of the present application, the method further comprises:
inquiring an object to be inquired by using a storage rule of a balanced binary tree structure, and determining a number segment to which the object to be inquired belongs; the object to be inquired is a number to be inquired and/or a number segment to be inquired;
and determining the attribute value of the object to be queried based on the number segment to which the object to be queried belongs.
An embodiment of the present application further provides a number processing apparatus, where the apparatus includes:
the first determining unit is used for 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 a second determining unit, configured to determine whether to merge the object to be newly added with the existing object based on a relationship between the numerical information of the object to be newly added and the numerical information of the existing object when the attribute value of the object to be newly 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 newly added is adjacent to the numerical information of the existing number or not under the condition that the object to be newly added is the number to be newly added and the existing object is the existing number;
under the condition that the numerical information of the number to be newly added is adjacent to the numerical information of the existing number, generating a target number segment based on the numerical information of the number to be newly added and the numerical information of the existing number;
and under the condition that the numerical value information of the number to be newly added is not adjacent to the numerical value information of the existing number, not combining the number to be newly added and the existing number.
In an optional embodiment of the present application, the second determining unit is specifically configured to:
determining the relationship between the numerical value information of the number to be newly added and the initial numerical value information and the ending numerical value information of the existing number segment under the condition that the object to be newly added is the number to be newly added and the existing object is the existing number segment;
combining the number to be newly added with the existing number segment and updating the initial numerical value information of the existing number segment to be the initial numerical value information of the newly added number under the condition that the numerical value information of the number to be newly added is adjacent to the initial numerical value information and the numerical value information of the number to be newly added is smaller than the initial numerical value information;
combining the number to be newly added with the existing number segment and updating the ending value information of the existing number segment to be the ending value information of the newly added number under the condition that the number value information of the number to be newly added is adjacent to the ending value information and the number value information of the number to be newly added is greater than the initial value information;
and when the numerical value information of the number to be newly added is positioned between the initial numerical value information and the ending numerical value information, keeping the initial numerical value information and the ending numerical value information of the existing number unchanged, and combining the number to be newly added to the existing number section.
In an optional embodiment of the present application, the second determining unit is specifically configured to:
determining the relationship between the numerical value information of the existing number and the initial numerical value information and the ending numerical value information of the number segment to be newly added under the condition that the object to be newly added is the number segment to be newly added and the existing object is the existing number;
combining the existing number and the number segment to be newly added under the condition that the numerical value information of the existing number is adjacent to the initial numerical value information of the number segment to be newly added and the numerical value information of the existing number is smaller than the initial numerical value information of the number segment to be newly added, and updating the initial numerical value information of the number segment to be newly added to be the numerical value information of the existing number;
combining the existing number and the number segment to be newly added under the condition that the numerical value information of the existing number is adjacent to the end numerical value information of the number segment to be newly added and the numerical value information of the existing number is greater than the end numerical value information of the number segment to be newly added, and updating the end numerical value information of the number segment to be newly added into the numerical value information of the existing number;
and when the numerical value information of the existing number is positioned between the initial numerical value information and the ending numerical value information of the number segment to be newly added, keeping the initial numerical value information and the ending numerical value information of the number segment to be newly added unchanged, and merging the existing number into the number segment to be newly added.
In an optional embodiment of the present application, the second determining unit is specifically configured to:
determining the relationship between the initial numerical value information and the ending numerical value information of the number segment to be added and the initial numerical value information and the ending numerical value information of the existing number segment under the condition that the object to be added is the number segment to be added and the existing object is the existing number segment;
under the condition that the ending value information of the number segment to be newly added is smaller than the starting value information of the existing number segment and the ending value information of the number segment to be newly added is not adjacent to the starting value information of the existing number segment, the number segment to be newly added and the existing number segment are not merged;
under the condition that the ending numerical value information of the number segment to be newly added is larger than the initial numerical value information of the existing number segment and the ending numerical value information of the number segment to be newly added is smaller than the ending numerical value information of the existing number segment, continuously comparing the initial numerical value information of the number segment to be newly added with the initial numerical value information of the existing number segment, and under the condition that the initial numerical value information of the number segment to be newly added is smaller than or larger than the initial numerical value information of the existing number segment, combining the number segment to be newly added with the existing number segment;
combining the number segment to be newly added with the existing number segment under the condition that the ending numerical value information of the number segment to be newly added is greater than the ending numerical value information of the existing number segment, and the starting numerical value information of the number segment to be newly added is less than the starting numerical value information of the existing number segment;
combining the number segment to be newly added with the existing number segment under the condition that the ending value information of the number segment to be newly added is greater than the ending value information of the existing number segment and the starting value information of the number segment to be newly added is positioned between the starting value information and the ending value information of the existing number segment;
and under the condition that the initial numerical value information of the number segment to be newly added is greater than the end numerical value information of the existing number segment, not combining the number segment to be newly added and the existing number segment.
In an optional embodiment of the present application, the apparatus further includes:
the first storage unit is used 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 initial numerical information of the number segment positioned at the right child node is greater than the end numerical information of the number segment positioned at the father node, and the initial numerical information of the number segment of the right child node is not adjacent to the end 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 on 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 on the right side of the node is larger than the ending numerical information of the number segment of the node.
In an optional embodiment of the present application, the new number segment is generated after the object to be newly added is merged with the existing object, the new number segment includes a new number segment and/or is to the number segment after the existing number segment is updated, the apparatus further includes:
the second storage unit stores the new number segment according to a storage rule of a balanced binary tree structure, wherein the mode for storing the new number segment comprises the following steps: and combining the newly added number segment with one of the at least one existing number segment stored in a balanced binary tree structure.
In an optional implementation manner of this application, the second storage unit is specifically configured to:
comparing the initial numerical value information and the end numerical value information of the newly added number segment with the initial numerical value information and the end numerical value information of the first number segment in at least one existing number segment stored in a balanced binary tree structure; the first number segment is a number segment positioned at the top of the balanced binary tree structure;
determining the second number segment as a new first number segment under the condition that the ending numerical value information of the newly added number segment is smaller than the starting numerical value information of the first number segment; further comparing the initial numerical value information and the end numerical value information of the newly added number segment with the end numerical 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 numerical value information and the end numerical value information of the newly added number segment are adjacent to the number of the final end numerical value information of the first number segment, and if so, merging the newly added number segment and the final first number segment; and the second number section is the number section of the left subtree positioned in the first number section.
In an optional embodiment of the present application, the apparatus further includes:
the query unit is used for querying the object to be queried by using a storage rule of a balanced binary tree structure and determining the number segment to which the object to be queried belongs; the object to be inquired is a number to be inquired and/or a number segment to be inquired; and determining the attribute value of the object to be queried based on the number segment to which the object to be queried belongs.
An embodiment of the present application further provides an electronic device, where the electronic device includes: the computer-readable medium may include a memory and a processor, wherein the memory stores computer-executable instructions, and the processor can implement the method of the above-mentioned embodiment when executing the computer-executable instructions on the memory.
The embodiment of the application also provides a computer storage medium, wherein the storage medium stores executable instructions, and the executable instructions are executed by a processor to realize the method of the embodiment.
According to the technical scheme of 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 newly added is the same as the attribute value of the existing object, determining whether to combine the object to be newly added and the existing object based on the relationship between the numerical value information of the object to be newly added and the numerical value information of the existing object. Therefore, the finely-divided numbers and the number sections can be fused to the maximum extent by judging the relationship between the blood relationship (namely whether the attributes are the same) of the numbers and the number sections and the mutual relationship of the numerical values corresponding to the numbers and the number sections, so that the purposes of accurately compressing the number sections and saving storage space resources are achieved.
Drawings
Fig. 1 is a first schematic diagram of a number query process according to an embodiment of the present application;
fig. 2 is a second schematic diagram of a number query process provided in the embodiment of the present application;
fig. 3 is a schematic flowchart 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 newly 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 a newly added number segment according to 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 of querying a number according to an embodiment of the present application;
fig. 8 is a schematic structural component diagram of a number processing apparatus according to an embodiment of the present application;
fig. 9 is a schematic structural component diagram of an electronic device according to an embodiment of the present application.
Detailed Description
So that the manner in which the features and elements of the present embodiments can be understood in detail, a more particular description of the embodiments, briefly summarized above, may be had by reference to embodiments, some of which are illustrated in the appended drawings.
For number 861440898200004, this number corresponds to a real-time temperature and wind detection device, and is connected and data managed by a server in a certain area, when data of the current device needs to be queried quickly in real time, the server address corresponding to this number needs to be located quickly through the number from tens of thousands of relevant area servers in the whole country, and a request instruction is sent to the server address to acquire the data of the current device.
In one arrangement, the number 861440898200004 can be queried using the query process shown in FIG. 1.
Specifically, a record may be created for each ID, and the related attribute information thereof is recorded, and when some attribute status information of a certain ID needs to be queried, an attribute value (specifically, a server address) may be directly obtained through the ID; furthermore, in the field of telecommunications, part of attributes are card number resources are planned in units of ten thousand segments, and in this case, the ID can be stored in units of ten thousand in succession as attribute information. For example, the number may be stored as a corresponding relationship between 86144089820 (the last 4 digits are omitted) and the attribute, when querying, the number may be removed from the last 4 digits, and then the database may be queried for routing, where the processing idea of the ten-thousand number segment depends on a special rule for number division, and is an upgraded 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 in a hash manner, if 10 hundred million IDs exist, 10 hundred million pieces of data need to be stored, which results in high storage cost and large storage space consumption. 10 hundred million pieces of data need to be stored and managed by more than 10 memory server clusters and near 70G memory space; as an improvement scheme of the scheme, the ten-thousand segment can compress the storage space to a certain degree as a special condition, but the ten-thousand segment scene is low, the number segments are compressed from 10 continuous bits to one higher bit, the length of the number segments is inconsistent, the calculation logic is not uniform, and under the condition of large data volume, the space waste to a certain degree also exists.
In another scheme, the query process shown in fig. 2 can be used to query the number 861440898200004.
As shown in fig. 2, when a batch of continuous IDs is newly generated, a new number segment is stored in the form of a number segment marked by a start number and an end number, and the number segment is attached with a related attribute value, and during query, a number segment list is sequentially traversed, and when a target ID falls in a certain number segment interval, an attribute value of a number segment to which the ID belongs is obtained for routing.
The scheme stores the initial number and the end number in a recording mode, can accurately compress the number segment storage space to a greater extent, and saves storage resources. However, there are the following problems: 1. when a number segment to which an ID belongs is positioned, the number segment table needs to be traversed in full quantity, the ID and all the number segment tables are compared one by one, whether the ID falls in the number segment table interval or not is judged, and the time complexity O (n) is high; 2. when number segment data is newly added or migrated (attribute expansion or merging), fragments are easily caused, the fragments accumulate day by day, the fragment rate is higher and higher, and the traversal time complexity and the storage space loss are further increased.
According to the technical scheme of the embodiment of the application, the number segment compression and routing method based on collision fusion of the adjacent numbers and the number segments can reduce the number segment fragment rate and the time complexity of route searching, save the storage space and improve the routing efficiency of the numbers.
Fig. 3 is a flowchart illustrating a number processing method according to an embodiment of the present application, where as shown in fig. 1, the number processing method includes the following steps:
step 101: and determining 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 newly added is the same as the attribute value of the existing object, and represents that the object to be newly added and the existing object have the same blood relationship.
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 regarded that the collision between the object to be newly added and the existing object is finished, which may also be referred to as collision pop-up. The collision ending or collision flicking can be specifically understood as that no merging condition exists between the object to be newly added and the existing object.
Under the condition that the collision between the object to be newly added and an existing object is finished, the judgment of whether the attribute values of the object to be newly added and other existing objects are the same can be further continued until the existing object with the same attribute as the object to be newly added is determined, and then the judgment of the step 102 is continued.
Step 102: and under the condition that the attribute value of the object to be newly added is the same as the attribute value of the existing object, determining whether to combine the object to be newly added and the existing object based on the relationship between the numerical value information of the object to be newly added and the numerical value information of the existing object.
In the embodiment of the application, under the condition that the object to be newly added is a number to be newly added, the numerical information of the object to be newly added is the specific number information of the number to be newly added; under the condition that the object to be newly added is a number segment to be newly added, the numerical information of the object to be newly added comprises starting numerical information and ending numerical information, wherein the starting numerical information is also called as the starting number of the number segment to be newly added and is the number with the minimum numerical value in the numbers included in the number segment to be newly added; the ending numerical value information is also called as the ending number of the number to be newly added and is the number with the largest numerical value in the numbers included in the number segment to be newly added. The numerical information of the existing object can be understood by referring to the same manner as the numerical information of the number to be newly added, and the details are not repeated here.
In the embodiment of the application, an existing number a is assumed to exist, and the attribute value of the existing number a is attr1; in addition, there is a number segment A, whose value is (begin: b, end: c), whose attribute value is attr2; and, the number a and the number segment a do not intersect (i.e., the number a does not belong to the number in the number segment a). In addition, the number to be newly added is a number d, the number segment to be newly added is a number segment B (begin: e, end: f), and the attribute value is attr2.
In an optional embodiment of the present application, the step 102 includes:
determining whether the numerical information of the number to be newly added is adjacent to the numerical information of the existing number or not under the condition that the object to be newly added is the number to be newly added and the existing object is the existing number;
under the condition that the numerical information of the number to be newly added is adjacent to the numerical information of the existing number, generating a target number segment based on the numerical information of the number to be newly added and the numerical information of the existing number;
and under the condition that the numerical information of the number to be newly added is not adjacent to the numerical information of the existing number, not combining the number to be newly added and the existing number.
Specifically, the collision process between the number d to be added and the existing number a is as shown in fig. 4, which is 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, continuously checking whether the number d and the number a are adjacent to (a +1= d or a-1= d), and if so, for example, a +1= d; collision fusion into number segment B (begin: a, end: d), if a-1= d, collision fusion into 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 sections;
step 1-3: if the attribute values of the number d and the number a are the same but not adjacent, the collision flicks, and the number d continuously collides with other numbers or number sections;
step 1-4: if the number d and all other numbers and number segments cannot be fused, the number d is independently stored as a record.
In an optional embodiment of the present application, the step 102 includes:
determining the relationship between the numerical value information of the number to be newly added and the initial numerical value information and the ending numerical value information of the existing number segment under the condition that the object to be newly added is the number to be newly added and the existing object is the existing number segment;
combining the number to be newly 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 newly added number under the condition that the numerical value information of the number to be newly added is adjacent to the initial value information and the numerical value information of the number to be newly added is smaller than the initial numerical value information;
combining the number to be newly added with the existing number segment and updating the ending value information of the existing number segment to be the ending value information of the newly added number under the condition that the number value information of the number to be newly added is adjacent to the ending value information and the number value information of the number to be newly added is greater than the initial value information;
and when the numerical value information of the number to be newly added is positioned between the initial numerical value information and the ending numerical value information, keeping the initial numerical value information and the ending numerical value information of the existing number unchanged, and combining the number to be newly added to the existing number section.
Specifically, the collision process between the number d to be newly added 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 or not, if so, popping up in a collision manner, and continuing to collide the number d 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, the number d and the initial number b of the number segment A are collided;
(1) If d +1= b, the number d is fused into the number segment A, the number segment A is changed into (begin: d, end: c), and meanwhile, the single number record d is deleted;
(2) If the number d is larger than the starting number b of the number segment A and smaller than the ending number c of the number segment A, d is merged into the number segment A, and the number segment A does not change at this time, and an individual number record d is deleted;
(3) If d-1= c, the number d is merged into the number segment A, the number segment A is changed to (begin: b, end: d), and the individual number record d is deleted.
In an optional embodiment of the present application, the step 102 includes:
determining the relationship between the numerical value information of the existing number and the initial numerical value information and the ending numerical value information of the number segment to be newly added under the condition that the object to be newly added is the number segment to be newly added and the existing object is the existing number;
combining the existing number and the segment to be newly added under the condition that the numerical value information of the existing number is adjacent to the initial numerical value information of the segment to be newly added and the numerical value information of the existing number is smaller than the initial numerical value information of the segment to be newly added, and updating the initial numerical value information of the segment to be newly added into the numerical value information of the existing number;
combining the existing number and the number segment to be newly added under the condition that the numerical value information of the existing number is adjacent to the end numerical value information of the number segment to be newly added and the numerical value information of the existing number is greater than the end numerical value information of the number segment to be newly added, and updating the end numerical value information of the number segment to be newly added into the numerical value information of the existing number;
and when the numerical value information of the existing number is positioned between the initial numerical value information and the ending numerical value information of the number segment to be newly added, keeping the initial numerical value information and the ending numerical value information of the number segment to be newly added unchanged, and merging the existing number into the number segment to be newly added.
Specifically, the collision process between the segment B to be newly added and the existing number a can be understood by referring to the collision process between the segment d to be newly added and the existing number a.
In an optional embodiment of the present application, the step 102 includes:
determining the relationship between the initial numerical value information and the end numerical value information of the number segment to be added and the initial numerical value information and the end numerical value information of the existing number segment under the condition that the object to be added is the number segment to be added and the existing object is the existing number segment;
under the condition that the ending numerical value information of the number segment to be newly added is smaller than the initial numerical value information of the existing number segment, and the ending numerical value information of the number segment to be newly added is not adjacent to the initial numerical value information of the existing number segment, the number segment to be newly added and the existing number segment are not combined;
under the condition that the ending numerical value information of the number segment to be newly added is larger than the initial numerical value information of the existing number segment and the ending numerical value information of the number segment to be newly added is smaller than the ending numerical value information of the existing number segment, continuously comparing the initial numerical value information of the number segment to be newly added with the initial numerical value information of the existing number segment, and under the condition that the initial numerical value information of the number segment to be newly added is smaller than or larger than the initial numerical value information of the existing number segment, combining the number segment to be newly added with the existing number segment;
combining the number segment to be newly added with the existing number segment under the condition that the ending value information of the number segment to be newly added is greater than the ending value information of the existing number segment and the starting value information of the number segment to be newly added is less than the starting value information of the existing number segment;
combining the number segment to be newly added with the existing number segment under the condition that the ending numerical value information of the number segment to be newly added is larger than the ending numerical value information of the existing number segment, and the starting numerical value information of the number segment to be newly added is positioned between the starting numerical value information and the ending numerical value information of the existing number segment;
and under the condition that the initial numerical value information of the number segment to be newly added is greater than the end numerical value information of the existing number segment, not combining the number segment to be newly added and the existing number segment.
Specifically, the collision process between the to-be-added number segment B and the existing number segment a is described as follows:
step 3-1: firstly, judging whether the attribute of a number segment B is the same as that of a number segment A, if so, finishing collision, and continuing to collide the number segment B 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 finished;
step 3-4: if f is larger than the starting number B of the number section A and f is smaller than the ending number c of the number section A, continuing to compare the starting number e of the number section B with the starting number B of the number section A, and if the starting number e of the number section B is smaller than the starting number B of the number section A, fusing the number section B and the number section A into a new number section A (begin: e, end: c), and deleting the record of the original number section B;
step 3-5: if f is larger than the starting number B of the number section A and f is smaller than the ending number c of the number section A, continuing to compare the starting number e of the number section B with the starting number B of the number section A, if e is larger than B, directly fusing the number section B into the number section A, keeping the content of the number section A unchanged, and deleting the record of the original number section B;
step 3-6: if f is larger than the ending number c of the number segment A and the starting number e of the number segment B is smaller than the starting number B of the number segment A, the number segment A is merged 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 larger than the ending number c of the number section A and the starting number e of the number section B is in the number section A interval, the number section B is merged into the number section A, the number section A becomes a new number section A (begin: B, end: f), and the original number section B record is deleted;
step 3-8: and if the starting number section e of the section B is larger than the ending number section f of the section A, the collision of the section B and the section A is ended.
In the embodiment of the application, through the mutual collision mode of the numbers and number segments listed in the above list, the absolutely independent number segment records of the same blood vessel edge (same attribute) can be finally generated, all fragments (repeated number segment, cross number segment and adjacent number segment) can be eliminated in the collision process, and the number segment data quantity is compressed to the maximum 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 initial numerical information of the number segment positioned at the right child node is greater than the end numerical information of the number segment positioned at the father node, and the initial numerical information of the number segment of the right child node is not adjacent to the end 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 value information of the number segment of the node on the left side of the node is smaller than the starting numerical value information of the number segment of the node, and the numerical value information of the number segment of the node on the right side of the node is larger than the ending numerical value information of the number segment of the node.
Specifically, based on the number and number segment collision basic method, the compressed (i.e., merged) number segments may be further stored in a balanced binary tree data structure, and fig. 5 is a schematic diagram of storing existing number segments based on the balanced binary tree structure according to the embodiment of the present application.
The basic rule of the balanced binary tree based on number segments is as follows:
(1) Each node only has a left child node and a right child node;
(2) The end (i.e., end number) value of the left child node (i.e., left child node) of each node is smaller 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 (namely the right child node) of each node is larger than the end value of the father node and is not adjacent;
(4) Once each node is adjacent to its parent node or child node (for example: end +1 of left child node = begin of parent node), the two nodes are merged into one node, and the balanced binary tree structure performs a re-self-balancing adjustment 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 on the right side of each node in the balanced binary tree structure are larger than the end value of the node.
In an optional embodiment of the present application, after merging the object to be newly added with 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 obtained by updating the existing number segment, and the number processing method further includes:
storing the new number segment according to a storage rule of a balanced binary tree structure, wherein the mode for storing the new number segment comprises the following steps: and merging the newly added number segment with one of the 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 according to a storage rule of a balanced binary tree structure includes:
comparing the initial numerical value information and the end numerical value information of the newly added number segment with the initial numerical value information and the end numerical value information of the first number segment in at least one existing number segment stored in a balanced binary tree structure; the first number segment is a number segment positioned at the top of the balanced binary tree structure;
determining the second number segment as a new first number segment under the condition that the ending numerical value information of the newly added number segment is smaller than the starting numerical value information of the first number segment; further comparing the initial numerical value information and the end numerical value information of the newly added number segment with the end numerical 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 numerical value information and the end numerical value information of the newly added number segment are adjacent to the number of the final end numerical value information of the first number segment, and if so, merging the newly added number segment and the final first number segment; and the second number section is the number section of the left subtree positioned in the first number section.
Specifically, fig. 6 is a schematic diagram of storing a new number segment according to a storage rule of a balanced binary tree structure provided in the embodiment of the present application, and the following description describes a storage process of the new number segment as follows:
1. for the newly added number segment (begin: 14411110457, end 14411110495), firstly colliding the newly added number segment with the top number segment (begin: 14411110457, end;
2. the number of the end of the new number section is smaller than the initial number begin of the target number section, and the left sub-number section of the target number section is continuously collided;
3. and (4) the new number segment begin number is adjacent to the end number of the target number segment, the relationship (attribute value) of the blood relationship is continuously judged to be the same, the new number segment and the old number segment are fused into one number segment, and the collision is finished.
The number segment table formed by storing the number segments in the mode can search the target number segment only by 3 times of collision under the worst condition, the time complexity is reduced from the original O (n) to O (logn), the time for number segment fusion (namely merging) is greatly shortened, the number segments can be accurately compressed, 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 using a storage rule of a balanced binary tree structure, and determining a number segment to which the object to be inquired belongs; the object to be inquired is a number to be inquired and/or a number segment to be inquired;
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 the embodiment of the present application, where when a specified attribute is queried by querying a certain number, a number segment routing table of a tree structure of a balanced binary tree structure is traversed, and when a number is queried, a corresponding attribute value can be quickly routed according to 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 a number belongs needs to be searched, and in the worst case, only 3 collisions need to be performed at most).
According to the technical scheme, the finely-divided numbers and the number sections are fused to the maximum extent by judging the blood relationship and the adjacent condition of the numbers and the number sections, so that the purposes of accurately compressing the number sections and saving storage space resources are achieved.
In addition, in the embodiment of the application, the starting number and the ending number of the number segment are used as comparison parameters, the attribute of the number segment is used as a blood relationship, and scattered number segments are stored in a data structure of a balanced binary tree, so that a data structure basis is provided for the number segment to be compressed quickly and effectively and for the number fast routing.
Furthermore, for the newly added number, the newly added number segment and the number segment split of the number segment table, under the mode of collision fusion of the balanced binary tree and the number segment, the newly added number segment and the newly added number segment are higher in efficiency and more accurate, and the probability of the number segment with fragments is lower.
In addition, in the embodiment of the present application, when a number segment is merged by collision and the number segment is stored in a balanced binary tree structure, and when a correlation attribute of a special ID needs to be searched from a number segment table corresponding to a balanced binary tree, the ID can be quickly routed to the corresponding number segment in a manner of traversing the balanced binary tree number segment table, so as to quickly acquire the correlation attribute.
In a word, the technical scheme of the embodiment of the application can compress and route the number segment, and obviously improves the space and time dimensions.
Compared with the first scheme shown in fig. 1, if there are 10 consecutive numbers or number segments of 00-09, the scheme of the embodiment of the present application is more flexible than the scheme of storing the 10 number segments as a number segment in a manner of removing the lowest bits and storing the number segment as a number, for example, 998 pieces of data are total, and only one record is required to be stored by using the scheme of the embodiment of the present application; compared with the scheme shown in fig. 2, 27 records are required to be stored for storing 10xx,11xx,12xx, 18xx,190x,191x,192x, 198x,1990, 1991, 1992, 1998, and the scheme of the embodiment of the application has higher compression rate and saves more space.
In addition, compared with the scheme of storing numbers in a number segment manner shown in fig. 2, a record is newly created for a common number segment, and whether the numbers fall in the corresponding number segment is compared one by one in a list manner during traversal, the time complexity is O (n), and the number segment table is prone to fragment, so that 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 improves the routing time complexity of the number to O (logn), saves the storage space through collision fusion, and simultaneously improves the routing efficiency of the number. (for example: a number table list with 3 ten thousand number segments and recorded more than 10 hundred million data attributes, if an ID is routed through the scheme shown in fig. 2, 3 ten thousand segment matching calculations are needed to find the home number segment in the worst case, but if the scheme of the embodiment of the present application is adopted, only 15 collisions are needed to accurately route to the home number segment at most).
Fig. 8 is a schematic structural component diagram of a number processing apparatus according to an embodiment of the present application, and as shown in fig. 8, the number processing 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 newly added with the existing object based on a relationship between the numerical information of the object to be newly added and the numerical information of the existing object when the attribute value of the object to be newly added is the same as the attribute value of the existing object.
In an optional embodiment of the present application, the second determining unit 802 is specifically configured to:
under the condition that the object to be newly added is a number to be newly added and the existing object is an existing number, determining whether the numerical information of the number to be newly added is adjacent to the numerical information of the existing number;
under the condition that the numerical value information of the number to be newly added is adjacent to the numerical value information of the existing number, generating a target number segment based on the numerical value information of the number to be newly added and the numerical value information of the existing number;
and under the condition that the numerical information of the number to be newly added is not adjacent to the numerical information of the existing number, not combining the number to be newly added and the existing number.
In an optional embodiment of the present application, the second determining unit 802 is specifically configured to:
determining the relationship between the numerical value information of the number to be newly added and the initial numerical value information and the ending numerical value information of the existing number segment under the condition that the object to be newly added is the number to be newly added and the existing object is the existing number segment;
combining the number to be newly added with the existing number segment and updating the initial numerical value information of the existing number segment to be the initial numerical value information of the newly added number under the condition that the numerical value information of the number to be newly added is adjacent to the initial numerical value information and the numerical value information of the number to be newly added is smaller than the initial numerical value information;
combining the number to be newly added with the existing number segment and updating the ending value information of the existing number segment to be the ending value information of the newly added number under the condition that the number value information of the number to be newly added is adjacent to the ending value information and the number value information of the number to be newly added is greater than the initial value information;
and when the numerical value information of the number to be newly added is positioned between the initial numerical value information and the ending numerical value information, keeping the initial numerical value information and the ending numerical value information of the existing number unchanged, and combining the number to be newly added to the existing number section.
In an optional embodiment of the present application, the second determining unit 802 is specifically configured to:
determining the relationship between the numerical value information of the existing number and the initial numerical value information and the ending numerical value information of the number segment to be newly added under the condition that the object to be newly added is the number segment to be newly added and the existing object is the existing number;
combining the existing number and the number segment to be newly added under the condition that the numerical value information of the existing number is adjacent to the initial numerical value information of the number segment to be newly added and the numerical value information of the existing number is smaller than the initial numerical value information of the number segment to be newly added, and updating the initial numerical value information of the number segment to be newly added to be the numerical value information of the existing number;
combining the existing number and the number segment to be newly added under the condition that the numerical value information of the existing number is adjacent to the end numerical value information of the number segment to be newly added and the numerical value information of the existing number is greater than the end numerical value information of the number segment to be newly added, and updating the end numerical value information of the number segment to be newly added into the numerical value information of the existing number;
and when the numerical value information of the existing number is positioned between the initial numerical value information and the ending numerical value information of the number segment to be newly added, keeping the initial numerical value information and the ending numerical value information of the number segment to be newly added unchanged, and merging the existing number into the number segment to be newly added.
In an optional embodiment of the present application, the second determining unit 802 is specifically configured to:
determining the relationship between the initial numerical value information and the ending numerical value information of the number segment to be added and the initial numerical value information and the ending numerical value information of the existing number segment under the condition that the object to be added is the number segment to be added and the existing object is the existing number segment;
under the condition that the ending numerical value information of the number segment to be newly added is smaller than the initial numerical value information of the existing number segment, and the ending numerical value information of the number segment to be newly added is not adjacent to the initial numerical value information of the existing number segment, the number segment to be newly added and the existing number segment are not combined;
under the condition that the ending numerical value information of the number segment to be newly added is larger than the initial numerical value information of the existing number segment and the ending numerical value information of the number segment to be newly added is smaller than the ending numerical value information of the existing number segment, continuously comparing the initial numerical value information of the number segment to be newly added with the initial numerical value information of the existing number segment, and under the condition that the initial numerical value information of the number segment to be newly added is smaller than or larger than the initial numerical value information of the existing number segment, combining the number segment to be newly added with the existing number segment;
combining the number segment to be newly added with the existing number segment under the condition that the ending value information of the number segment to be newly added is greater than the ending value information of the existing number segment and the starting value information of the number segment to be newly added is less than the starting value information of the existing number segment;
combining the number segment to be newly added with the existing number segment under the condition that the ending numerical value information of the number segment to be newly added is larger than the ending numerical value information of the existing number segment, and the starting numerical value information of the number segment to be newly added is positioned 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 segment to be newly added is greater than the end value information of the existing number segment, not merging the number segment to be newly added and the existing number segment.
In an optional embodiment of the present application, the apparatus further comprises:
a first storage unit 803, configured to store 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 value information of the number segment positioned at the right child node is larger than the ending numerical value information of the number segment positioned at the father node, and the starting numerical value information of the number segment of the right child node is not adjacent to the ending numerical value 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 on 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 on the right side of the node is larger than the ending numerical information of the number segment of the node.
In an optional implementation manner of this application, after merging the object to be newly added with the existing object, a newly added number segment is generated, where the newly added number segment includes a new number segment and/or is to the number segment updated by the existing number segment, the apparatus further includes:
the second storage unit 804 stores the new number segment according to a storage rule of a balanced binary tree structure, where a manner of storing the new number segment includes: and combining the newly added number segment with one of the at least one existing number segment stored in a balanced binary tree structure.
In an optional implementation manner of the present application, the second storage unit 804 is specifically configured to:
comparing the initial numerical value information and the end numerical value information of the newly added number segment with the initial numerical value information and the end numerical value information of the first number segment in at least one existing number segment stored in a balanced binary tree structure; the first number segment is a number segment positioned at the top of the balanced binary tree structure;
determining the second number segment as a new first number segment under the condition that the ending numerical value information of the newly added number segment is smaller than the starting numerical value information of the first number segment; further comparing the initial numerical value information and the end numerical value information of the newly added number segment with the end numerical 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 numerical value information and the end numerical value information of the newly added number segment are adjacent to the number of the final end numerical value information of the first number segment, and if so, merging the newly added number segment and the final first number segment; and the second number section is the number section of the left subtree positioned in the first number section.
In an optional embodiment of the present application, the apparatus further comprises:
a query unit 805, configured to query an object to be queried by using a storage rule of a balanced binary tree structure, and determine a number segment to which the object to be queried belongs; the object to be inquired is a number to be inquired and/or a number segment to be inquired; 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 by reference to the foregoing description of the number processing method. The functions of the units in the number processing apparatus shown in fig. 8 may be implemented by a program running on a processor, or may be implemented by specific logic circuits.
The embodiment of the application also provides the electronic equipment. Fig. 9 is a schematic diagram of a hardware structure of an electronic device according to an embodiment of the present application, and 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 understood that the bus system 904 is used to enable communications among the 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 the sake of clarity the various busses are labeled in figure 9 as the bus system 904.
Wherein the processor 901 performs at least the steps of the method shown in fig. 3 when executing the computer program.
It will be appreciated that the memory 902 can be either volatile memory or nonvolatile memory, and can include both volatile and nonvolatile memory. Among them, the nonvolatile Memory may be a Read Only Memory (ROM), a Programmable Read Only Memory (PROM), an Erasable Programmable Read-Only Memory (EPROM), an Electrically Erasable Programmable Read-Only Memory (EEPROM), a magnetic random access Memory (FRAM), a magnetic random access Memory (Flash Memory), a magnetic surface Memory, an optical Disc, or a Compact Disc Read-Only Memory (CD-ROM); the magnetic surface storage may be disk storage or tape storage. Volatile Memory can be Random Access Memory (RAM), which acts as external cache Memory. By way of illustration and not limitation, many forms of RAM are available, such as Static Random Access Memory (SRAM), synchronous Static Random Access Memory (SSRAM), dynamic Random Access Memory (DRAM), synchronous Dynamic Random Access Memory (SDRAM), double Data Rate Synchronous Dynamic Random Access Memory (DDRSDRAM), enhanced Synchronous Dynamic Random Access Memory (ESDRAM), enhanced Synchronous Dynamic Random Access Memory (Enhanced DRAM), synchronous Dynamic Random Access Memory (SLDRAM), direct Memory (DRmb Access), and Random Access Memory (DRAM). The memory 902 described in embodiments herein is intended to comprise, without being limited to, these and any other suitable types of memory.
The method disclosed in the embodiments 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 having signal processing capabilities. In implementation, the steps of the above method may be implemented by integrated logic circuits of hardware or instructions in the form of software in the processor 901. The processor 901 described above may be a general purpose processor, a 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 the embodiments of the present application. A general purpose processor may be a microprocessor or any conventional processor or the like. The steps of the method disclosed in the embodiments of the present application may be directly implemented by a hardware decoding processor, or implemented by a combination of hardware and software modules in the decoding processor. The software modules may be located in a storage medium located in the memory 902, and the processor 901 reads the information in the memory 902 and performs the steps of the aforementioned methods in combination with its hardware.
In an exemplary embodiment, the electronic Device may be implemented by one or more Application Specific Integrated Circuits (ASICs), DSPs, programmable Logic Devices (PLDs), complex Programmable Logic Devices (CPLDs), FPGAs, general purpose processors, controllers, MCUs, microprocessors (microprocessors), or other electronic components for performing the aforementioned call recording method.
An embodiment of the present application further provides a computer-readable storage medium, on which a computer program is stored, where the computer program is configured to, when executed by a processor, perform at least the steps of the method shown in fig. 3. The computer readable storage medium may be specifically a memory. The memory may be memory 902 as shown in fig. 9.
The technical solutions described in the embodiments of the present application can be arbitrarily combined without conflict.
In the several embodiments provided in the present application, it should be understood that the disclosed method and intelligent device may be implemented in other ways. The above-described device embodiments are merely illustrative, for example, the division of the unit is only a logical functional division, and there may be other division ways in actual implementation, such as: multiple units or components may be combined, or may be integrated into another system, or some features may be omitted, or not implemented. In addition, the coupling, direct coupling or communication connection between the components shown or discussed may be through some interfaces, and the indirect coupling or communication connection between the devices or units may be electrical, mechanical or in other forms.
The units described as separate parts may or may not be physically separate, and parts displayed as units may or may not be physical units, may be located in one place, or may be distributed on multiple network units; some or all of the units can be selected according to actual needs to achieve the purpose of the solution of the embodiment.
In addition, all functional units in the embodiments of the present application may be integrated into one second processing unit, or each unit may be separately regarded as one unit, or two or more units may be integrated into one unit; the integrated unit may be implemented in the form of hardware, or in the form of hardware plus a software functional unit.
The above description is only for the specific embodiments of the present application, but the scope of the present application is not limited thereto, and any person skilled in the art can easily conceive of the changes or substitutions within the technical scope of the present application, and shall be covered by the scope of the present application.

Claims (12)

1. A method for 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;
and under the condition that the attribute value of the object to be newly added is the same as the attribute value of the existing object, determining whether to combine the object to be newly added and the existing object based on the relationship between the numerical value information of the object to be newly added and the numerical value information of the existing object.
2. The method according to claim 1, wherein the determining whether to merge the object to be newly added with the existing object based on the relationship between the numerical information of the object to be newly added and the numerical information of the existing object includes:
determining whether the numerical information of the number to be newly added is adjacent to the numerical information of the existing number or not under the condition that the object to be newly added is the number to be newly added and the existing object is the existing number;
under the condition that the numerical value information of the number to be newly added is adjacent to the numerical value information of the existing number, generating a target number segment based on the numerical value information of the number to be newly added and the numerical value information of the existing number;
and under the condition that the numerical information of the number to be newly added is not adjacent to the numerical information of the existing number, not combining the number to be newly added and the existing number.
3. The method according to claim 1, wherein the determining whether to merge the object to be newly added with the existing object based on the relationship between the numerical information of the object to be newly added and the numerical information of the existing object includes:
determining the relationship between the numerical value information of the number to be newly added and the initial numerical value information and the ending numerical value information of the existing number segment under the condition that the object to be newly added is the number to be newly added and the existing object is the existing number segment;
combining the number to be newly added with the existing number segment and updating the initial numerical value information of the existing number segment to be the initial numerical value information of the newly added number under the condition that the numerical value information of the number to be newly added is adjacent to the initial numerical value information and the numerical value information of the number to be newly added is smaller than the initial numerical value information;
combining the number to be newly added with the existing number segment and updating the ending value information of the existing number segment to be the ending value information of the newly added number under the condition that the number value information of the number to be newly added is adjacent to the ending value information and the number value information of the number to be newly added is greater than the initial value information;
and when the numerical value information of the number to be newly added is positioned between the initial numerical value information and the ending numerical value information, keeping the initial numerical value information and the ending numerical value information of the existing number unchanged, and combining the number to be newly added to the existing number section.
4. The method according to claim 1, wherein the determining whether to merge the object to be newly added with the existing object based on the relationship between the numerical information of the object to be newly added and the numerical information of the existing object includes:
determining the relationship between the numerical value information of the existing number and the initial numerical value information and the ending numerical value information of the number segment to be newly added under the condition that the object to be newly added is the number segment to be newly added and the existing object is the existing number;
combining the existing number and the segment to be newly added under the condition that the numerical value information of the existing number is adjacent to the initial numerical value information of the segment to be newly added and the numerical value information of the existing number is smaller than the initial numerical value information of the segment to be newly added, and updating the initial numerical value information of the segment to be newly added into the numerical value information of the existing number;
combining the existing number and the number segment to be newly added under the condition that the numerical value information of the existing number is adjacent to the end numerical value information of the number segment to be newly added and the numerical value information of the existing number is greater than the end numerical value information of the number segment to be newly added, and updating the end numerical value information of the number segment to be newly added into the numerical value information of the existing number;
and when the numerical value information of the existing number is positioned between the initial numerical value information and the ending numerical value information of the number segment to be newly added, keeping the initial numerical value information and the ending numerical value information of the number segment to be newly added unchanged, and merging the existing number into the number segment to be newly added.
5. The method according to claim 1, wherein the determining whether to merge the object to be newly added with the existing object based on the relationship between the numerical information of the object to be newly added and the numerical information of the existing object includes:
determining the relationship between the initial numerical value information and the ending numerical value information of the number segment to be added and the initial numerical value information and the ending numerical value information of the existing number segment under the condition that the object to be added is the number segment to be added and the existing object is the existing number segment;
under the condition that the ending numerical value information of the number segment to be newly added is smaller than the initial numerical value information of the existing number segment, and the ending numerical value information of the number segment to be newly added is not adjacent to the initial numerical value information of the existing number segment, the number segment to be newly added and the existing number segment are not combined;
under the condition that the ending numerical value information of the number segment to be newly added is larger than the initial numerical value information of the existing number segment and the ending numerical value information of the number segment to be newly added is smaller than the ending numerical value information of the existing number segment, continuously comparing the initial numerical value information of the number segment to be newly added with the initial numerical value information of the existing number segment, and under the condition that the initial numerical value information of the number segment to be newly added is smaller than or larger than the initial numerical value information of the existing number segment, combining the number segment to be newly added with the existing number segment;
combining the number segment to be newly added with the existing number segment under the condition that the ending value information of the number segment to be newly added is greater than the ending value information of the existing number segment and the starting value information of the number segment to be newly added is less than the starting value information of the existing number segment;
combining the number segment to be newly added with the existing number segment under the condition that the ending numerical value information of the number segment to be newly added is larger than the ending numerical value information of the existing number segment, and the starting numerical value information of the number segment to be newly added is positioned between the starting numerical value information and the ending numerical value information of the existing number segment;
and under the condition that the initial numerical value information of the number segment to be newly added is greater than the end numerical value information of the existing number segment, not combining the number segment to be newly added and the existing number segment.
6. The method according to any one of claims 1 to 5, further comprising: 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 initial numerical information of the number segment positioned at the right child node is greater than the end numerical information of the number segment positioned at the father node, and the initial numerical information of the number segment of the right child node is not adjacent to the end 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 value information of the number segment of the node on the left side of the node is smaller than the starting numerical value information of the number segment of the node, and the numerical value information of the number segment of the node on the right side of the node is larger than the ending numerical value information of the number segment of the node.
7. The method according to claim 6, wherein the new number segment is generated after the object to be newly added and the existing object are merged, and the new number segment includes a new number segment and/or a number segment obtained after the existing number segment is updated, and the method further includes:
storing the new number segment according to a storage rule of a balanced binary tree structure, wherein the mode for storing the new number segment comprises the following steps: and combining the newly added number segment with one of the at least one existing number segment stored in a balanced binary tree structure.
8. The method of claim 7, wherein storing the newly numbered segment in a balanced binary tree structure comprises:
comparing the initial numerical value information and the end numerical value information of the newly added number segment with the initial numerical value information and the end numerical value information of the first number segment in at least one existing number segment stored in a balanced binary tree structure; the first number segment is a number segment positioned at the top of the balanced binary tree structure;
determining the second number segment as a new first number segment under the condition that the ending numerical value information of the newly added number segment is smaller than the starting numerical value information of the first number segment; further comparing the initial numerical value information and the end numerical value information of the newly added number segment with the end numerical 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 numerical value information and the end numerical value information of the newly added number segment are adjacent to the number of the final end numerical value information of the first number segment, and if so, merging the newly added number segment and the final first number segment; and the second number section is the number section of the left subtree positioned in the first number section.
9. The method of claim 6, further comprising:
inquiring an object to be inquired by using a storage rule of a balanced binary tree structure, and determining a number segment to which the object to be inquired belongs; the object to be inquired is a number to be inquired and/or a number segment to be inquired;
and determining the attribute value of the object to be queried based on the number segment to which the object to be queried belongs.
10. A number processing apparatus, characterized in that the apparatus comprises:
the first determining unit is used for 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 a second determining unit, configured to determine whether to merge the object to be newly added with the existing object based on a relationship between the numerical information of the object to be newly added and the numerical information of the existing object when the attribute value of the object to be newly added is the same as the attribute value of the existing object.
11. An electronic device, characterized in that the electronic device comprises: a memory having computer-executable instructions stored thereon and a processor operable to implement the method of any one of claims 1 to 9 when executing the computer-executable instructions on the memory.
12. A computer storage medium having stored thereon executable instructions which, when executed by a processor, implement the method of any one of claims 1 to 9.
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 true CN115883508A (en) 2023-03-31
CN115883508B 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 (11)

* 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
US20100131584A1 (en) * 2000-06-07 2010-05-27 Johnson William J Mobile data processing system moving interest radius
CN101751475A (en) * 2010-01-08 2010-06-23 联动优势科技有限公司 Method for compressing section records and device therefor
US20110267651A1 (en) * 2010-04-30 2011-11-03 Canon Kabushiki Kaisha Information processing apparatus, information processing method and storage medium
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

Patent Citations (11)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20100131584A1 (en) * 2000-06-07 2010-05-27 Johnson William J Mobile data processing system moving interest radius
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
US20110267651A1 (en) * 2010-04-30 2011-11-03 Canon Kabushiki Kaisha Information processing apparatus, information processing method and storage medium
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
KAMALAKANTA SETHI: ""A Scalable Attribute Based Encryption for Secure Data Storage and Access in Cloud"", 《2019 INTERNATIONAL CONFERENCE ON CYBER SECURITY AND PROTECTION OF DIGITAL SERVICES (CYBER SECURITY)》, 31 October 2019 (2019-10-31) *
常青青: ""高效的手机号码及短信保密系统研究"", 《中国优秀硕士学位论文全文数据库 信息科技辑》, 15 July 2021 (2021-07-15) *
方贵明;吴志美;赵蔚;: "人名直接映射电话号码的研究", 通信学报, no. 07, 15 July 2008 (2008-07-15) *

Also Published As

Publication number Publication date
CN115883508B (en) 2024-06-07

Similar Documents

Publication Publication Date Title
CN105718455B (en) A kind of data query method and device
KR102172903B1 (en) Database management system based on blockchain technology
CN111324665B (en) Log playback method and device
CN113064859B (en) Metadata processing method and device, electronic equipment and storage medium
CN115952195A (en) Block chain data tracing query optimization method
CN109302449B (en) Data writing method, data reading device and server
CN111382179B (en) Data processing method and device and electronic equipment
CN111198961A (en) Commodity searching method and device and server
CN115883508B (en) Number processing method and device, electronic equipment and storage medium
CN113821630A (en) Data clustering method and device
CN113411364B (en) Resource acquisition method and device and server
CN114564501A (en) Database data storage and query methods, devices, equipment and medium
CN109977097B (en) Network configuration management method and system based on database
CN112487111A (en) Data table association method and device based on KV database
CN110427391B (en) Method, apparatus and computer program product for determining duplicate data
CN115586871B (en) Cloud computing scene-oriented data additional writing method, device, equipment and medium
CN111290803B (en) Data preloading method, device, equipment and storage medium
US11822803B2 (en) Method, electronic device and computer program product for managing data blocks
CN117729176B (en) Method and device for aggregating application program interfaces based on network address and response body
US20240152520A1 (en) Data query and data storage methods and apparatuses for relation network
CN113326389A (en) Image index processing method, image index processing device, image index processing apparatus, storage medium, and program
CN117891880A (en) Mass data storage method, system, equipment and medium based on multidimensional retrieval
CN114691681A (en) Data processing method and device, electronic equipment and readable storage medium
CN114385580A (en) Data processing method and device, electronic equipment and computer readable storage medium
CN114691694A (en) Tree data storage and processing method and system

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