Method and apparatus for outputting information

By introducing the sorting sequence number adjustment method based on bit operations and the initial sequence number generation method of time self-growth in the natural number sorting method, the problem of resource waste and space exhaustion when adjusting the order is solved, and efficient and real-time sorting sequence number adjustment is achieved.

CN115080813BActive Publication Date: 2025-06-13JINGDONG TECH HLDG CO LTD
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202110258176.7
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2021-03-10
Publication Date
2025-06-13
Estimated Expiration
2041-03-10

AI Technical Summary

Technical Problem

When adjusting the order, the natural number sorting method will lead to waste of computer and database IO resources, increase the time spent on business execution, and may even cause database update timeout or task backlog.

Method used

The sorting number adjustment method based on bit operations and the initial sequence number generation method of time self-growth is used to adjust the sorting value of the target element by creating the starting sort value and converting it into an initial sort value including time and equal sort bits, and the sorting value of the target element is adjusted using the XOR operation and the search for carry bits.

Benefits of technology

It greatly reduces the waste of computer IO resources, optimizes the adjustment time of sorting sequence numbers, improves the efficiency of sorting sequence numbers space utilization, increases the adjustable range, and avoids the problem of rapid space exhaustion.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN115080813B_ABST
    Figure CN115080813B_ABST
Patent Text Reader

Abstract

Embodiments of the present disclosure disclose a method and an apparatus for outputting information. A specific implementation of the method includes: a creation unit creates a starting sorting value for a target element according to the current time; a conversion unit converts the starting sorting value into an initial sorting value; an acquisition unit acquires the sorting values of two elements before and after the target position; a first exclusive OR unit performs an exclusive OR on the time bits of the larger value and the smaller value among the sorting values of the two elements to obtain a time bit exclusive OR result; a first search unit, if it determines that the time bit exclusive OR result is greater than 1, searches for the highest exclusive OR bit of the time bits from the time bit exclusive OR result, and then searches for the highest carry bit of the time bits according to the highest exclusive OR bit of the time bits; an output unit, if it determines that there is a highest carry bit of the time bits, adds 1 to the highest carry bit of the time bits of the smaller value among the sorting values of the two elements, and outputs it as the new sorting value of the target element. This implementation can save time and space in the process of adjusting the order.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] Embodiments of the present disclosure relate to the field of computer technology, and particularly to methods and apparatuses for outputting information. Background Art

[0002] In the information systems of enterprises, there are often the following scenarios: for multiple items that need to be displayed sequentially, natural numbers starting from 1 are usually used for numbering and sorting, and the sorting is displayed in this order (hereinafter referred to as the natural number numbering method). For example, on an online shopping page, a sorting field is required to confirm the display order between various products. At this time, relevant sorting fields will also be stored in the corresponding database. When adjusting the order, it is necessary to update all the elements between the positions before and after the item to be adjusted. For example, when adjusting the item ranked ninth to the second, it is necessary to modify the items with the original serial numbers from two to eight in the database. Considering that the relative positions of the items with the original serial numbers from two to eight have not changed, such a method is extremely wasteful of computer and database IO resources, greatly increasing the time consumption of business execution. In extreme cases, it may cause database update timeouts or task backlogs. Even if an improved algorithm using natural numbers at a certain interval instead of consecutive natural numbers is used, it will still easily lead to the exhaustion of the reserved space, resulting in the same sorting bit serial numbers for a large number of elements and making the sorting ineffective. Summary of the Invention

[0003] Embodiments of the present disclosure provide methods and apparatuses for outputting information.

[0004] In a first aspect, an embodiment of the present disclosure provides a method for outputting information, including: a creation unit creates a starting sorting value for a target element according to the current time in response to a request for inserting the target element into a target position in a sorting queue; a conversion unit converts the starting sorting value into an initial sorting value, where the initial sorting value includes a time bit and an equal-value sorting bit; an acquisition unit acquires the sorting values of two elements before and after the target position; a first exclusive OR unit performs an exclusive OR operation on the time bits of the larger value and the smaller value among the sorting values of the two elements to obtain a time bit exclusive OR result; a first search unit, if it determines that the time bit exclusive OR result is greater than 1, searches for the highest exclusive OR bit of the time bit from the time bit exclusive OR result, and then searches for the highest carry bit of the time bit according to the highest exclusive OR bit of the time bit; an output unit, if it determines that there is a highest carry bit of the time bit, adds 1 to the highest carry bit of the time bit of the smaller value among the sorting values of the two elements and outputs it as the new sorting value of the target element.

[0005] In some embodiments, the method further includes: if the second exclusive OR unit determines that there is no carry highest bit of the time bit, it exclusive ORs the equal-value sorting bits of the larger value and the smaller value in the sorting values of the two elements to obtain an exclusive OR result of the equal-value sorting bits; the second exclusive OR unit finds the highest exclusive OR bit of the equal-value sorting bits from the exclusive OR result of the equal-value sorting bits, and then finds the carry highest bit of the equal-value sorting bits according to the highest exclusive OR bit of the equal-value sorting bits; if the second search unit determines that there is a carry highest bit of the equal-value sorting bits, it adds 1 to the carry highest bit of the equal-value sorting bits of the smaller value in the sorting values of the two elements and outputs it as the new sorting value of the target element.

[0006] In some embodiments, the method further includes: if the second exclusive OR unit determines that the exclusive OR result of the time bits is equal to 0, it exclusive ORs the equal-value sorting bits of the larger value and the smaller value in the sorting values of the two elements to obtain an exclusive OR result of the equal-value sorting bits; the second exclusive OR unit finds the highest exclusive OR bit of the equal-value sorting bits from the exclusive OR result of the equal-value sorting bits, and then finds the carry highest bit of the equal-value sorting bits according to the highest exclusive OR bit of the equal-value sorting bits; if the second search unit determines that there is a carry highest bit of the equal-value sorting bits, it adds 1 to the carry highest bit of the equal-value sorting bits of the smaller value in the sorting values of the two elements and outputs it as the new sorting value of the target element.

[0007] In some embodiments, the method further includes: if the second search unit determines that there is no carry highest bit of the equal-value sorting bits, it takes the target position as the center, and respectively searches for the equal-value sorting bits of a predetermined number of elements forward and backward, and recalculates the equal-value sorting bits of the target element and the equal-value sorting bits of the predetermined number of elements before and after in a manner of decreasing at equal bit intervals in binary, and assigns values to the equal-value sorting bits of some of the predetermined number of elements before and after.

[0008] In some embodiments, the method further includes: if the output unit determines that the exclusive OR result of the time bits is equal to 1, it subtracts 1 from a predetermined position in the equal-value sorting bits of the larger value in the sorting values of the two elements and outputs it as the sorting value of the target element.

