Unlock instant, AI-driven research and patent intelligence for your innovation.

JavaScript- and Unicode-based character sorting method, system and device

A sorting method and character technology, which is applied in the fields of electrical digital data processing, instruments, calculations, etc., can solve the problems of performance waste, increased number of operations, and many comparisons, etc., and achieve the goal of highlighting substantive features, comprehensive usability, and improving performance Effect

Pending Publication Date: 2022-01-04
SHANDONG ZHONGFU INFORMATION IND
View PDF0 Cites 0 Cited by
  • Summary
  • Abstract
  • Description
  • Claims
  • Application Information

AI Technical Summary

Problems solved by technology

Among them, the disadvantage of bubble sorting is that it is slow, and the runtime complexity is O(n2), which cannot meet the needs of large array sorting; selection sorting is an unstable sorting algorithm, and there are too many comparisons, which is easy to cause unnecessary The performance waste; insertion sorting is similar to the insertion of poker cards. Once a large order of magnitude is encountered, the number of operations will increase exponentially; the sort method is a method of parsing through the browser engine, and the first The ASCII value of the character is used for comparison and sorting, and the method defaults to converting all elements to String first and then sorting. Direct use will cause many problems

Method used

the structure of the environmentally friendly knitted fabric provided by the present invention; figure 2 Flow chart of the yarn wrapping machine for environmentally friendly knitted fabrics and storage devices; image 3 Is the parameter map of the yarn covering machine
View more

Image

Smart Image Click on the blue labels to locate them in the text.
Viewing Examples
Smart Image
  • JavaScript- and Unicode-based character sorting method, system and device
  • JavaScript- and Unicode-based character sorting method, system and device
  • JavaScript- and Unicode-based character sorting method, system and device

Examples

Experimental program
Comparison scheme
Effect test

Embodiment Construction

[0053] Specific embodiments of the present invention will be described below in conjunction with the accompanying drawings.

[0054] Such as figure 1 A character sorting method based on JavaScript and Unicode is shown, including:

[0055] First, create a collation function in the JavaScript platform, denoted as the compare function. Then, extract two adjacent elements in the array to be sorted, record them as parameters a and b, and input parameters a and b into the compare function.

[0056] In the compare function, first judge whether a and b are equal, if they are equal, the compare function returns 1 directly; if they are not equal, further judge whether a has a value, if a has no value, the compare function directly returns 1; Then judge whether b has a value, if b has no value, the compare function returns -1 directly.

[0057] If b has a value, use the preset Unicode comparison method function to compare a and b, and the compare function generates a return value accord...

the structure of the environmentally friendly knitted fabric provided by the present invention; figure 2 Flow chart of the yarn wrapping machine for environmentally friendly knitted fabrics and storage devices; image 3 Is the parameter map of the yarn covering machine
Login to View More

PUM

No PUM Login to View More

Abstract

The invention provides a character sorting method, system and device based on JavaScript and Unicode. The method comprises the following steps: creating a sorting rule function in a JavaScript platform, and recording the sorting rule function as a complex function; extracting two adjacent elements from the array to be sorted, and recording the two adjacent elements as parameters a and b; inputting the parameters a and b into a complex function; judging whether a is equal to b or not, and if yes, directly returning 1 to the component function; if not, further judging whether a has a value or not, and if a does not have a value, directly returning 1 to the component function; if a has a value, judging whether b has a value or not, and if b does not have a value, directly returning the component function to-1; if b has a value, comparing a with b by using a preset Unicode comparison method function; the component function generating a return value according to the comparison result; and comparing and sorting the array to be sorted by adopting a sort method according to the return value. According to the method, the overall performance of processing character string sorting by js in a complex service scene can be effectively improved.

Description

technical field [0001] The present invention relates to the technical field of character data processing, and more specifically relates to a character sorting method, system and device based on JavaScript and Unicode. Background technique [0002] Sorting algorithm, that is, reordering one or more sets of data according to a predetermined pattern through a specific algorithmic factor. This new sequence follows certain rules and embodies certain rules. Therefore, the processed data is easy to filter and calculate, which greatly improves the calculation efficiency. For sorting, the most basic requirement is to have a certain degree of stability, that is, when two identical elements appear in a certain sequence at the same time, after a certain sorting algorithm, the relative positions of the two elements before and after sorting will not change. . In other words, even if there are two identical elements, they are different in the sorting process, and confusion is not allowed...

Claims

the structure of the environmentally friendly knitted fabric provided by the present invention; figure 2 Flow chart of the yarn wrapping machine for environmentally friendly knitted fabrics and storage devices; image 3 Is the parameter map of the yarn covering machine
Login to View More

Application Information

Patent Timeline
no application Login to View More
Patent Type & Authority Applications(China)
IPC IPC(8): G06F40/129
CPCG06F40/129
Inventor 郝长征李尊状游鑫崔凤
Owner SHANDONG ZHONGFU INFORMATION IND