[0009] In some embodiments, the finding the highest exclusive OR bit of the time bits from the exclusive OR result of the time bits, and then finding the carry highest bit of the time bits according to the highest exclusive OR bit of the time bits includes: finding the bit with the highest bit of the binary number in the exclusive OR result of the time bits as the highest exclusive OR bit of the time bits; starting from the highest exclusive OR bit of the time bits, searching for the first bit to the right in the exclusive OR result of the time bits where the larger value is not 0 and the smaller value is not 1.

[0010] In some embodiments, finding the highest XOR bit of the equivalent sorting bits from the XOR result of the equivalent sorting bits, and then finding the highest carry bit of the equivalent sorting bits according to the highest XOR bit of the equivalent sorting bits includes: finding the bit with the highest bit of the binary number being 1 in the XOR result of the equivalent sorting bits as the highest XOR bit of the equivalent sorting bits; starting from the highest XOR bit of the equivalent sorting bits, looking for the first bit to the right in the XOR result of the equivalent sorting bits where the larger value is not 0 and the smaller value is not 1.

[0011] In a second aspect, an embodiment of the present disclosure provides a device for outputting information, including: a creation unit configured to create a starting sorting value for a target element according to the current time in response to a request for detecting the insertion of the target element into a target position in a sorting queue; a conversion unit configured to convert the starting sorting value into an initial sorting value, where the initial sorting value includes a time bit and an equivalent sorting bit; an acquisition unit configured to acquire the sorting values of two elements before and after the target position; a first XOR unit configured to XOR the time bits of the larger value and the smaller value in the sorting values of the two elements to obtain a time bit XOR result; a first search unit configured to, if it is determined that the time bit XOR result is greater than 1, find the highest XOR bit of the time bits from the time bit XOR result, and then find the highest carry bit of the time bits according to the highest XOR bit of the time bits; an output unit configured to, if it is determined that there is a highest carry bit of the time bits, add 1 to the highest carry bit of the time bit of the smaller value in the sorting values of the two elements and output it as the new sorting value of the target element.

[0012] In some embodiments, the device further includes: a second XOR unit configured to, if it is determined that there is no highest carry bit of the time bits, XOR the equivalent sorting bits of the larger value and the smaller value in the sorting values of the two elements to obtain an equivalent sorting bit XOR result; a second search unit configured to find the highest XOR bit of the equivalent sorting bits from the equivalent sorting bit XOR result, and then find the highest carry bit of the equivalent sorting bits according to the highest XOR bit of the equivalent sorting bits; an output unit configured to, if it is determined that there is a highest carry bit of the equivalent sorting bits, add 1 to the highest carry bit of the equivalent sorting bit of the smaller value in the sorting values of the two elements and output it as the new sorting value of the target element.

[0013] In some embodiments, the device further includes: a second exclusive-OR unit configured to exclusive-OR the equal-rank bits of the larger value and the smaller value in the sorting values of the two elements to obtain an exclusive-OR result of the equal-rank bits if it is determined that the exclusive-OR result of the time bits is equal to 0; a second lookup unit configured to find the highest exclusive-OR bit of the equal-rank bits from the exclusive-OR result of the equal-rank bits, and then find the highest carry bit of the equal-rank bits according to the highest exclusive-OR bit of the equal-rank bits; an output unit configured to, if it is determined that there is a highest carry bit of the equal-rank bits, output the new sorting value of the target element by adding 1 to the highest carry bit of the equal-rank bits of the smaller value in the sorting values of the two elements.

[0014] In some embodiments, the output unit is further configured to, if it is determined that there is no highest carry bit of the equal-rank bits, find the equal-rank bits of a predetermined number of elements respectively forward and backward centered on the target position, recalculate the equal-rank bits of the target element and the predetermined number of elements before and after in a manner of decreasing at equal binary intervals, and assign values to the equal-rank bits of some of the predetermined number of elements before and after.

[0015] In some embodiments, the output unit is further configured to, if it is determined that the exclusive-OR result of the time bits is equal to 1, subtract 1 from a predetermined position in the equal-rank bits of the larger value in the sorting values of the two elements and output it as the sorting value of the target element.

[0016] In some embodiments, the first lookup unit is configured to: find the bit with the highest bit of 1 in the binary number of the exclusive-OR result of the time bits as the highest exclusive-OR bit of the time bits; start from the highest exclusive-OR bit of the time bits and look for the first bit to the right in the exclusive-OR result of the time bits where the larger value is not 0 and the smaller value is not 1.

[0017] In some embodiments, the second lookup unit is configured to: find the bit with the highest bit of 1 in the binary number of the exclusive-OR result of the equal-rank bits as the highest exclusive-OR bit of the equal-rank bits; start from the highest exclusive-OR bit of the equal-rank bits and look for the first bit to the right in the exclusive-OR result of the equal-rank bits where the larger value is not 0 and the smaller value is not 1.

[0018] In a third aspect, an embodiment of the present disclosure provides an electronic device for outputting information, including: one or more processors; a storage device storing one or more programs thereon, and when the one or more programs are executed by the one or more processors, the one or more processors implement the method according to any one of the first aspect.

[0019] In a fourth aspect, an embodiment of the present disclosure provides a computer-readable medium storing a computer program thereon, wherein when the program is executed by a processor, the method according to any one of the first aspect is implemented.

[0020] The method and apparatus for outputting information provided by the embodiments of the present disclosure propose a sorting sequence adjustment method based on bit operations for the redundant modification problem that may be caused by the natural number sorting method, so that only the own sequence number needs to be modified when adjusting the order, greatly reducing the waste of computer IO resources. For the problem that the sorting number space of the improved algorithm of the natural number sorting method is prone to exhaustion, a method for generating an initial sequence number based on time self-increment is designed. Combining the above-mentioned sequence number adjustment method based on bit operations, the utilization efficiency of the sorting sequence number space is improved, the adjustable range is increased, and the problem that the space is quickly exhausted with the order adjustment in engineering can be solved. This application greatly optimizes the time required for adjusting the sequence number. Since modifying the order only needs to be calculated according to the previous and subsequent sequence numbers, the complexity of sorting is only O(1); and the calculation of the sequence number is based on bit operations, and the calculation process of a single sequence number only takes milliseconds. These two points ensure the real-time and fast response of the system. BRIEF DESCRIPTION OF THE DRAWINGS

[0021] Other features, objects, and advantages of the present disclosure will become more apparent by reading the detailed description of the non-limiting embodiments with reference to the following drawings:

[0022] Figure 1 is an exemplary system architecture diagram to which an embodiment of the present disclosure can be applied;

[0023] Figure 2 is a flowchart of an embodiment of the method for outputting information according to the present disclosure;

[0024] Figure 3a 、 3b is a schematic diagram of the sorting value of the elements of the method for outputting information according to the present disclosure;

[0025] Figure 4 is a flowchart of another embodiment of the method for outputting information according to the present disclosure;

[0026] Figure 5 is a flowchart of another embodiment of the method for outputting information according to the present disclosure;

[0027] Figure 6 is a schematic diagram of the application scenario of the method for outputting information according to the present disclosure;

[0028] Figure 7 is a schematic structural diagram of an embodiment of the apparatus for outputting information according to the present disclosure;

[0029] Figure 8 is a schematic structural diagram of a computer system of an electronic device suitable for implementing the embodiments of the present disclosure. DETAILED DESCRIPTION OF THE EMBODIMENTS

[0030] The present disclosure will be further described in detail below with reference to the accompanying drawings and embodiments. It can be understood that the specific embodiments described herein are only used to explain the relevant invention, rather than limiting the invention. Additionally, it should be noted that for ease of description, only the parts related to the relevant invention are shown in the drawings.

[0031] It should be noted that, without conflict, the embodiments in the present disclosure and the features in the embodiments can be combined with each other. The present disclosure will be described in detail below with reference to the drawings and embodiments.

[0032] Figure 1 An exemplary system architecture 100 is shown, which shows embodiments of a method for outputting information or a device for outputting information to which the present disclosure can be applied.

[0033] As Figure 1 shown, the system architecture 100 may include terminal devices 101, 102, 103, a network 104, and a server 105. The network 104 is used to provide a medium for communication links between the terminal devices 101, 102, 103 and the server 105. The network 104 may include various connection types, such as wired, wireless communication links, or fiber optic cables, etc.

[0034] Users can use the terminal devices 101, 102, 103 to interact with the server 105 through the network 104 to receive or send messages, etc. Various communication client applications may be installed on the terminal devices 101, 102, 103, such as web browser applications, shopping applications, search applications, instant messaging tools, email clients, social platform software, etc.

[0035] The terminal devices 101, 102, 103 may be hardware or software. When the terminal devices 101, 102, 103 are hardware, they may be various electronic devices with a display screen and supporting web browsing, including but not limited to smart phones, tablet computers, e - book readers, MP3 players (Moving Picture Experts Group Audio Layer III), MP4 (Moving Picture Experts Group Audio Layer IV) players, laptop computers, and desktop computers, etc. When the terminal devices 101, 102, 103 are software, they may be installed in the above - listed electronic devices. It may be implemented as multiple software or software modules (such as for providing distributed services), or it may be implemented as a single software or software module. No specific limitation is made here.

[0036] Server 105 may be a server that provides various services, such as a background sorting server that provides sorting support for elements displayed on terminal devices 101, 102, and 103. The background sorting server can analyze and process data such as received sorting requests, and feedback the processing results (such as updated sorting values) to the terminal devices.

[0037] It should be noted that the server can be hardware or software. When the server is hardware, it can be implemented as a distributed server cluster composed of multiple servers, or as a single server. When the server is software, it can be implemented as multiple software or software modules (such as multiple software or software modules for providing distributed services), or as a single software or software module. No specific limitation is made here. The server can also be a server of a distributed system, or a server combined with a blockchain. The server can also be a cloud server, or an intelligent cloud computing server or intelligent cloud host with artificial intelligence technology.

[0038] It should be noted that the method for outputting information provided by the embodiments of the present disclosure can be executed by terminal devices 101, 102, and 103, or by server 105. Correspondingly, the device for outputting information can be set in terminal devices 101, 102, and 103, or in server 105. No specific limitation is made here.

[0039] It should be understood that Figure 1 the numbers of the terminal devices, networks, and servers in

[0040] are merely illustrative. According to the implementation requirements, there can be any number of terminal devices, networks, and servers. Figure 2 Continuing to refer to Figure 2 , a flowchart 200 of an embodiment of the method for outputting information according to the present disclosure is shown. The method for outputting information includes the following steps:

[0041] Step 201, in response to a request for inserting a target element into a target position in the sorting queue being detected, the creation unit creates a starting sorting value for the target element according to the current time.

[0042] In this embodiment, the creation unit of the execution subject of the method for outputting information (such as Figure 1 the server shown) can receive a request for inserting a target element into a target position in the sorting queue from the terminal used by the user for sorting through a wired connection method or a wireless connection method. Among them, the sorting queue is arranged in the order of decreasing or increasing sorting values. The creation unit can create a starting sorting value for the target element according to the current time.

[0043] Use the time difference between the current time and a specific time (hereinafter referred to as the starting time) as the starting sorting value for the newly stored data. The time difference is in milliseconds, and the starting time needs to be before the current time. For example, if the starting time is set to 000 milliseconds at 0:00:00 on January 1, 1970, then 22:07:14, 341 milliseconds on September 1, 2020 is represented as the starting sorting value of 1598969234341 (as Figure 3a shown). Whenever a new element is added, the starting sorting value is generated in this way. The binary digits are a total of 64 bits, and the first bit is the sign bit. Then this starting sorting value naturally increases with time and can effectively overcome the exhaustion problem.

[0044] Step 202, the conversion unit converts the starting sorting value into an initial sorting value.

[0045] In this embodiment, through observation, it can be found that in the binary number of the starting sorting value (10111010001001001111111100100001110100101, a total of 41 bits, the first 22 bits with 0 before the number are omitted here), the front part of the numbers will not be modified within the next 100 years, that is, 100 * 365 * 24 * 60 * 60 * 100 milliseconds (binary representation: 101101111001000001001101010011000000000000, a total of 42 bits). The number of non-changing digits in this part is 21 bits. At this time, we can first perform a left shift operation on the starting sorting value by 21 bits to omit them, and the sign bit remains unchanged. At this time, the lower 21 bits are filled by copying the lower 21 bits of the binary representation of the starting sorting value. Then the newly generated 64-bit number is the initial sorting value. The high 1 bit of this sorting value is the sign bit and is reserved without use; the next 42 bits are the time bits; the last 21 bits are the equivalent sorting bits. Take this value as the initial sorting value and store it in the database.

[0046] Therefore, the initial sorting value includes time bits and equivalent sorting bits.

[0047] Step 203, the acquisition unit acquires the sorting values of the two elements before and after the target position.

[0048] In this embodiment, when the target element is to be inserted into the target position, first acquire the sorting values of the two elements before and after its insertion position. The sorting values include time bits and equivalent sorting bits. As Figure 3b shown, the first row is the time bits of the larger value among the sorting values of the two elements, and the second row is the time bits of the smaller value among the sorting values of the two elements.

[0049] Step 204, the first exclusive OR unit performs an exclusive OR on the time bits of the larger value and the smaller value among the sorting values of the two elements to obtain the time bit exclusive OR result.

[0050] In this embodiment, since the sorting value is divided into three parts, first take the first 43 bits of the front and rear two elements, and perform bitwise exclusive OR on them. Obtain the exclusive OR result. When the result is greater than 1, find the bit with the highest 1 in its binary number. Then this bit is the first different bit in the time part of the front and rear two elements. Then start from this bit and look for the first bit to the right in the exclusive OR result where the first larger of the two elements is not 0 and the smaller one is not 1. Figure 3b The third line in it represents the exclusive OR result of the time bits of the larger value and the smaller value in the sorting values of the two elements. This figure is applicable to both the exclusive OR of the time bits in the sorting value and the exclusive OR of the equal-value sorting bits in the sorting value.

[0051] Step 205: If the first search unit determines that the exclusive OR result of the time bits is greater than 1, then find the highest exclusive OR bit of the time bits from the exclusive OR result of the time bits, and then find the highest carry bit of the time bits according to the highest exclusive OR bit of the time bits.

[0052] In this embodiment, if the exclusive OR result of the time bits is greater than 1, it means that the serial number can be inserted according to the time bits. As Figure 3b shown, the bit circled by the solid line box is the highest bit with 1 in the exclusive OR value (hereinafter referred to as the highest exclusive OR bit), and the bit circled by the dotted line box is the first bit that the two elements find from the highest exclusive OR bit to the lower bits where the larger value is not 0 and the smaller value is 1 (11 in the figure, rather than 01) (hereinafter referred to as the highest carry bit).

[0053] Step 206: If the output unit determines that there is a highest carry bit of the time bits, then add 1 to the highest carry bit of the time bits of the smaller value in the sorting values of the two elements, and output it as the new sorting value of the target element.

[0054] In this embodiment, if there is a highest carry bit of the time bits, the sorting value of the target element that needs to adjust its position can be obtained as follows: Add 1 to the number where the smaller value is located at the highest carry bit ( Figure 3b the bit where the number circled by the dotted line box in it is located, and the obtained sorting value is 0101100001001,), then the number obtained at this time must be between the larger value and the smaller value, and relative to the two, at least only 1 bit is inconsistent.

[0055] The key technical points of the method provided by the above embodiments of the present disclosure are the generation method of the sorting value and the regeneration rule of the value when adjusting elements. The sorting value is generated based on the time stamp, and the redundant bits that will not be used for a long time period are fully utilized to form sufficient buffer space when the time period is insufficient. At the same time, the initial sorting value has an auto-increment feature, so that the range of the value increases with time, further reducing the risk of exhaustion of the adjustment space. The sorting value generation rule when adjusting the element position is based on bitwise operations, and within the smallest possible range, the sorting value between two elements is found. In a way that only adjusts the sorting value of this element and hardly affects the sorting values of other elements, the sorting order is changed.

[0056] In some alternative implementation manners of this embodiment, if the second exclusive OR unit determines that there is no carry highest bit of the time bits, it performs an exclusive OR on the equal-value sorting bits of the larger value and the smaller value in the sorting values of the two elements to obtain an exclusive OR result of the equal-value sorting bits; the second search unit searches for the highest exclusive OR bit of the equal-value sorting bits from the exclusive OR result of the equal-value sorting bits, and then searches for the carry highest bit of the equal-value sorting bits according to the highest exclusive OR bit of the equal-value sorting bits; if the output unit determines that there is a carry highest bit of the equal-value sorting bits, it adds 1 to the carry highest bit of the equal-value sorting bits of the smaller value in the sorting values of the two elements and outputs it as the new sorting value of the target element.

[0057] If it is determined that there is no carry highest bit of the time bits, the operation of performing an exclusive OR on the equal-value sorting bits of the sorting values of the two elements and searching for the carry highest bit can be re-assigned. With the expansion of the equal-value sorting bits, under the same time series, there are still up to 2^21–1 = 2,097,151 numbers that can be arranged, which can fully cover the general usage scenarios of sorting adjustment. It is convenient and fast, further reducing the risk of exhaustion of the adjustment space and having little impact on the sorting values of other elements.

[0058] In some alternative implementation manners of this embodiment, if the output unit determines that there is no carry highest bit of the equal-value sorting bits, it respectively searches forward and backward for the equal-value sorting bits of a predetermined number of elements centered on the target position, and recalculates the equal-value sorting bits of the target element and the predetermined number of elements before and after in a way that the binary decreases at an equal bit interval, and assigns values to the equal-value sorting bits of some of the predetermined number of elements before and after.

[0059] When the time bits and the equivalent sorting bits of the two elements before and after are equal, it is impossible to interpolate between the sorting values of the two elements, and the hash value needs to be recalculated. Not only the sorting value of the target element needs to be calculated, but also the sorting values of the two elements before and after need to be adjusted. At this time, taking the newly inserted target position as the center, search for the sorting bit values of N elements (N>1) forward and backward respectively. In a way that the binary decreases at an equal interval, recalculate the sorting values of the target element and the N values before and after, and perform partial assignment. For example, the sorting value of the first element is 0101010001001, and the sorting value of the last element is 0101101001001. The exclusive OR value is 111000000, with a total of 9 bits. Take N = 2, and take 2 elements before and after the target position. The target element is the third element. Then the sorting value of the fourth element is 0101101001001 – 10000000 = 101011001001, the sorting value of the target element is 0101101001001 – 10010000 = 101010111001, and the sorting value of the second element is 0101101001001 – 10010010 = 101010110111. At this time, the three newly generated sorting values are still between the sorting value of the first element and the sorting value of the fifth element, and the relative order is maintained. Only three values need to be modified, and the ability to continuously adjust the order is restored. Among them, 10000000, 10010000, and 10010010 are in a way that the binary decreases at an equal interval (in this example, the exclusive OR value has a total of 9 bits, and the sorting values of 3 elements need to be modified, so the step size of each movement is set to 3 bits). Optionally, the sorting value of the last element can be subtracted by 100000000, 100100000, and 100100100 respectively to obtain the sorting value of the fourth element, the sorting value of the third element (target element), and the sorting value of the second element.

[0060] Continue to refer to Figure 4 and shows a flow 400 of an embodiment of a method for outputting information according to the present disclosure. The method for outputting information includes the following steps:

[0061] Step 401, in response to detecting a request to insert a target element into a target position in the sorting queue, the creation unit creates a starting sorting value for the target element according to the current time.

[0062] Step 402, the conversion unit converts the starting sorting value into an initial sorting value.

[0063] Step 403, the acquisition unit acquires the sorting values of two elements before and after the target position.

[0064] Step 404, the first exclusive OR unit performs an exclusive OR on the time bits of the larger value and the smaller value among the sorting values of the two elements to obtain a time bit exclusive OR result.

[0065] Steps 401 - 404 are basically the same as steps 201 - 204, so they will not be elaborated here.

[0066] Step 405: If the second exclusive - OR unit determines that the time - bit exclusive - OR result is equal to 0, it will exclusive - OR the equal - value sorting bits of the larger value and the smaller value in the sorting values of the two elements to obtain the equal - value sorting - bit exclusive - OR result.

[0067] In this embodiment, if the time - bit exclusive - OR result is equal to 0, it indicates that the time bits of the two elements are the same. However, since the initial values of the equal - value sorting bits of the two elements are established according to the creation time, the equal - value sorting bits may be different. Operations similar to those when the time bits are the same can be performed on the equal - value sorting bits to obtain the equal - value sorting - bit exclusive - OR result. For example, Figure 3b As shown, the first row represents the equal - value sorting bits of the larger value, the second row represents the equal - value sorting bits of the smaller value, and the third row represents the equal - value sorting - bit exclusive - OR result.

[0068] Step 406: The second search unit searches for the highest - order exclusive - OR bit of the equal - value sorting bits from the equal - value sorting - bit exclusive - OR result, and then searches for the highest - order carry bit of the equal - value sorting bits according to the highest - order exclusive - OR bit of the equal - value sorting bits.

[0069] In this embodiment, this step is basically the same as step 205. The difference is only the search area. In step 205, the highest - order carry bit of the time bits is searched in the time bits, while in this step, the highest - order carry bit of the equal - value sorting bits is searched in the equal - value sorting bits. The search rules are the same, so they will not be elaborated here.

[0070] Step 407: If the output unit determines that there is a highest - order carry bit of the equal - value sorting bits, it will output the new sorting value of the target element after adding 1 to the highest - order carry bit of the equal - value sorting bits of the smaller value in the sorting values of the two elements.

[0071] In this embodiment, this step is basically the same as step 206. The difference is that in this step, 1 is added to the highest - order carry bit of the equal - value sorting bits, while in step 206, 1 is added to the highest - order carry bit of the time bits.

[0072] When the difference between the first 43 bits of the sorting values of the two elements before and after the target position is 0, take the equal - value sorting bits of the two values, repeat the operations of taking the exclusive - OR and searching for the highest - order carry bit, and then assign the value.

[0073] With the expansion of the equal - value sorting bits, in the same time sequence, there are still at most 2^21–1 = 2097151 numbers that can be arranged, which can fully cover the general usage scenarios of sorting adjustment. It is both convenient and fast, further reducing the risk of exhausting the adjustment space and having little impact on the sorting values of other elements.

[0074] In some alternative implementation manners of this embodiment, if the output unit determines that there is no carry highest bit of the equal-value sorting bits, it searches for the equal-value sorting bits of a predetermined number of elements forward and backward respectively with the target position as the center, recalculates the equal-value sorting bits of the target element and the predetermined number of elements before and after in the manner of decreasing at an equal bit interval in binary, and assigns values to the equal-value sorting bits of some elements among the predetermined number of elements before and after.

[0075] When the time bits and equal-value sorting bits of two adjacent elements are equal, it is impossible to interpolate between the sorting values of the two elements, and a rehash value is required. Not only does it need to calculate the sorting value for the target element, but also the sorting values of the two adjacent elements need to be adjusted. At this time, with the newly inserted target position as the center, the sorting bit values of N elements (N>1) are searched forward and backward respectively. In the manner of decreasing at an equal bit interval in binary, the sorting values of the target element and the N values before and after are recalculated, and partial assignment is performed. For example, the sorting value of the first element is 0101010001001, and the sorting value of the last element is 0101101001001. The exclusive OR value is 111000000, with a total of 9 bits. Take N = 2, and take 2 elements before and after the target position. The target element is the third element. Then the sorting value of the fourth element is 0101101001001 – 10000000 = 101011001001, the sorting value of the target element is 0101101001001 – 10010000 = 101010111001, and the sorting value of the second element is 0101101001001 – 10010010 = 101010110111. At this time, the three newly generated sorting values are still between the sorting value of the first element and the sorting value of the fifth element, and the relative order is maintained. Only three values need to be modified, and the ability to continuously adjust the order is restored. Among them, 10000000, 10010000, and 10010010 are in the manner of decreasing at an equal bit interval in binary (in this example, the exclusive OR value has a total of 9 bits, and the sorting values of 3 elements need to be modified, so the step size of each movement is set to 3 bits). Optionally, the sorting value of the last element can be subtracted by 100000000, 100100000, and 100100100 respectively to obtain the sorting value of the fourth element, the sorting value of the third element (target element), and the sorting value of the second element.

[0076] Continue to refer to Figure 5 , which shows a flowchart 500 of another embodiment of the method for outputting information according to the present disclosure. The method for outputting information includes the following steps:

[0077] Step 501, in response to detecting a request to insert a target element into a target position in the sorting queue, the creation unit creates a starting sorting value for the target element according to the current time.

[0078] Step 502: The conversion unit converts the starting sorting value into an initial sorting value.

[0079] Step 503: The acquisition unit acquires the sorting values of the two elements before and after the target position.

[0080] Step 504: The first exclusive-OR unit performs an exclusive-OR on the time bits of the larger value and the smaller value among the sorting values of the two elements to obtain a time-bit exclusive-OR result.

[0081] Step 505: If the output unit determines that the time-bit exclusive-OR result is equal to 1, it subtracts 1 from a predetermined position in the equivalent sorting bits of the larger value among the sorting values of the two elements and outputs it as the sorting value of the target element.

[0082] In this embodiment, when the difference between the first 43 bits of the sorting values of the two elements before and after the target position is equal to 1, it means that a new sorting sequence number cannot be directly obtained from the time bits. At this time, the equivalent sorting bits of the larger value can be taken, and 1 is directly subtracted from a predetermined position (for example, the 11th bit) in the equivalent sorting bits. Then the newly obtained number is between the two. Because the newly obtained sorting number is greater than the smaller value in the time bits and less than the maximum value in the equivalent sorting bits. The predetermined position can be set according to the length of the equivalent sorting bits and is in the middle of the equivalent sorting bits. The middle of the 21-bit equivalent sorting bits is the 11th bit.

[0083] Continue to refer to Figure 6 , Figure 6 which is a schematic diagram of an application scenario of the method for outputting information according to this embodiment. In the Figure 6 application scenario, the user wants to insert a target element into the target position of the queue. An initial sorting value is created for the target element according to the current time, and then an initial sorting value is generated based on the initial sorting value. Then, an exclusive-OR is performed on the time bits of the larger value and the smaller value among the sorting values of the two elements before and after the target position (which are also the initial sorting values converted from the starting sorting values created by time, but may have been reordered after creation, and the reordered sorting values are no longer the initial sorting values), to obtain a time-bit exclusive-OR result. Different processing is performed according to the time-bit exclusive-OR result.

[0084] 1. If the time-bit exclusive-OR result is greater than 1, the sorting value of the target element is reassigned by modifying the time bits, that is, steps 205-206 are executed. If there is a highest carry bit in the time bits, add 1 to the highest carry bit of the time bits of the smaller value among the sorting values of the two elements and output it as the new sorting value of the target element. If there is no highest carry bit in the time bits, go to steps 405-407.

[0085] 2. If the XOR result of the time bits is equal to 0, find the highest carry bit of the equivalent sorting bits, and re-assign the sorting value of the target element by modifying the equivalent sorting bits, that is, execute steps 405-407.

[0086] 3. If the XOR result of the time bits is equal to 1, execute step 505.

[0087] Further reference Figure 7 , as an implementation of the methods shown in the above figures, the present disclosure provides an embodiment of a device for outputting information. This device embodiment corresponds to Figure 2 the method embodiment shown, and this device can be specifically applied to various electronic devices.

[0088] As Figure 7 shown, the device 700 for outputting information in this embodiment includes: a creation unit 701, a conversion unit 702, an acquisition unit 703, a first XOR unit 704, a first search unit 705, and an output unit 706. Among them, the creation unit 701 is configured to, in response to a request for detecting the insertion of a target element into a target position in a sorting queue, create a starting sorting value for the target element according to the current time; the conversion unit 702 is configured to convert the starting sorting value into an initial sorting value, where the initial sorting value includes a time bit and an equivalent sorting bit; the acquisition unit 703 is configured to acquire the sorting values of two elements before and after the target position; the first XOR unit 704 is configured to XOR the time bits of the larger value and the smaller value among the sorting values of the two elements to obtain a time bit XOR result; the first search unit 705 is configured to, if it is determined that the time bit XOR result is greater than 1, find the highest XOR bit of the time bits from the time bit XOR result, and then find the highest carry bit of the time bits according to the highest XOR bit of the time bits; the output unit 706 is configured to, if it is determined that there is a highest carry bit of the time bits, add 1 to the highest carry bit of the time bit of the smaller value among the sorting values of the two elements and output it as the new sorting value of the target element.

[0089] In this embodiment, the specific processing of the creation unit 701, the conversion unit 702, the acquisition unit 703, the first XOR unit 704, the first search unit 705, and the output unit 706 of the device 700 for outputting information can refer to Figure 2 steps 201, step 202, step 203, step 204, step 205, and step 206 in the corresponding embodiment.

[0090] In some alternative implementation manners of this embodiment, the apparatus 700 further includes: a second exclusive OR unit (not shown in the drawings), configured to exclusive-OR the equal-value sorting bits of the larger value and the smaller value in the sorting values of the two elements to obtain an exclusive-OR result of the equal-value sorting bits if it is determined that there is no carry highest bit of the time bits; a second search unit (not shown in the drawings), configured to find the highest exclusive-OR bit of the equal-value sorting bits from the exclusive-OR result of the equal-value sorting bits, and then find the carry highest bit of the equal-value sorting bits according to the highest exclusive-OR bit of the equal-value sorting bits; an output unit 706, configured to output, as the new sorting value of the target element, the carry highest bit of the equal-value sorting bits of the smaller value in the sorting values of the two elements plus 1 if it is determined that there is a carry highest bit of the equal-value sorting bits.

[0091] In some alternative implementation manners of this embodiment, the apparatus further includes: a second exclusive OR unit (not shown in the drawings), configured to exclusive-OR the equal-value sorting bits of the larger value and the smaller value in the sorting values of the two elements to obtain an exclusive-OR result of the equal-value sorting bits if it is determined that the exclusive-OR result of the time bits is equal to 0; a second search unit (not shown in the drawings), configured to find the highest exclusive-OR bit of the equal-value sorting bits from the exclusive-OR result of the equal-value sorting bits, and then find the carry highest bit of the equal-value sorting bits according to the highest exclusive-OR bit of the equal-value sorting bits; an output unit 706, configured to output, as the new sorting value of the target element, the carry highest bit of the equal-value sorting bits of the smaller value in the sorting values of the two elements plus 1 if it is determined that there is a carry highest bit of the equal-value sorting bits.

[0092] In some alternative implementation manners of this embodiment, the output unit 706 is further configured to, if it is determined that there is no carry highest bit of the equal-value sorting bits, find the equal-value sorting bits of a predetermined number of elements respectively forward and backward centered on the target position, recalculate the equal-value sorting bits of the target element and the predetermined number of elements before and after in a manner of decreasing at an equal bit interval in binary, and assign values to the equal-value sorting bits of some of the predetermined number of elements before and after.

[0093] In some alternative implementation manners of this embodiment, the output unit 706 is further configured to, if it is determined that the exclusive-OR result of the time bits is equal to 1, subtract 1 from a predetermined position in the equal-value sorting bits of the larger value in the sorting values of the two elements, and output it as the sorting value of the target element.

[0094] In some alternative implementation manners of this embodiment, the first search unit 705 is configured to: find the bit with the highest bit of the binary number in the exclusive-OR result of the time bits being 1 as the highest exclusive-OR bit of the time bits; start from the highest exclusive-OR bit of the time bits and find the first bit to the right in the exclusive-OR result of the time bits where the larger value is not 0 and the smaller value is not 1.

[0095] In some alternative implementations of this embodiment, the second lookup unit (not shown in the drawings) is configured to: find the bit with the highest binary digit of 1 in the XOR result of the equal-value sorting bits as the highest XOR bit of the equal-value sorting bits; starting from the highest XOR bit of the equal-value sorting bits, look for the first bit to the right in the XOR result of the equal-value sorting bits where the larger value is not 0 and the smaller value is not 1.

[0096] According to an embodiment of the present disclosure, the present disclosure also provides an electronic device and a readable storage medium.

[0097] Figure 8 A schematic block diagram of an exemplary electronic device 800 that can be used to implement the embodiments of the present disclosure is shown. The electronic device is intended to represent various forms of digital computers, such as, a laptop computer, a desktop computer, a workbench, a personal digital assistant, a server, a blade server, a mainframe computer, and other suitable computers. The electronic device can also represent various forms of mobile devices, such as, a personal digital processor, a cellular phone, a smart phone, a wearable device, and other similar computing devices. The components shown herein, their connections and relationships, and their functions are merely examples and are not intended to limit the implementation of the present disclosure described and / or claimed herein.

[0098] As Figure 8 shown, the device 800 includes a computing unit 801, which can perform various appropriate actions and processes according to a computer program stored in a read-only memory (ROM) 802 or a computer program loaded from a storage unit 808 into a random access memory (RAM) 803. In the RAM 803, various programs and data required for the operation of the device 800 can also be stored. The computing unit 801, the ROM 802, and the RAM 803 are connected to each other through a bus 804. An input / output (I / O) interface 805 is also connected to the bus 804.

[0099] A plurality of components in the device 800 are connected to the I / O interface 805, including: an input unit 806, such as a keyboard, a mouse, etc.; an output unit 807, such as various types of displays, speakers, etc.; a storage unit 808, such as a magnetic disk, an optical disk, etc.; and a communication unit 809, such as a network card, a modem, a wireless communication transceiver, etc. The communication unit 809 allows the device 800 to exchange information / data with other devices through a computer network such as the Internet and / or various telecommunication networks.

[0100] The computing unit 801 can be various general-purpose and / or special-purpose processing components with processing and computing capabilities. Some examples of the computing unit 801 include, but are not limited to, a central processing unit (CPU), a graphics processing unit (GPU), various dedicated artificial intelligence (AI) computing chips, various computing units running machine learning model algorithms, a digital signal processor (DSP), and any suitable processor, controller, microcontroller, etc. The computing unit 801 executes the various methods and processes described above, such as the method for outputting information. For example, in some embodiments, the method for outputting information can be implemented as a computer software program that is tangibly contained in a machine-readable medium, such as the storage unit 808. In some embodiments, part or all of the computer program can be loaded and / or installed onto the device 800 via the ROM 802 and / or the communication unit 809. When the computer program is loaded into the RAM 803 and executed by the computing unit 801, one or more steps of the method for outputting information described above can be executed. Alternatively, in other embodiments, the computing unit 801 can be configured to execute the method for outputting information in any other suitable manner (e.g., by means of firmware).

[0101] Various embodiments of the systems and techniques described above in this document can be implemented in digital electronic circuit systems, integrated circuit systems, field-programmable gate arrays (FPGAs), application-specific integrated circuits (ASICs), application-specific standard products (ASSPs), systems-on-a-chip (SOCs), complex programmable logic devices (CPLDs), computer hardware, firmware, software, and / or combinations thereof. These various embodiments can include: being implemented in one or more computer programs that can be executed and / or interpreted on a programmable system including at least one programmable processor, which can be a special-purpose or general-purpose programmable processor, and can receive data and instructions from a storage system, at least one input device, and at least one output device, and transmit the data and instructions to the storage system, the at least one input device, and the at least one output device.

[0102] The program code for implementing the methods of the present disclosure can be written in any combination of one or more programming languages. These program codes can be provided to a processor or controller of a general-purpose computer, a special-purpose computer, or other programmable data processing device, such that when the program codes are executed by the processor or controller, the functions / operations specified in the flowcharts and / or block diagrams are implemented. The program code can be executed entirely on the machine, partially on the machine, as an independent software package partially on the machine and partially on a remote machine, or entirely on a remote machine or server.

[0103] In the context of this disclosure, a machine-readable medium can be a tangible medium that can contain or store a program for use by or in connection with an instruction execution system, apparatus, or device. A machine-readable medium can be a machine-readable signal medium or a machine-readable storage medium. A machine-readable medium can include, but is not limited to, electronic, magnetic, optical, electromagnetic, infrared, or semiconductor systems, apparatus, or devices, or any suitable combination of the foregoing. More specific examples of a machine-readable storage medium would include an electrical connection based on one or more wires, a portable computer diskette, a hard disk, a random access memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM or Flash memory), an optical fiber, a portable compact disc read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination of the foregoing.

[0104] For purposes of providing an interaction with a user, the systems and techniques described herein can be implemented on a computer having: a display device (e.g., a CRT (cathode ray tube) or LCD (liquid crystal display) monitor) for displaying information to the user; and a keyboard and a pointing device (e.g., a mouse or a trackball) by which the user can provide input to the computer. Other kinds of devices can also be used to provide for interaction with the user; for example, feedback provided to the user can be any form of sensory feedback (e.g., visual feedback, auditory feedback, or tactile feedback); and input from the user can be received in any form (including acoustic, speech, or tactile input).

[0105] The systems and techniques described herein can be implemented in a computing system that includes back-end components (e.g., as a data server), or a computing system that includes middleware components (e.g., an application server), or a computing system that includes front-end components (e.g., a user computer having a graphical user interface or a web browser through which the user can interact with an implementation of the systems and techniques described herein), or a computing system that includes any combination of such back-end components, middleware components, or front-end components. The components of the system can be interconnected by any form or medium of digital data communication (e.g., a communication network). Examples of a communication network include: a local area network (LAN), a wide area network (WAN), and the Internet.

[0106] A computer system may include a client and a server. The client and the server are generally far from each other and usually interact through a communication network. The relationship between the client and the server is generated by computer programs running on the respective computers and having a client-server relationship with each other. The server may be a server of a distributed system or a server combined with a blockchain. The server may also be a cloud server or an intelligent cloud computing server or an intelligent cloud host with artificial intelligence technology. The server may be a server of a distributed system or a server combined with a blockchain. The server may also be a cloud server or an intelligent cloud computing server or an intelligent cloud host with artificial intelligence technology.

[0107] It should be understood that various forms of the processes shown above can be used, steps can be reordered, added or deleted. For example, the steps described in this disclosure can be executed in parallel, sequentially or in different orders, as long as the desired results of the technical solutions disclosed in this disclosure can be achieved, and no limitation is imposed herein.

[0108] The above specific embodiments do not constitute a limitation on the protection scope of this disclosure. Those skilled in the art should understand that various modifications, combinations, sub-combinations and substitutions can be made according to design requirements and other factors. Any modifications, equivalent substitutions and improvements made within the spirit and principle of this disclosure shall be included within the protection scope of this disclosure.

Claims

1. A method for outputting information, comprising: A creation unit, in response to a request for inserting a target element into a target position in a sorting queue, creates a starting sorting value for the target element according to the current time; A conversion unit converts the starting sorting value into an initial sorting value, where the initial sorting value includes a time bit and an equal-value sorting bit. The binary number of the starting sorting value includes 64 digits. On the basis that the sign bit of the starting sorting value remains unchanged, it is shifted left by 21 bits, and the lower 21 digits are filled by copying the lower 21 digits before the left shift to generate an initial sorting value of 64 digits. The high 1 digit of the initial sorting value is the sign bit, the secondary 42 digits are the time bit; the last 21 digits are the equal-value sorting bit; An acquisition unit acquires the sorting values of two elements before and after the target position; A first XOR unit XORs the time bits of the larger value and the smaller value among the sorting values of the two elements to obtain a time bit XOR result; A first search unit, if it determines that the time bit XOR result is greater than 1, searches for the highest XOR bit of the time bit from the time bit XOR result, and then searches for the highest carry bit of the time bit according to the highest XOR bit of the time bit, where the highest XOR bit refers to the highest bit with a value of 1 in the XOR value, and the highest carry bit refers to the first bit from the highest XOR bit of the two elements to the lower bits where the larger value is 0 and the smaller value is 1; An output unit, if it determines that there is a highest carry bit of the time bit, adds 1 to the highest carry bit of the time bit of the smaller value among the sorting values of the two elements and outputs it as the new sorting value of the target element.

2. The method according to claim 1, wherein, the method further comprises: A second XOR unit, if it determines that there is no highest carry bit of the time bit, XORs the equal-value sorting bits of the larger value and the smaller value among the sorting values of the two elements to obtain an equal-value sorting bit XOR result; A second search unit searches for the highest XOR bit of the equal-value sorting bit from the equal-value sorting bit XOR result, and then searches for the highest carry bit of the equal-value sorting bit according to the highest XOR bit of the equal-value sorting bit; An output unit, if it determines that there is a highest carry bit of the equal-value sorting bit, adds 1 to the highest carry bit of the equal-value sorting bit of the smaller value among the sorting values of the two elements and outputs it as the new sorting value of the target element.

3. The method according to claim 1, wherein, the method further comprises: A second XOR unit, if it determines that the time bit XOR result is equal to 0, XORs the equal-value sorting bits of the larger value and the smaller value among the sorting values of the two elements to obtain an equal-value sorting bit XOR result; A second search unit searches for the highest XOR bit of the equal-value sorting bit from the equal-value sorting bit XOR result, and then searches for the highest carry bit of the equal-value sorting bit according to the highest XOR bit of the equal-value sorting bit; An output unit, if it determines that there is a highest carry bit of the equal-value sorting bit, adds 1 to the highest carry bit of the equal-value sorting bit of the smaller value among the sorting values of the two elements and outputs it as the new sorting value of the target element.

4. The method according to claim 2 or 3, wherein, the method further comprises: If the output unit determines that there is no carry highest bit of the equivalent sorting bits, it searches for the equivalent sorting bits of a predetermined number of elements forward and backward respectively centered on the target position, recalculates the equivalent sorting bits of the target element and the predetermined number of elements before and after in the manner of decreasing at equal bit intervals in binary, and assigns values to the equivalent sorting bits of some elements among the predetermined number of elements before and after.

5. The method according to claim 1, wherein, the method further includes: If the output unit determines that the exclusive OR result of the time bits is equal to 1, it subtracts 1 from a predetermined position in the equivalent sorting bits of the larger value among the sorting values of the two elements, and outputs it as the sorting value of the target element.

6. The method according to claim 1, wherein, the step of finding the highest exclusive OR bit of the time bits from the exclusive OR result of the time bits, and then finding the highest carry bit of the time bits according to the highest exclusive OR bit of the time bits includes: The first search unit finds the bit with the highest bit of the binary number in the exclusive OR result of the time bits as the highest exclusive OR bit of the time bits; The first search unit starts from the highest exclusive OR bit of the time bits and searches to the right for the first bit in the exclusive OR result of the time bits where the larger value is not 0 and the smaller value is not 1.

7. The method according to claim 2 or 3, wherein, the step of finding the highest exclusive OR bit of the equivalent sorting bits from the exclusive OR result of the equivalent sorting bits, and then finding the highest carry bit of the equivalent sorting bits according to the highest exclusive OR bit of the equivalent sorting bits includes: The second search unit finds the bit with the highest bit of the binary number in the exclusive OR result of the equivalent sorting bits as the highest exclusive OR bit of the equivalent sorting bits; The second search unit starts from the highest exclusive OR bit of the equivalent sorting bits and searches to the right for the first bit in the exclusive OR result of the equivalent sorting bits where the larger value is not 0 and the smaller value is not 1.

8. An apparatus for outputting information, comprising: a creation unit configured to create a starting sorting value for the target element according to the current time in response to a request for detecting the insertion of the target element into the target position in the sorting queue; a conversion unit configured to convert the starting sorting value into an initial sorting value, wherein the initial sorting value includes time bits and equivalent sorting bits, the binary number of the starting sorting value includes 64 bits, while keeping the sign bit of the starting sorting value unchanged, it is shifted left by 21 bits, and the lower 21 bits are filled with the replicated lower 21 bits before the left shift to generate an initial sorting value of 64 bits. The highest 1 bit of the initial sorting value is the sign bit, the next 42 bits are time bits; the last 21 bits are equivalent sorting bits; an acquisition unit configured to acquire the sorting values of two elements before and after the target position; a first exclusive OR unit configured to exclusive OR the time bits of the larger value and the smaller value among the sorting values of the two elements to obtain an exclusive OR result of the time bits; The first search unit is configured to, if it is determined that the exclusive-OR result of the time bits is greater than 1, find the highest bit of the exclusive-OR of the time bits from the exclusive-OR result of the time bits, and then search for the highest carry bit of the time bits according to the highest bit of the exclusive-OR of the time bits. Herein, the highest bit of the exclusive-OR refers to the highest bit with a value of 1 in the exclusive-OR value, and the highest carry bit refers to the first bit with a non-large value of 0 and a small value of 1 found from the highest bit of the exclusive-OR of the time bits to the lower bits of the two elements; The output unit is configured to, if it is determined that there is a highest carry bit of the time bits, add 1 to the highest carry bit of the time bits of the smaller value in the sorting values of the two elements, and output it as the new sorting value of the target element.

9. An electronic device for outputting information, comprising: one or more processors; a storage device having stored thereon one or more programs, when the one or more programs are executed by the one or more processors, enabling the one or more processors to implement the method according to any one of claims 1-7.

10. A computer-readable medium having stored thereon a computer program, wherein, the program, when executed by a processor, implements the method according to any one of claims 1-7.

Citation Information

Patent Citations

  • Method and system for realizing rapid routing of KAD network nodes

    CN112039775A

  • Alignment processor

    JP1997212338A