CN107133899A - A kind of daily emergent calling method based on random sequence sort algorithm - Google Patents

A kind of daily emergent calling method based on random sequence sort algorithm Download PDF

Info

Publication number
CN107133899A
CN107133899A CN201710197953.5A CN201710197953A CN107133899A CN 107133899 A CN107133899 A CN 107133899A CN 201710197953 A CN201710197953 A CN 201710197953A CN 107133899 A CN107133899 A CN 107133899A
Authority
CN
China
Prior art keywords
mtr
mtd
msub
rsqb
lsqb
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.)
Pending
Application number
CN201710197953.5A
Other languages
Chinese (zh)
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.)
Jinan University
University of Jinan
Original Assignee
Jinan University
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 Jinan University filed Critical Jinan University
Priority to CN201710197953.5A priority Critical patent/CN107133899A/en
Publication of CN107133899A publication Critical patent/CN107133899A/en
Pending legal-status Critical Current

Links

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING; COUNTING
    • G06QDATA PROCESSING SYSTEMS OR METHODS, SPECIALLY ADAPTED FOR ADMINISTRATIVE, COMMERCIAL, FINANCIAL, MANAGERIAL, SUPERVISORY OR FORECASTING PURPOSES; SYSTEMS OR METHODS SPECIALLY ADAPTED FOR ADMINISTRATIVE, COMMERCIAL, FINANCIAL, MANAGERIAL, SUPERVISORY OR FORECASTING PURPOSES, NOT OTHERWISE PROVIDED FOR
    • G06Q50/00Systems or methods specially adapted for specific business sectors, e.g. utilities or tourism
    • G06Q50/10Services
    • G06Q50/26Government or public services
    • G06Q50/265Personal security, identity or safety

Abstract

The present invention relates to a kind of daily emergent calling method based on random sequence sort algorithm.It includes:S1. the help information sent for seeking help person's mobile intelligent terminal, APP platforms receive the response message of respondent, and according to the distance between the positional information calculation seeking help person between respondent and seeking help person and each respondent;The distance between seeking help person and each respondent are carried out size sequence by S2.APP platforms, and ranking results are fed back into seeking help person's mobile intelligent terminal.The present invention is in order to improve screening of the seeking help person to response message, APP platforms first calculate the distance between seeking help person and each respondent according to the positional information between respondent and seeking help person, then adjust the distance and carry out size sequence, ranking results are supplied to seeking help person, so, seeking help person can be quickly found out according to distance-taxis result satisfaction seek help requirement and helped apart from suitable respondent, so as to effectively improve efficiency of seeking help.

Description

A kind of daily emergent calling method based on random sequence sort algorithm
Technical field
The present invention relates to daily relief field, more particularly, to a kind of daily tight based on random sequence sort algorithm Anxious recourse method.
Background technology
Modern society is increasingly referred to as " risk society ", and risk society is a big data society.In development of globalization Under background, the global risk caused by human practice, which occupies leading position, turns into the Yi great Te of contemporary society's developing stage Levy.A modernistic obvious characteristic is that the paces quickening of social cChange, scope expand and unprecedented deep property.It is this to society Can live and naturally intervene the unprecedented expansion of scope and depth, it is new the need for it is more and more, also continued to bring out the problem of new. In such society, the need for the method for satisfaction needs can be drawn newly, the problem of method of solution problem can draw more.
In realistic meaning, the structure of risk society is not made up of key elements such as class, stratum, but by personal behavior What main body was constituted.That is the order of risk society is not grade formula, vertical, but network-type, plane extension , each individual is " leveler " in risk society.Risk is as a kind of result of psychological cognition, and risk society is general The appearance of thought embodies the intensification that the mankind are recognized risk.It was recognized that in risk society, it is original to be used for solving problem Means and methodses are also possible to bring new risk the problem of causing new.The arrangement that risk is not ordered into, but it is presented a kind of Cross direction profiles without configuration state, it is produced with propagating increasingly not against procedural rule and specification.Also recognize simultaneously The limitation of professional knowledge in this case.In addition, sense of risk also turns into a kind of risk in itself:The distribution of sense of risk becomes In uniform, many risks become to turn a blind eye on the contrary after by the public being understood.Therefore such predicament is brought:Although right The level of understanding of risk is improved, and the reply to risk is not enough on the contrary.
Foreign countries are engaged in contingency management work and emergency software time of product development is more early, wherein the U.S., Japan and Germany Emergency set is more advanced.At present, in the handset products of burst emergency reply function is presented very single in China One, practicality is not strong, and interactivity is poor, can not also realize that Crisis Information early warning is issued.Domestic several common similar productions are as follows:
1.《Emergency signalling generator》, the single emergency function of its only one of which sent by the application software and includes " satellite Good friend of the position consultancy " with the Email or news in brief of " positioning address " to user, reach gather a group of friends or as early as possible above water with Dangerous situation.This mode is unidirectional help mode, and seeking help person sends help information and can not carried out with the recipient for receiving help information It is timely interactive, cause seeking help person can not be rescued or obtained in time effective counter-measure, so that disposal can not be tackled Or correspondence disposal delay.
2.《Field first aid guide》By integrating all kinds of first-aid knowledges so that professional rescue group has not arrived under emergency situations Scene or when can not reach, carries out appropriate saves oneself with mutually rescuing.But the UI of software designs and the inadequate people of interactive mode Property, classified by all kinds of professional, the masses of shortage professional knowledge commonly, when using this software, often Appearance can not sort out differentiation, so that disposal or reply disposal delay can not be tackled.And this mode can only be by seeking help person certainly Help, when first aid guide can not provide help at the scene, seeking help person can not accurately and timely pass on away its help information, also with regard to nothing Method obtains the rescue of outside in time.
3.《Urgent call assistant》, running into emergency needs to dial robber and police, and first aid, fire alarm, traffic accident, weather is pre- Report, during the number such as number inquiry, the instrument can have to robber and police, first aid, fire alarm, the points for attention that traffic accident is expected someone's call when dialing Detailed description, user can correctly dial emergency numbers according to operating guidance, and efficiency is dialed in raising.This mode is by dialing Conventional emergency number obtains Emergency Assistance, although can carry out interaction of seeking help, but such conventional emergency number all corresponds to Conventional rescue type, the rescue of each emergency number one class of correspondence or multiclass, in addition to its corresponding rescue, emergency number Be difficult by seeking help person or even other kinds of rescue can not be provided.But in actual life, help type is various, except routine Rescue outside, can not be worked for the conventional emergency number of other kinds of rescue, also can not just provide and timely rescue.
4.《SOS software ADO SOS V1.0》It is a in case of emergency to show distress signals to other people Software, brushes change color to the left or to the right, upper or the display of brush change downwards word, can remove menu/setting input word to be shown, The locale selections Chinese or English of available handsets.This software is to send help information, but still lack seeking help person and By the interaction between seeking help person, cause seeking help person can not be rescued or obtained in time effective counter-measure, so that can not Reply disposal or correspondence disposal delay, function are very single.
5.《Intelligent mobile phone for help》It is a mobile phone for the elderly's design specialized, can once accident occurs suddenly for old man Directly press " 999 " first aid key, and though patient Pekinese which place, 999 command centre can all run through first aid mobile phone The position of people is called for help in alignment system, locking.Obviously, the cell-phone function purposes scope is narrower,
6.《Emergency alarm》, the itinerary of the traceable user of the application program and user occur contingency when, root The orientation of accident report and user are sent to specified mobile phone number according to prior setting.This mode is will passively to anticipate The information of outer accident is sent to specified mobile phone number, it is impossible to carries out seeking help person and by the interaction between seeking help person, causes seeking help person Effective counter-measure can not be rescued or be obtained in time, so that disposal or correspondence disposal delay, function can not be tackled It is very single.
The flash appeal mode function of above-mentioned accident is single, it is impossible to interaction of effectively seeking help is realized, even if can be real Now seek help interaction, be also only limited to phone and be seeking help for conventional emergency number, it is obtainable promptly to help very limited. At present, the theory and application research or blank with warning aspect are helped in the hand-held first aid of mobile Internet in the world, daily is tight Anxious help system also there is not yet.Therefore, design and algorithm based on mobile terminal flash appeal and risk information early warning platform Research can fill up international academic community in the research and the blank of application field, either theoretical significance or practical application valency Value is all very big, is a kind of application trend of big data social application development.
The content of the invention
The present invention seeks help to overcome at least one defect (deficiency) described in above-mentioned prior art to be improved there is provided one kind The daily emergent calling method based on random sequence sort algorithm of efficiency.
In order to solve the above technical problems, technical scheme is as follows:
A kind of daily emergent calling method based on random sequence sort algorithm, including:
S1. the help information sent for seeking help person's mobile intelligent terminal, APP platforms receive the response message of respondent, And according to the distance between the positional information calculation seeking help person between respondent and seeking help person and each respondent;
The distance between seeking help person and each respondent are ranked up by S2.APP platforms, and ranking results are fed back to asked The person's of helping mobile intelligent terminal.
The help information that the APP platforms of the present invention are sent according to seeking help person's mobile intelligent terminal is transmitted to around seeking help person On mobile intelligent terminal, it around someone will carry out response using mobile intelligent terminal, APP platforms can receive the response letter of respondent Breath, in order to improve screening of the seeking help person to response message, APP platforms are first counted according to the positional information between respondent and seeking help person The distance between seeking help person and each respondent are calculated, then adjusts the distance and is sorted from small to large, ranking results, which are supplied to, seeks help Person, so, seeking help person can be quickly found out according to distance-taxis result satisfaction seek help requirement and apart from suitable respondent carry out Help, so as to effectively improve efficiency of seeking help.
In such scheme, APP platforms carry out the distance between seeking help person and each respondent from small to large in the S2 That sorts concretely comprises the following steps:
If within the time of a restriction, any one identical time point or any of which very short time interval Interior, the respondent without two or more is simultaneously emitted by response message and reaches APP platforms, then utilizes random sequence dynamic Compare replacement sort algorithm to sort to the distance between seeking help person and each respondent from small to large;
If within the time of a restriction, at one time point of identical or in very short time interval, there is two Individual or more than two respondents are simultaneously emitted by response message and reach APP platforms, then are staggered and compared using adjacent element odd even Sort algorithm to being sorted from small to large to the distance between seeking help person and each respondent.
If within the time of a restriction, thering is some time points only one of which respondent to send information, from respondent hair The echo message gone out has certain time interval apart from the echo message that next bit respondent sends;Separately have some time points or In a very short time interval, there are two or more respondents to be simultaneously emitted by response message, then comprehensive crossover apply with Machine sequence Dynamic comparison replacement sort method and adjacent element odd even be staggered comparative sorting method come to seeking help person and each respondent it Between distance sorted from small to large.Using above-mentioned two sort algorithm, different time and same time can be solved The sequencing problem of response message, so as to solve after seeking help person sends help information, APP platforms can to it is resulting it is all should The distance between the person of answering and seeking help person carry out far and near sequence.
In such scheme, using random sequence Dynamic comparison replacement sort algorithm between seeking help person and each respondent Distance is carried out from small with comprising the following steps that for sorting greatly:
Assuming that APP platforms receive the response message of n respondents within the successively different time, variable m is used1, m2..., mnTo represent the distance between this n respondent and deliverer respectively;
1st step:Set up empty queue A [n] and B [n] that two spaces size is n+1, queue A and B first space A [0] and B [0] leave a blank, B [0] is used for doing the interim spare space of dynamic element replacement process, and A [1] is queue A header element space, B [1] It is queue B header element space;Queue A is used for storing original dynamic data mi, queue B be used for store by dynamic data mi It is compared the new data sequence T sorted from small to large after displacementi, wherein i=1,2 ..., n;
2nd step:When receiving the response message of first respondent, the 1st will be produced between respondent and deliverer Distance, use variable m1Represent;Allow m1Direct enqueue A is used as header element, A [1]=m1
Make T1=m1, T1Enqueue B is used as header element, B [1]=T1
3rd step:Receive the response message of the 2nd respondent, by produce the 2nd between respondent and deliverer away from From using variable m2Represent, allow m2A join the team as tail element, now there is A [2]=m2
Make T2=m2, allow T2Interim spare space B [0] in enqueue B, that is, have B [0]=T2
To queue B, with the element T in current B [0] space2It is used as existing element T in base element, with queue B1Make as follows The operation compared and replaced:
If 1) T2≥T1, then B [2]=T is made2, now have:B [1]≤B [2], so existing element T in queue B1、T2 By order sequence from small to large;
If 2) T2≤T1, then following replacement operator is carried out:
Then B [1]≤B [2], makees following assignment:
Obtain T1≤T2, therefore obtained the element T in queue B1、T2By order sequence from small to large;
4th step:Receive the 3rd respondent and send response message, by produce the 3rd between respondent and deliverer away from From using variable m3Represent, allow m3A join the team as tail element, now there is A [3]=m3
Make T3=m3, allow T3Interim spare space B [0] in enqueue B, that is, have B [0]=T3
To queue B, with the element T in current B [0] space3As base element, the current tail element T from queue B2 Rise, use T3With the inverted order of existing element in queue B:T2、T1Between sequentially make what following adjacent element two-by-two progressively compared and replaced Operation:
If T3≥T2, then B [3]=T is made3, now B [2]≤B [3], because existing element T in queue B2、T1It is to have arranged Good sequence, i.e. T1≤T2, that is, B [1]≤B [2], so there is B [1]≤B [2]≤B [3], then there is T1≤T2≤T3, so obtaining Element T in queue B1, T2, T3By order sequence from small to large;
If T3< T2, then need further to be compared and replaced as follows;
If T3≥T1, then have T1≤T3< T2.Because B [1]=T1, B [2]=T2, B [0]=T3, so in B [1] space Element T1It is motionless, it is necessary to T2, T3And its queue space at place carries out following replacement operator:
Then B [2] < B [3] are obtained, make following assignment:
Then T is obtained2< T3, therefore T1≤T2< T3, B [1]≤B [2] < B [3] are obtained, the element in this explanation queue B T1, T2, T3By order sequence from small to large;
If T3< T1, then have T3< T1≤T2, because B [1]=T1, B [2]=T2, B [0]=T3, so needing progress as follows Replacement operator:
Then B [1] < B [2]≤B [3] is obtained, makees following assignment:
Then T is obtained1≤T2< T3, the now element T in queue B1, T2, T3By order sequence from small to large.
5th step:So proceed, it is assumed that be performed until after seeking help person sends help information number, existing k responses Person sends response message, and wherein the distance between i-th bit respondent and seeking help person is mi, miEnqueue A, and believe according to issue The time tandem of breath is joined the team, and should mutually have a sequence TiFor miThe new arrangement of one kind, meet order sequence from small to large, That is T1≤T2≤…≤Tk, i=1,2 ..., k;
When+1 respondent of kth sends response message ,+1 distance of kth will be produced, i.e.+1 respondent of kth is with seeking help The distance between person, uses variable mk+1Represent.Allow mk+1A join the team as tail element, now there is A [k+1]=mk+1
Make Tk+1=mk+1, allow Tk+1Interim spare space B [0] in enqueue B, that is, have B [0]=Tk+1
To queue B, with the element T in current B [0] spacek+1As base element, the current tail element T from queue Bk Rise, with the inverted order with existing element in queue B:Tk, Tk-1..., T3, T2, T1Between sequentially make following adjacent element two-by-two progressively The operation compared and replaced:
If Tk+1≥Tk, then B [k+1]=T is madek+1, now have B [k]≤B [k+1], because existing element T in queue B1, T2, T3..., Tk-1, TkIt is sorted, i.e. T1≤T2≤T3≤…≤Tk-1≤Tk, that is, B [1]≤B [2]≤B [3] ≤ ...≤B [k-1]≤B [k], so B [1]≤B [2]≤B [3]≤...≤B [k-1]≤B [k]≤B [k+1], that is, there is T1≤T2≤ T3≤…≤Tk-1≤Tk≤Tk+1, then obtain the element T in queue B1, T2, T3..., Tk-1, Tk, Tk+1It is suitable by from small to large Sequence sorts.
If Tk+1< Tk, then need further to be compared and replaced as follows,
If Tk+1≥Tk-1, then have Tk-1≤Tk+1< Tk.Because B [k-1]=Tk-1, B [k]=Tk, B [0]=Tk+1, so allowing B Element T in [k-1] spacek-1It is motionless, it is necessary to Tk, Tk+1And its queue space at place carries out following replacement operator:
Then B [k] < B [k+1] are obtained, make following assignment:
Then T is obtainedk< Tk+1, therefore T1≤T2≤T3≤…≤Tk-1≤Tk< Tk+1, obtain B [1]≤B [2]≤B [3] ≤ ... the element T in≤B [k-1]≤B [k] < B [k+1], this explanation queue B1, T2, T3..., Tk-1, Tk, Tk+1By from small to large Order sequence.
If Tk+1< Tk-1, then have, Tk+1< Tk-1≤Tk, because B [k-1]=Tk-1, B [k]=Tk, B [0]=Tk+1, so needing Carry out following replacement operator:
Then B [k-1]≤B [k]≤B [k+1] is obtained, makees following assignment:
Then T is obtainedk-1< Tk≤Tk+1, therefore T1≤T2≤T3≤…≤Tk-1≤Tk< Tk+1, obtain B [1]≤B [2]≤ B [3]≤... the element T in≤B [k-1] < B [k]≤B [k+1], this explanation, queue B1, T2, T3..., Tk-1, Tk, Tk+1By from It is small to be sorted to big order;
So proceed, until Tk+1< T2, and obtain T according to method above2, T3..., Tk-1, Tk, Tk+1 By order sequence from small to large.Then, it is only necessary to finally compare Tk+1And T1Size.
Make B [0]=Tk+1, it is discussed below two situations:
(I) if Tk+1≥T1, due to T2≤T3≤…≤Tk, so T1≤Tk+1≤T2≤T3≤…≤Tk.Again because B [k] =Tk, B [k-1]=Tk-1..., B [2]=T2, B [1]=T1, therefore following displacement can be made:
Then have B [1]≤B [2]≤B [3]≤...≤B [k-1] < B [k]≤B [k+1],
Then following assignment is remake:
Then there is T1≤T2≤T3≤…≤Tk-1≤Tk< Tk+1, the then element T in queue B1, T2, T3..., Tk-1, Tk, Tk+1 By order sequence from small to large;
(ii) if Tk+1< T1, due to T1≤T2≤T3≤…≤Tk, so Tk+1< T1≤T2≤T3≤…≤Tk.And because For B [k]=Tk, B [k-1]=Tk-1..., B [2]=T2, B [1]=T1, therefore following displacement can be made:
Then have B [1]≤B [2]≤B [3]≤...≤B [k-1] < B [k]≤B [k+1].
Then following assignment is remake:
Then there is T1≤T2≤T3≤…≤Tk-1≤Tk< Tk+1, the then element T in queue B1, T2, T3..., Tk-1, Tk, Tk+1 By order sequence from small to large;
In such scheme, comparative sorting algorithm is staggered between seeking help person and each respondent using adjacent element odd even What distance was sorted from small to large comprises the following steps that:
Assuming that within some identical time point or very short time interval, one, which has m respondents, sends simultaneously Response message is reached on APP platforms, uses variable S1, S2..., SmTo represent this m between respondent and deliverer and distance;
1st step:Due to the distance between m respondents and seeking help person S1, S2..., SmIt is at the same time or almost same What one time produced, so S1, S2..., SmInitial configuration press any one sequence permutation, it is assumed that the sequence is initially just pressed S1, S2..., SmSequence;
2nd step, is divided to m to be discussed respectively for even number, two kinds of different situations of odd number below
(3) if m is even number
(I) is by sequence S1, S2..., SmFrom left to right adjacent element makes one group of number to (S two-by-twoi,Si+1) wherein, i= 1,2 ..., m-1, because m is even number, so just constitutingGroup is adjacent several right two-by-two;
(ii) to each group of number to (Si,Si+1) in two numbers carry out size comparison
If 3. Si≤Si+1, then keep several pairs of the order constant;
If 4. Si> Si+1, then several pairs of the order is exchanged, makes this several to be less than the number on the left side number on the right;
By above-mentioned processing more from left to right to two neighboring several sizes, S is obtained1, S2..., SmSequence is from left to right Adjacent element according to sorting from small to large two-by-two;
If now whole sequence S1, S2..., SmSort from small to large, then algorithm is terminated, and is otherwise transferred to next step (ⅲ);
(III) is to sequence S1, S2..., Sm, it is carried out in two steps:
3. by the 1st element S1With last element SmConstitute several right, then compare S1And SmSize;If S1≤Sm, Then keep S1And SmOrder it is constant;If S1> Sm, then S is exchanged1And SmPosition, make SmMake the 1st element, S of the sequence1 Make last element of the sequence;
4. from the 2nd element S2To second-to-last element Sm-1, element adjacent two-by-two is from left to right made into one group of number To (Si,Si+1), wherein i=2,3 ..., m-2, because m is even number, so just constitutingGroup is adjacent several right two-by-two;
(iv) to each group of number to (Si,Si+1) two numbers in (i=2,3 ..., m-2) carry out size comparison
If 4. Si≤Si+1, then keep several pairs of the order constant;
If 5. Si> Si+1, then several pairs of the order is exchanged, makes this several to be less than the number on the left side number on the right;
By the processing of (iv) from left to right to two neighboring several sizes, S is obtained1≤Sm, and S2, S3..., Sm-1Sequence from Left-to-right adjacent element two-by-two according to sorting from small to large.
If now whole sequence S1, S2..., SmSort from small to large, then algorithm is terminated, and otherwise returns to the 2nd step (1) (I) in restarts, and is so repeated, is performed until S1, S2..., SmUntill sorting from small to large, now, calculate Method will be terminated;
(4) if m is odd number
(I) is by sequence S1, S2..., SmFrom the 1st element S1Rise, from left to right adjacent element makes one group of number pair two-by-two (Si,Si+1), wherein, i=1,2 ..., m-2, because m is odd number, so the sequence is constitutedOrganize several right, S adjacent two-by-twom For surplus element, element-free can be organized pair;
(ii) to each group of number to (Si,Si+1) two numbers in (i=1,2 ..., m-2) carry out size comparison
If 1. Si≤Si+1, then keep several pairs of the order constant;
If 6. Si> Si+1, then several pairs of the order is exchanged, makes this several to be less than the number on the left side number on the right;
By the processing of (ii) from left to right to two neighboring several sizes, S is obtained1, S2..., Sm-1Sequence from left to right two Two adjacent elements according to sorting from small to large;
If now whole sequence S1, S2..., Sm-1, SmSort from small to large, then algorithm is terminated;Otherwise it is transferred to down One step (III);
(III) retains the 1st element S1It is motionless, from the 2nd element S2Rise, from left to right adjacent element makes one group two-by-two It is several to (Si,Si+1), wherein i=2,3 ..., m-1, because m is odd number, so can constituteGroup is adjacent several right two-by-two;
If 3. Si≤Si+1, then keep several pairs of the order constant;
If 4. Si> Si+1, then several pairs of the order is exchanged, makes this several to be less than the number on the left side number on the right;
By the processing of (III) from left to right to two neighboring several sizes, S is obtained2, S3..., SmSequence is from left to right two-by-two Adjacent element according to sorting from small to large;
If now whole sequence S1, S2..., SmSort from small to large, then algorithm is terminated;Otherwise the 2nd step is returned to (2) (I) in restarts, and is so repeated, is performed until S1, S2..., SmUntill sorting from small to large, now, calculate Method will be terminated.
Compared with prior art, the beneficial effect of technical solution of the present invention is:
During daily flash appeal, seeking help person is after help information is sent, and the people of surrounding has response, therefore APP Platform can receive the response message of many respondents.Each response message is all corresponding with a respondent.Therefore, answer for one The distance between a respondent and seeking help person will be produced by answering information, the distance between all these respondents and seeking help person with The priority of time with response message while reaching after APP platforms, a distance between respondent and seeking help person will be produced Queue.Due to distance have it is near have remote, seeking help person is typically always on the premise of satisfaction seeks help requirement, and prioritizing selection is closer to the distance Respondent.And when response message is a lot, seeking help person to find satisfaction seek help requirement and respondent closer to the distance be not easy, institute It is staggered comparative sorting algorithm by random sequence Dynamic comparison replacement sort algorithm and adjacent element odd even with the present invention, for comprehensive The random distance random sequence sequencing problem intersected and solved during daily flash appeal between respondent and seeking help person is closed, APP platforms are ranked up by the queue of adjusting the distance of above-mentioned two random sequence sort algorithm, and ranking results are timely fed back to ask On the mobile intelligent terminal for the person of helping, seeking help person is selected suitable respondent in time and helped so that seeking help person can To obtain effectively tackling help in time, the method improves the promptness and validity of flash appeal.
Brief description of the drawings
Fig. 1 is the flow chart of the daily emergent calling method embodiment of the invention based on random sequence sort algorithm.
Fig. 2 be in the daily emergent calling method specific embodiment based on random sequence sort algorithm of the invention seeking help person with Schematic diagram of the respondent in landscape position.
Fig. 3 is the position at the earth's surface of seeking help person and elder brother response person in the present invention and longitude and latitude schematic diagram.
Embodiment
Accompanying drawing being given for example only property explanation, it is impossible to be interpreted as the limitation to this patent;
To those skilled in the art, it is to be appreciated that some known features and its explanation, which may be omitted, in accompanying drawing 's.Technical scheme is described further with reference to the accompanying drawings and examples.
Embodiment 1
As shown in figure 1, being a kind of daily emergent calling method specific implementation based on random sequence sort algorithm of the present invention The flow chart of example.Referring to Fig. 1, a kind of tool of the daily emergent calling method based on random sequence sort algorithm of this specific embodiment Body step includes:
S101. the help information sent for seeking help person's mobile intelligent terminal, APP platforms receive the response letter of respondent Breath, and according to the distance between the positional information calculation seeking help person between respondent and seeking help person and each respondent;
Help information can be the personal information (such as name, sex, telephone number) of seeking help person, need what is sent to seek help Geographical position residing for information text, picture or video, seeking help person.Wherein geographical position residing for seeking help person is a real-time geographic Information, seeking help person position can be directly displayed in map by it, and can show that seeking help person sends the motion rail after help signal Mark, so that positioning in time when emergency needs scene relief, is occurring in the geographical location information of real-time tracking seeking help person To the real time position of seeking help person, the promptness of relief is improved.When implementing, seeking help person is to send to ask by mobile intelligent terminal Supplementary information is on APP platforms, and APP platforms receive the help information that seeking help person's mobile intelligent terminal is sent, and APP platforms will connect The help information received is forwarded on the mobile intelligent terminal around seeking help person, during this, and APP platforms can be according to seeking help person Geographical location information navigate to the crowd of its near its circumference, the information sought help, picture or video are sent.Wherein, It is centered on seeking help person position, the scope for the circle that a predetermined value is constructed by radius around described;Surrounding is received The mobile intelligent terminal of help information can choose whether to respond according to actual conditions, and APP platforms can receive response if responding The response message of person.Mobile intelligent terminal around seeking help person is to be connected in advance with APP platforms.
The respondent for responding help information refers to receiving the side for giving response after help information to the help information The person of helping, it sends response message by mobile intelligent terminal.Response message including aid personal information (such as name, sex, Telephone number etc.), response message text, picture, video, geographical position residing for aid, with the distance between seeking help person etc.. APP platforms can receive the response message of multiple different respondents.
S102.APP platforms are sorted the distance between seeking help person and each respondent from small to large, and sequence is tied Fruit feeds back to seeking help person's mobile intelligent terminal.APP platforms by the response message of respondent and each respondent and seeking help person it Between distance-taxis result be sent to the mobile intelligent terminal of seeking help person, seeking help person can according to the geographical position of respondent, most Short distance and information respond content etc. and determine that wherein one respondent is used as aid according to individual character hobby.
In specific implementation process, in step S101, the distance between seeking help person and n respondent can be using counting as follows Calculation mode is carried out, and is specially:
Note seeking help person is P0, n respondent is a1, a2..., an, seeking help person P0With shown n respondent a1, a2..., anIt Between distance be D (P0,a1), D (P0,a2) ..., D (P0,an);
Assuming that seeking help person P0Longitude be x0, latitude is y0, then P0Longitude and latitude coordinate at the earth's surface is P0(x0, y0);
Assuming that this n respondent a1, a2..., anLongitude and latitude coordinate at the earth's surface be respectively:a1(x1,y1), a2 (x2,y2) ..., an(xn,yn), wherein xiAnd yiIt is i-th of response person a respectivelyi(xi,yi) longitude and latitude, i=1,2 ..., n;As shown in Figures 2 and 3, it is P0(x0,y0) and each response person a1(x1,y1), a2(x2,y2) ..., an(xn,yn) in the position of earth's surface Schematic diagram.
Because the earth is too big, and seeking help person P0(x0,y0) and each neighbouring response person ai(xi,yi) (i=1,2 ..., n) two The distance between person is relatively just very short, therefore can preset a number r, with P0(x0,y0) it is that the center of circle, r are radius.
(I) is as D (P0,aiDuring)≤r, approximately straight line is regarded as in same horizontal line between the two, using Europe Family name range formula calculates P0(x0,y0) and each response person ai(xi,yiThe distance between) (i=1,2 ..., n), it calculates public Formula is:
(ii) as some response person ai(xi,yi) and P0(x0,y0) distance exceed default several r when, i.e. D (P0,ai) > r When, P0(x0,y0) and each response person ai(xi,yi) (i=1,2 ..., n) distance between the two uses and formula is calculated as below:
R is distance of the ground to the earth's core, i.e. earth radius.Fig. 3 gives seeking help person P0(x0,y0) and each response person ai (xi,yi) (i=1,2 ..., position n) at the earth's surface and its warp, latitude.
In step s 102, if within the time of a restriction, any one identical time point or any of which are very In short time interval, the respondent without two or more is simultaneously emitted by response message and reaches APP platforms, then utilizes Random sequence Dynamic comparison replacement sort algorithm is sorted from small to large to the distance between seeking help person and each respondent;
If within the time of a restriction, at one time point of identical or in very short time interval, there is two Individual or more than two respondents are simultaneously emitted by response message and reach APP platforms, then are staggered and compared using adjacent element odd even Sort algorithm to being sorted from small to large to the distance between seeking help person and each respondent;
Random sequence Dynamic comparison replacement sort method be for solving after deliverer sends information, one restriction when In, echo message be in chronological sequence order one by one, during which any one identical time point or any of which be very In short time interval, reached simultaneously without two or more response messages, the respondent thus produced in APP platforms The distance between with seeking help person, use variable m1, m2..., mnTo represent the distance between this n respondent and deliverer respectively;This A little distances are the numerals that some stochastic and dynamics are reached, by these stochastic and dynamics apart from Serial No. according to order from small to large It is ranked up.
Assuming that within the period of a restriction, any one identical time point or any of which are very short wherein In time interval, response message is simultaneously emitted by without two or more respondents, i.e., respondent's hair that APP platforms are received The response message gone out is that orderliness is sent one by one, is not at some time point while sending.Now Dynamic comparison displacement row Sequence algorithm is as follows:
1st step:Empty queue A [n] and B [n] that two spaces size is n+1 are set up, as shown in table 1:
A[0] A[1] A[2] A[3] A[k-1] A[k] A[k+1] A[n]
B[0] B[1] B[2] B[3] B[k-1] B[k] B[k+1] B[n]
Table 1 empty queue A and B
Agreement 1:Queue A and B first space A [0] and B [0] leave a blank, and do not fill element;B [0] is used for doing dynamic element displacement The interim spare space of process, A [1] is queue A header element space, and B [1] is queue B header element space;
Agreement 2:Queue A is used for storing original dynamic data mi(i=1,2 ..., n), queue B is used for storing by dynamic State data mi(i=1,2 ... n) are compared the new data sequence T sorted from small to large after displacementi(i=1,2 ..., N), wherein miIt is the real-time range between i-th bit respondent and seeking help person;
2nd step:When receiving the response message of first respondent, the 1st distance will be produced, that is, producing the 1st should The distance between the person of answering and deliverer, use variable m1Represent;Allow m1Direct enqueue A is stayed as header element according to 1, A of agreement [0] Sky, does not fill element, so A [1]=m1
Make T1=m1, T1Enqueue B is as header element, according to 1, B of agreement [1]=T1;As shown in table 2:
Table 2
3rd step:(1) when the response message for receiving the 2nd respondent, the 2nd will be produced between respondent and seeking help person Distance, use variable m2Represent, allow m2A join the team as tail element, now there is A [2]=m2
(2) T is made2=m2, allow T2Interim spare space B [0] in enqueue B, that is, have B [0]=T2, as shown in table 3:
Table 3
(3) to queue B, with the element T in current B [0] space2It is used as existing element T in base element, with queue B1Make The following operation compared and replaced:
If 1) T2≥T1, then B [2]=T is made2, now have:B [1]≤B [2], so existing element T in queue B1、T2 By order sequence from small to large;
If 2) T2≤T1, then following replacement operator is carried out:
Then B [1]≤B [2], makees following assignment:
Obtain T1≤T2, therefore obtained the element T in queue B1、T2Sorted by order from small to large, as shown in table 4:
Table 4
4th step:(1) receive the 3rd respondent and send response message, the 3rd will be produced between respondent and seeking help person Distance, use variable m3Represent, allow m3A join the team as tail element, now there is A [3]=m3
(2) T is made3=m3, allow T3Interim spare space B [0] in enqueue B, that is, have B [0]=T3, as shown in table 5:
Table 5
(3) to queue B, with the element T in current B [0] space3As base element, the current tail element from queue B T2Rise, use T3With the inverted order of existing element in queue B:T2、T1Between sequentially make following adjacent element two-by-two and progressively compare and replace Operation:
If T3≥T2, then B [3]=T is made3, now B [2]≤B [3], because existing element T in queue B2、T1It is to have arranged Good sequence, i.e. T1≤T2, that is, B [1]≤B [2], so there is B [1]≤B [2]≤B [3], then there is T1≤T2≤T3, so obtaining Element T in queue B1, T2, T3By order sequence from small to large;
If T3< T2, then need further to be compared and replaced as follows;
If T3≥T1, then have T1≤T3< T2.Because B [1]=T1, B [2]=T2, B [0]=T3, so in B [1] space Element T1It is motionless, it is necessary to T2, T3And its queue space at place carries out following replacement operator:
Then B [2] < B [3] are obtained, make following assignment:
Then T is obtained2< T3, therefore T1≤T2< T3, B [1]≤B [2] < B [3] are obtained, the element in this explanation queue B T1, T2, T3By order sequence from small to large;
If T3< T1, then have T3< T1≤T2, because B [1]=T1, B [2]=T2, B [0]=T3, so needing progress as follows Replacement operator:
Then B [1] < B [2]≤B [3] is obtained, makees following assignment:
Then T is obtained1≤T2< T3, the now element T in queue B1, T2, T3By order sequence from small to large, such as table Shown in 6:
Table 6
5th step:So proceed, it is assumed that be performed until after seeking help person sends help information number, existing k responses Person sends response message, and wherein the distance between i-th bit respondent and seeking help person is mi, miEnqueue A, and believe according to issue The time tandem of breath is joined the team, and should mutually have a sequence TiFor miThe new arrangement of one kind, meet order sequence from small to large, That is T1≤T2≤…≤Tk, i=1,2 ..., k, as shown in table 7:
Table 7
When+1 respondent of kth sends response message ,+1 distance of kth will be produced, i.e.+1 respondent of kth is with seeking help The distance between person, uses variable mk+1Represent.Allow mk+1A join the team as tail element, now there is A [k+1]=mk+1
Make Tk+1=mk+1, allow Tk+1Interim spare space B [0] in enqueue B, that is, have B [0]=Tk+1, as shown in table 8:
Table 8
To queue B, with the element T in current B [0] spacek+1As base element, the current tail element T from queue Bk Rise, with the inverted order with existing element in queue B:Tk, Tk-1..., T3, T2, T1Between sequentially make following adjacent element two-by-two progressively The operation compared and replaced:
If Tk+1≥Tk, then B [k+1]=T is madek+1, now have B [k]≤B [k+1], because existing element T in queue B1, T2, T3..., Tk-1, TkIt is sorted, i.e. T1≤T2≤T3≤…≤Tk-1≤Tk, that is, B [1]≤B [2]≤B [3] ≤ ...≤B [k-1]≤B [k], so B [1]≤B [2]≤B [3]≤...≤B [k-1]≤B [k]≤B [k+1], that is, there is T1≤T2≤ T3≤…≤Tk-1≤Tk≤Tk+1, then obtain the element T in queue B1, T2, T3..., Tk-1, Tk, Tk+1It is suitable by from small to large Sequence sorts.
If Tk+1< Tk, then need further to be compared and replaced as follows,
If Tk+1≥Tk-1, then have Tk-1≤Tk+1< Tk.Because B [k-1]=Tk-1, B [k]=Tk, B [0]=Tk+1, so allowing B Element T in [k-1] spacek-1It is motionless, it is necessary to Tk, Tk+1And its queue space at place carries out following replacement operator:
Then B [k] < B [k+1] are obtained, make following assignment:
Then T is obtainedk< Tk+1, therefore T1≤T2≤T3≤…≤Tk-1≤Tk< Tk+1, obtain B [1]≤B [2]≤B [3] ≤ ... the element T in≤B [k-1]≤B [k] < B [k+1], this explanation queue B1, T2, T3..., Tk-1, Tk, Tk+1By from small to large Order sequence.
If Tk+1< Tk-1, then have, Tk+1< Tk-1≤Tk, because B [k-1]=Tk-1, B [k]=Tk, B [0]=Tk+1, so needing Carry out following replacement operator:
Then B [k-1]≤B [k]≤B [k+1] is obtained, makees following assignment:
Then T is obtainedk-1< Tk≤Tk+1, therefore T1≤T2≤T3≤…≤Tk-1≤Tk< Tk+1, obtain B [1]≤B [2]≤B [3]≤... the element T in≤B [k-1] < B [k]≤B [k+1], this explanation, queue B1, T2, T3..., Tk-1, Tk, Tk+1By from small Sorted to big order, as shown in table 9:
Table 9
So proceed, until Tk+1< T2, and obtain T according to method above2, T3..., Tk-1, Tk, Tk+1 By order sequence from small to large.Then, it is only necessary to finally compare Tk+1And T1Size.
Make B [0]=Tk+1, it is discussed below two situations:
(I) if Tk+1≥T1, due to T2≤T3≤…≤Tk, so T1≤Tk+1≤T2≤T3≤…≤Tk.Again because B [k] =Tk, B [k-1]=Tk-1..., B [2]=T2, B [1]=T1, therefore following displacement can be made:
Then have B [1]≤B [2]≤B [3]≤...≤B [k-1] < B [k]≤B [k+1],
Then following assignment is remake:
Then there is T1≤T2≤T3≤…≤Tk-1≤Tk< Tk+1, the then element T in queue B1, T2, T3..., Tk-1, Tk, Tk+1By order sequence from small to large;
(ii) if Tk+1< T1, due to T1≤T2≤T3≤…≤Tk, so Tk+1< T1≤T2≤T3≤…≤Tk.And because For B [k]=Tk, B [k-1]=Tk-1..., B [2]=T2, B [1]=T1, therefore following displacement can be made:
Then have B [1]≤B [2]≤B [3]≤...≤B [k-1] < B [k]≤B [k+1],
Then following assignment is remake:
Then there is T1≤T2≤T3≤…≤Tk-1≤Tk< Tk+1, the then element T in queue B1, T2, T3..., Tk-1, Tk, Tk+1 By order sequence from small to large;
The time that the quantity of respondent and respondent carry out response is indefinite, then for seeking help person, The quantity n of respondent and receive time of response message and belong to a random sequence, the then seeking help person produced and response The distance between person sequence is also a random sequence, and is real-time random sequence.Above-mentioned sort algorithm is using two teams Adjust the distance sequence this real-time random sequence of row is ranked up, using queue A adjust the distance value according to generation time carry out storage with Sequence, queue B sorted from small to large by dynamic order method to the distance value produced in real time, solve in real time dynamically with The sequencing problem from small to large of machine sequence so that seeking help person real-time can obtain before the selection of one-to-one interactive dialogue is made To the collating sequence of the distance between seeking help person and each respondent, so as to provide accurate range information to seeking help person.
If at one time point of identical or in very short time interval, having two or more answer The person of answering is simultaneously emitted by response message, then is ranked up using the adjacent element odd even comparative sorting method that is staggered.
The adjacent element odd even comparative sorting method that is staggered is for solving after seeking help person sends information, interior at the same time Or very in short time interval, while reaching the response message of multidigit respondent, many are thus produced simultaneously in APP platforms Distance.Although these distances are also the numeral reached at random, because they are while reaching APP platforms, it is after arrival One considerable random static numeral, by being arranged apart from Serial No. according to order from small to large for these random statics Sequence, the adjacent element odd even comparative sorting method that is staggered is specially:
Assuming that within some identical time point or very short time interval, one, which has m respondents, sends simultaneously Response message is reached on APP platforms, uses variable S1, S2..., SmTo represent this m between respondent and seeking help person and distance;
1st step:Due to the distance between m respondents and seeking help person S1, S2..., SmIt is at the same time or almost same What one time produced, so S1, S2..., SmInitial configuration press any one sequence permutation, it is assumed that the sequence is initially just pressed S1, S2..., SmSequence;
2nd step, is divided to m to be discussed respectively for even number, two kinds of different situations of odd number below
(5) if m is even number
(I) is by sequence S1, S2..., SmFrom left to right adjacent element makes one group of number to (S two-by-twoi,Si+1) wherein, i= 1,2 ..., m-1, because m is even number, so just constitutingGroup is adjacent several right two-by-two;
(ii) to each group of number to (Si,Si+1) in two numbers carry out size comparison
If 5. Si≤Si+1, then keep several pairs of the order constant;
If 6. Si> Si+1, then several pairs of the order is exchanged, makes this several to be less than the number on the left side number on the right;
By above-mentioned processing more from left to right to two neighboring several sizes, S is obtained1, S2..., SmSequence is from left to right Adjacent element according to sorting from small to large two-by-two;
If now whole sequence S1, S2..., SmSort from small to large, then algorithm is terminated, and is otherwise transferred to next step (ⅲ);
(III) is to sequence S1, S2..., Sm, it is carried out in two steps:
5. by the 1st element S1With last element SmConstitute several right, then compare S1And SmSize;If S1≤Sm, Then keep S1And SmOrder it is constant;If S1> Sm, then S is exchanged1And SmPosition, make SmMake the 1st element, S of the sequence1 Make last element of the sequence;
6. from the 2nd element S2To second-to-last element Sm-1, element adjacent two-by-two is from left to right made into one group of number To (Si,Si+1), wherein i=2,3 ..., m-2, because m is even number, so just constitutingGroup is adjacent several right two-by-two;
(iv) to each group of number to (Si,Si+1) two numbers in (i=2,3 ..., m-2) carry out size comparison
If 7. Si≤Si+1, then keep several pairs of the order constant;
If 8. Si> Si+1, then several pairs of the order is exchanged, makes this several to be less than the number on the left side number on the right;
By the processing of (iv) from left to right to two neighboring several sizes, S is obtained1≤Sm, and S2, S3..., Sm-1Sequence from Left-to-right adjacent element two-by-two according to sorting from small to large.
If now whole sequence S1, S2..., SmSort from small to large, then algorithm is terminated, and otherwise returns to the 2nd step (1) (I) in restarts, and is so repeated, is performed until S1, S2..., SmUntill sorting from small to large, now, calculate Method will be terminated;
(6) if m is odd number
(I) is by sequence S1, S2..., SmFrom the 1st element S1Rise, from left to right adjacent element makes one group of number pair two-by-two (Si,Si+1), wherein, i=1,2 ..., m-2, because m is odd number, so the sequence is constitutedOrganize several right, S adjacent two-by-twom For surplus element, element-free can be organized pair;
(ii) to each group of number to (Si,Si+1) two numbers in (i=1,2 ..., m-2) carry out size comparison
If 1. Si≤Si+1, then keep several pairs of the order constant;
If 9. Si> Si+1, then several pairs of the order is exchanged, makes this several to be less than the number on the left side number on the right;
By the processing of (ii) from left to right to two neighboring several sizes, S is obtained1, S2..., Sm-1Sequence from left to right two Two adjacent elements according to sorting from small to large;
If now whole sequence S1, S2..., Sm-1, SmSort from small to large, then algorithm is terminated;Otherwise it is transferred to down One step (III);
(III) retains the 1st element S1It is motionless, from the 2nd element S2Rise, from left to right adjacent element makes one group two-by-two It is several to (Si,Si+1), wherein i=2,3 ..., m-1, because m is odd number, so can constituteGroup is adjacent several right two-by-two;
If 5. Si≤Si+1, then keep several pairs of the order constant;
If 6. Si> Si+1, then several pairs of the order is exchanged, makes this several to be less than the number on the left side number on the right;
By the processing of (III) from left to right to two neighboring several sizes, S is obtained2, S3..., SmSequence is from left to right two-by-two Adjacent element according to sorting from small to large;
If now whole sequence S1, S2..., SmSort from small to large, then algorithm is terminated;Otherwise the 2nd step is returned to (2) (I) in restarts, and is so repeated, is performed until S1, S2..., SmUntill sorting from small to large, now, calculate Method will be terminated.
If being sent in seeking help person a period of help information, there are some time points or very short time interval In only one of which respondent send response message, and also have in some time points or very short time interval has multiple simultaneously (at least more than two) respondent sends response message.For the ease of statement, " very short time interval " is just regarded as At one time point, may so occur following 4 kinds of situations after seeking help person sends help information:
Situation 1:Since first time point, there are one or more continuous time points (more than two continuous time points), Each time point only one of which respondent sends response message;Then followed by latter one time point, a time Point has multiple respondents (at least more than two respondents) to send response message simultaneously;
Situation 2:Since first time point, there are one or more continuous time points (more than two continuous time points), Each time point only one of which respondent sends response message;Multiple continuous time points are (at least then followed by behind More than two continuous time points), there are multiple respondents (at least two at each time point simultaneously in the plurality of continuous time point Above respondent) send response message;
Situation 3:First time point occurs having multiple respondents (at least more than two respondents) to send response simultaneously Information;Lighted from second time, back to back latter one or multiple continuous time points (more than two continuous time points), often Individual time point, only one of which respondents sent response message;
Situation 4:Since first time point, there are multiple continuous time points (at least more than two continuous time points) simultaneously There are multiple respondents (at least more than two respondents) to send response message;Then followed by latter one or multiple continuous At time point (more than two continuous time points), each time point only one of which respondent sends response message.
Sought help due to being sent in seeking help person the remaining time, no matter respondent is that occur in which way, i.e., either Send response message in a time point only one of which respondent, or have simultaneously a time point multiple respondents (refer to Rare more than two respondents) response message is sent, or both response situations alternately occur, and all easily know:Hereafter The response situation of respondent all will be above any one response situation for having occurred, be above response situation with Machine is repeated, and does not produce new response scene.Therefore, hereafter realization of the response situation of respondent to algorithm does not produce any Influence, therefore need not separately study.Therefore, we mainly solve:
(1) one or more continuous time points (more than two continuous time points), Mei Geshi have been lighted from first time Between put all only one of which respondents and send response message;Then followed by latter one time point, a time point is simultaneously There are multiple respondents (at least more than two respondents) to send response message;
(2) first time points occur having multiple respondents (at least more than two respondents) to send response letter simultaneously Breath;Lighted from second time, back to back latter one or multiple continuous time points (more than two continuous time points), each Time point, only one of which respondents sent response message;
(3) first time points occur having multiple respondents (at least more than two respondents) to send response letter simultaneously Breath;Second time point also occurs while there is multiple respondents (at least more than two respondents) to send response message;
Three of the above situation solve method be all:If one or more continuous time points (two continuous time points More than), each time point only one of which respondent sends response message, then using " random sequence Dynamic comparison replacement sort The sort method of algorithm " is sorted from small to large.If a time point occurs having multiple respondents (at least two simultaneously Above respondent) send response message, then carried out using the sort method of " adjacent element odd even be staggered comparative sorting method " from small To big sequence.Therefore, these three situations are either any this situation can all occurs:It is front and rear to there are two to arrange from small to large The queue of sequence, their progress are end to end, a new queue is then combined into, we will be carried out from small to the new queue To big sequence.Therefore, it is proposed that continuously comparing intersection insertion sort based on two multivalues for having been lined up sequence.
The queue that might as well assume above have k (k >=1 is positive integer, similarly hereinafter) number (be all respondent and seeking help person away from From):u1, u2..., uk, and sorted from small to large, that is, there is u1≤u2≤…≤uk.Queue below has l, and (l >=2 is just Integer, similarly hereinafter) number (being also all the distance of respondent and seeking help person), v1, v2..., vl, also sort, that is, have from small to large v1≤v2≤…≤vl, the two queues progress is end to end, and being combined into a new queue is:u1, u2..., uk, v1, v2..., vl.We will propose " continuously comparing intersection insertion sort based on two multivalues for having been lined up sequence " to solve below The queue u of Combination nova1, u2..., uk, v1, v2..., vl, its sequencing problem from small to large.The many of sequence are had been lined up based on two It is as follows that value continuously compares intersection insertion sort:
C [k+l] is lined up in foundation, and wherein C [0] does not fill element, stays to do the spare space of data exchange process.First allow u1, u2..., ukJoin the team C successively, then has:C [1]=u1, C [2]=u2..., C [k]=uk;Then allow:v1, v2..., vkEnter successively Team C, then has:C [k+1]=v1, C [k+2]=v2..., C [k+l]=vl.Therefore, we obtain a new queue:C [1]= u1, C [2]=u2..., C [k]=uk, C [k+1]=v1, C [k+2]=v2..., C [k+l]=vl, as shown in table 10.
C[0] C[1] C[2] ... C[k-1] C[k] C[k+1] C[k+1] ... C[k+1-1] C[k+1]
u1 u2 uk-1 uk v1 v2 vk+l-1 vk+l
Table 10
Two pointers i and j are defined, wherein 1≤i≤j-1, i+1≤j≤k+l.
(i) i=k, j=i+1 are originally made, compares C [i] and C [j] size
If 1. C [i]≤C [j], because C [i]=C [k]=uk, C [j]=C [i+1]=C [k+1]=v1, so there is uk ≤vl.Again because u1≤u2≤…≤uk, v1≤v2≤…≤vl, therefore have u1≤u2≤…≤uk≤v1≤v2≤…≤vl, i.e.,
C[1]≤C[2]≤…≤C[k-1]≤C[k]≤C[k+1]≤C[k+2]…≤C[k+l-1]C[k+l]
So, the element in queue C has sequenced sequence.
If 2. C [i] > C [j], make j=j+1
(ii) 2. going on always in (i) is repeated, until there is some t (k+1≤t≤k+l), making ought only j There is C [i]≤C [j]=C [t] during=t;And as i+1≤j < t, perseverance has C [i] > C [j].Then, following displacement is made:
Element variation in the queue C now obtained is as shown in table 11.
C[0] C[1] C[2] ... C[k-1] C[k] C[k+1] ... C[t-2] C[t-1] C[t] ... C[k+ l]
uk u1 u2 uk-1 v1 v2 vt-1 vt vk+l
Table 11
Last arrangement of elements is as shown in table 12 in queue C.
C[0] C[1] C[2] ... C[k-1] C[k] C[k+1] ... C[t-2] C[t-1] C[t] ... C[k+ l]
u1 u2 uk-1 v1 v2 vt-1 uk vt vk+l
Table 12
(iii) i=i-1, j=i+1 are made, (i) and (ii) are then repeated always;
(iv) (iii) is repeated, and untill being performed until i=1, algorithm terminates.Now, a new team is obtained in C Column element:w1, w2..., wk, wk+1, wk+2..., wk+1, its size of data according to sorting from small to large, i.e.,:C[1]≤C[2] ≤ ...≤C [k]≤C [k+1]≤C [k+2]≤...≤C [k+l], that is,:w1≤w2≤…≤wk≤wk+1≤wk+2≤…≤wk+l, As shown in table 13.
C[0] C[1] C[2] ... C[k-1] C[k] C[k+1] C[k+1] ... C[k+1-1] C[k+1]
w1 w2 wk-1 wk wk+1 wk+1 wk+l-1 wk+l
Table 13
These new queue element (QE)s:w1, w2..., wk, wk+1, wk+2..., wk+lIt is initial data arrangement in original queue C u1, u2..., uk, v1, v2..., vlIn a new arrangement.
The same or analogous part of same or analogous label correspondence;
Position relationship is used for being given for example only property explanation described in accompanying drawing, it is impossible to be interpreted as the limitation to this patent;It is aobvious So, the above embodiment of the present invention is only intended to clearly illustrate example of the present invention, and is not the reality to the present invention Apply the restriction of mode.For those of ordinary skill in the field, it can also make other on the basis of the above description Various forms of changes or variation.There is no necessity and possibility to exhaust all the enbodiments.All spirit in the present invention With any modifications, equivalent substitutions and improvements made within principle etc., it should be included in the protection domain of the claims in the present invention Within.

Claims (6)

1. a kind of daily emergent calling method based on random sequence sort algorithm, it is characterised in that including:
S1. the help information sent for seeking help person's mobile intelligent terminal, APP platforms receive the response message of respondent, and root According to the distance between the positional information calculation seeking help person between respondent and seeking help person and each respondent;
S2.APP platforms are sorted the distance between seeking help person and each respondent from small to large, and ranking results are fed back Give seeking help person's mobile intelligent terminal.
2. the daily emergent calling method according to claim 1 based on random sequence sort algorithm, it is characterised in that institute APP platforms in S2 are stated by concretely comprising the following steps that the distance between seeking help person and each respondent are sorted from small to large:
If within the time of a restriction, in any one identical time point or any of which very short time interval, not having There is two or more respondent to be simultaneously emitted by response message and reach APP platforms, then utilize random sequence Dynamic comparison Replacement sort algorithm is sorted from small to large to the distance between seeking help person and each respondent;
If one restriction time in, at one time point of identical or in very short time interval, have two or The more than two respondents of person are simultaneously emitted by response message and reach APP platforms, then are staggered comparative sorting using adjacent element odd even Algorithm is sorted from small to large to the distance between seeking help person and each respondent.
3. the daily emergent calling method according to claim 2 based on random sequence sort algorithm, it is characterised in that profit The tool of size sequence is carried out to the distance between seeking help person and each respondent with random sequence Dynamic comparison replacement sort algorithm Body step is as follows:
Assuming that APP platforms receive the response message of n respondents within the successively different time, variable m is used1, m2..., mnCome The distance between this n respondent and deliverer are represented respectively;
1st step:Set up empty queue A [n] and B [n] that two spaces size is n+1, queue A and B first space A [0] and B [0] Leave a blank, B [0] is used for doing the interim spare space of dynamic element replacement process, and A [1] is queue A header element space, and B [1] is Queue B header element space;Queue A is used for storing original dynamic data mi, queue B be used for store by dynamic data miEnter Row compares the new data sequence T sorted from small to large after displacementi, wherein i=1,2 ..., n;
2nd step:When receiving the response message of first respondent, by produce the 1st between respondent and deliverer away from From using variable m1Represent;Allow m1Direct enqueue A is used as header element, A [1]=m1
Make T1=m1, T1Enqueue B is used as header element, B [1]=T1
3rd step:The response message of the 2nd respondent is received, the distance between the 2nd respondent and deliverer will be produced, used Variable m2Represent, allow m2A join the team as tail element, now there is A [2]=m2
Make T2=m2, allow T2Interim spare space B [0] in enqueue B, that is, have B [0]=T2
To queue B, with the element T in current B [0] space2It is used as existing element T in base element, with queue B1Work compares as follows With the operation of displacement:
If 1) T2≥T1, then B [2]=T is made2, now have:B [1]≤B [2], so existing element T in queue B1、T2Press from It is small to be sorted to big order;
If 2) T2≤T1, then following replacement operator is carried out:
<mfenced open = "{" close = ""> <mtable> <mtr> <mtd> <mi>B</mi> <mo>&amp;lsqb;</mo> <mn>2</mn> <mo>&amp;rsqb;</mo> <mo>=</mo> <mi>B</mi> <mo>&amp;lsqb;</mo> <mn>1</mn> <mo>&amp;rsqb;</mo> <mo>=</mo> <msub> <mi>T</mi> <mn>1</mn> </msub> </mtd> </mtr> <mtr> <mtd> <mrow> <mi>B</mi> <mo>&amp;lsqb;</mo> <mn>1</mn> <mo>&amp;rsqb;</mo> <mo>=</mo> <mi>B</mi> <mo>&amp;lsqb;</mo> <mn>0</mn> <mo>&amp;rsqb;</mo> <mo>=</mo> <msub> <mi>T</mi> <mn>2</mn> </msub> </mrow> </mtd> </mtr> </mtable> </mfenced>
Then B [1]≤B [2], makees following assignment:
<mfenced open = "{" close = ""> <mtable> <mtr> <mtd> <msub> <mi>T</mi> <mn>1</mn> </msub> <mo>=</mo> <mi>B</mi> <mo>&amp;lsqb;</mo> <mn>1</mn> <mo>&amp;rsqb;</mo> </mtd> </mtr> <mtr> <mtd> <msub> <mi>T</mi> <mn>2</mn> </msub> <mo>=</mo> <mi>B</mi> <mo>&amp;lsqb;</mo> <mn>2</mn> <mo>&amp;rsqb;</mo> </mtd> </mtr> </mtable> </mfenced>
Obtain T1≤T2, therefore obtained the element T in queue B1、T2By order sequence from small to large;
4th step:Receive the 3rd respondent and send response message, the distance between the 3rd respondent and deliverer will be produced, Use variable m3Represent, allow m3A join the team as tail element, now there is A [3]=m3
Make T3=m3, allow T3Interim spare space B [0] in enqueue B, that is, have B [0]=T3
To queue B, with the element T in current B [0] space3As base element, the current tail element T from queue B2Rise, use T3With the inverted order of existing element in queue B:T2、T1Between sequentially make the following operation that adjacent element progressively compares and replaced two-by-two:
If T3≥T2, then B [3]=T is made3, now B [2]≤B [3], because existing element T in queue B2、T1It is to have sequenced sequence , i.e. T1≤T2, that is, B [1]≤B [2], so there is B [1]≤B [2]≤B [3], then there is T1≤T2≤T3, so obtaining queue Element T in B1, T2, T3By order sequence from small to large;
If T3< T2, then need further to be compared and replaced as follows;
If T3≥T1, then have T1≤T3< T2;Because B [1]=T1, B [2]=T2, B [0]=T3, so the element in B [1] space T1It is motionless, it is necessary to T2, T3And its queue space at place carries out following replacement operator:
<mfenced open = "{" close = ""> <mtable> <mtr> <mtd> <mi>B</mi> <mo>&amp;lsqb;</mo> <mn>3</mn> <mo>&amp;rsqb;</mo> <mo>=</mo> <mi>B</mi> <mo>&amp;lsqb;</mo> <mn>2</mn> <mo>&amp;rsqb;</mo> <mo>=</mo> <msub> <mi>T</mi> <mn>2</mn> </msub> </mtd> </mtr> <mtr> <mtd> <mrow> <mi>B</mi> <mo>&amp;lsqb;</mo> <mn>2</mn> <mo>&amp;rsqb;</mo> <mo>=</mo> <mi>B</mi> <mo>&amp;lsqb;</mo> <mn>0</mn> <mo>&amp;rsqb;</mo> <mo>=</mo> <msub> <mi>T</mi> <mn>3</mn> </msub> </mrow> </mtd> </mtr> </mtable> </mfenced>
Then B [2] < B [3] are obtained, make following assignment:
<mfenced open = "{" close = ""> <mtable> <mtr> <mtd> <msub> <mi>T</mi> <mn>2</mn> </msub> <mo>=</mo> <mi>B</mi> <mo>&amp;lsqb;</mo> <mn>2</mn> <mo>&amp;rsqb;</mo> </mtd> </mtr> <mtr> <mtd> <msub> <mi>T</mi> <mn>3</mn> </msub> <mo>=</mo> <mi>B</mi> <mo>&amp;lsqb;</mo> <mn>3</mn> <mo>&amp;rsqb;</mo> </mtd> </mtr> </mtable> </mfenced>
Then T is obtained2< T3, therefore T1≤T2< T3, B [1]≤B [2] < B [3] are obtained, the element T in this explanation queue B1, T2, T3By order sequence from small to large;
If T3< T1, then have T3< T1≤T2, because B [1]=T1, B [2]=T2, B [0]=T3, so needing to be replaced as follows Operation:
<mfenced open = "{" close = ""> <mtable> <mtr> <mtd> <mi>B</mi> <mo>&amp;lsqb;</mo> <mn>3</mn> <mo>&amp;rsqb;</mo> <mo>=</mo> <mi>B</mi> <mo>&amp;lsqb;</mo> <mn>2</mn> <mo>&amp;rsqb;</mo> <mo>=</mo> <msub> <mi>T</mi> <mn>2</mn> </msub> </mtd> </mtr> <mtr> <mtd> <mrow> <mi>B</mi> <mo>&amp;lsqb;</mo> <mn>2</mn> <mo>&amp;rsqb;</mo> <mo>=</mo> <mi>B</mi> <mo>&amp;lsqb;</mo> <mn>1</mn> <mo>&amp;rsqb;</mo> <mo>=</mo> <msub> <mi>T</mi> <mn>1</mn> </msub> </mrow> </mtd> </mtr> <mtr> <mtd> <mrow> <mi>B</mi> <mo>&amp;lsqb;</mo> <mn>1</mn> <mo>&amp;rsqb;</mo> <mo>=</mo> <mi>B</mi> <mo>&amp;lsqb;</mo> <mn>0</mn> <mo>&amp;rsqb;</mo> <mo>=</mo> <msub> <mi>T</mi> <mn>3</mn> </msub> </mrow> </mtd> </mtr> </mtable> </mfenced>
Then B [1] < B [2]≤B [3] is obtained, makees following assignment:
<mfenced open = "{" close = ""> <mtable> <mtr> <mtd> <msub> <mi>T</mi> <mn>1</mn> </msub> <mo>=</mo> <mi>B</mi> <mo>&amp;lsqb;</mo> <mn>1</mn> <mo>&amp;rsqb;</mo> </mtd> </mtr> <mtr> <mtd> <msub> <mi>T</mi> <mn>2</mn> </msub> <mo>=</mo> <mi>B</mi> <mo>&amp;lsqb;</mo> <mn>2</mn> <mo>&amp;rsqb;</mo> </mtd> </mtr> <mtr> <mtd> <msub> <mi>T</mi> <mn>3</mn> </msub> <mo>=</mo> <mi>B</mi> <mo>&amp;lsqb;</mo> <mn>3</mn> <mo>&amp;rsqb;</mo> </mtd> </mtr> </mtable> </mfenced>
Then T is obtained1≤T2< T3, the now element T in queue B1, T2, T3By order sequence from small to large;
5th step:So proceed, it is assumed that be performed until after seeking help person sends help information number, existing k respondents hair Response message is sent, wherein the distance between i-th bit respondent and seeking help person is mi, miEnqueue A, and according to releasing news Time tandem is joined the team, and should mutually have a sequence TiFor miThe new arrangement of one kind, meet order sequence from small to large, i.e. T1 ≤T2≤…≤Tk, i=1,2 ..., k;
When+1 respondent of kth sends response message, will produce+1 distance of kth, i.e.+1 respondent of kth and seeking help person it Between distance, use variable mk+1Represent
Allow mk+1A join the team as tail element, now there is A [k+1]=mk+1
Make Tk+1=mk+1, allow Tk+1Interim spare space B [0] in enqueue B, that is, have B [0]=Tk+1
To queue B, with the element T in current B [0] spacek+1As base element, the current tail element T from queue BkRise, use With the inverted order of existing element in queue B:Tk, Tk-1..., T3, T2, T1Between sequentially make following adjacent element two-by-two progressively compare and The operation of displacement:
If Tk+1≥Tk, then B [k+1]=T is madek+1, now have B [k]≤B [k+1], because existing element T in queue B1, T2, T3..., Tk-1, TkIt is sorted, i.e. T1≤T2≤T3≤…≤Tk-1≤Tk, that is, B [1]≤B [2]≤B [3]≤...≤ B [k-1]≤B [k], so B [1]≤B [2]≤B [3]≤...≤B [k-1]≤B [k]≤B [k+1], that is, have
T1≤T2≤T3≤…≤Tk-1≤Tk≤Tk+1, then obtain the element T in queue B1, T2, T3..., Tk-1, Tk, Tk+1By from It is small to be sorted to big order
If Tk+1< Tk, then need further to be compared and replaced as follows,
If Tk+1≥Tk-1, then have Tk-1≤Tk+1< Tk
Because B [k-1]=Tk-1, B [k]=Tk, B [0]=Tk+1, so the element T allowed in B [k-1] spacek-1It is motionless, it is necessary to right Tk, Tk+1And its queue space at place carries out following replacement operator:
<mfenced open = "{" close = ""> <mtable> <mtr> <mtd> <mi>B</mi> <mo>&amp;lsqb;</mo> <mi>k</mi> <mo>+</mo> <mn>1</mn> <mo>&amp;rsqb;</mo> <mo>=</mo> <mi>B</mi> <mo>&amp;lsqb;</mo> <mi>k</mi> <mo>&amp;rsqb;</mo> <mo>=</mo> <msub> <mi>T</mi> <mi>k</mi> </msub> </mtd> </mtr> <mtr> <mtd> <mrow> <mi>B</mi> <mo>&amp;lsqb;</mo> <mi>k</mi> <mo>&amp;rsqb;</mo> <mo>=</mo> <mi>B</mi> <mo>&amp;lsqb;</mo> <mn>0</mn> <mo>&amp;rsqb;</mo> <mo>=</mo> <msub> <mi>T</mi> <mrow> <mi>k</mi> <mo>+</mo> <mn>1</mn> </mrow> </msub> </mrow> </mtd> </mtr> </mtable> </mfenced>
Then B [k] < B [k+1] are obtained, make following assignment:
<mfenced open = "{" close = ""> <mtable> <mtr> <mtd> <msub> <mi>T</mi> <mi>k</mi> </msub> <mo>=</mo> <mi>B</mi> <mo>&amp;lsqb;</mo> <mi>k</mi> <mo>&amp;rsqb;</mo> </mtd> </mtr> <mtr> <mtd> <msub> <mi>T</mi> <mrow> <mi>k</mi> <mo>+</mo> <mn>1</mn> </mrow> </msub> <mo>=</mo> <mi>B</mi> <mo>&amp;lsqb;</mo> <mi>k</mi> <mo>+</mo> <mn>1</mn> <mo>&amp;rsqb;</mo> </mtd> </mtr> </mtable> </mfenced>
Then T is obtainedk< Tk+1, therefore T1≤T2≤T3≤…≤Tk-1≤Tk< Tk+1, obtain B [1]≤B [2]≤B [3]≤...≤ Element T in B [k-1]≤B [k] < B [k+1], this explanation queue B1, T2, T3..., Tk-1, Tk, Tk+1By order from small to large Sequence;
If Tk+1< Tk-1, then have, Tk+1< Tk-1≤Tk, because B [k-1]=Tk-1, B [k]=Tk, B [0]=Tk+1, so need into The following replacement operator of row:
<mfenced open = "{" close = ""> <mtable> <mtr> <mtd> <mi>B</mi> <mo>&amp;lsqb;</mo> <mi>k</mi> <mo>+</mo> <mn>1</mn> <mo>&amp;rsqb;</mo> <mo>=</mo> <mi>B</mi> <mo>&amp;lsqb;</mo> <mi>k</mi> <mo>&amp;rsqb;</mo> <mo>=</mo> <msub> <mi>T</mi> <mi>k</mi> </msub> </mtd> </mtr> <mtr> <mtd> <mrow> <mi>B</mi> <mo>&amp;lsqb;</mo> <mi>k</mi> <mo>&amp;rsqb;</mo> <mo>=</mo> <mi>B</mi> <mo>&amp;lsqb;</mo> <mi>k</mi> <mo>-</mo> <mn>1</mn> <mo>&amp;rsqb;</mo> <mo>=</mo> <msub> <mi>T</mi> <mrow> <mi>k</mi> <mo>-</mo> <mn>1</mn> </mrow> </msub> </mrow> </mtd> </mtr> <mtr> <mtd> <mrow> <mi>B</mi> <mo>&amp;lsqb;</mo> <mi>k</mi> <mo>-</mo> <mn>1</mn> <mo>&amp;rsqb;</mo> <mo>=</mo> <mi>B</mi> <mo>&amp;lsqb;</mo> <mn>0</mn> <mo>&amp;rsqb;</mo> <mo>=</mo> <msub> <mi>T</mi> <mrow> <mi>k</mi> <mo>+</mo> <mn>1</mn> </mrow> </msub> </mrow> </mtd> </mtr> </mtable> </mfenced>
Then B [k-1]≤B [k]≤B [k+1] is obtained, makees following assignment:
<mfenced open = "{" close = ""> <mtable> <mtr> <mtd> <msub> <mi>T</mi> <mrow> <mi>k</mi> <mo>-</mo> <mn>1</mn> </mrow> </msub> <mo>=</mo> <mi>B</mi> <mo>&amp;lsqb;</mo> <mi>k</mi> <mo>-</mo> <mn>1</mn> <mo>&amp;rsqb;</mo> </mtd> </mtr> <mtr> <mtd> <msub> <mi>T</mi> <mi>k</mi> </msub> <mo>=</mo> <mi>B</mi> <mo>&amp;lsqb;</mo> <mi>k</mi> <mo>&amp;rsqb;</mo> </mtd> </mtr> <mtr> <mtd> <msub> <mi>T</mi> <mrow> <mi>k</mi> <mo>+</mo> <mn>1</mn> </mrow> </msub> <mo>=</mo> <mi>B</mi> <mo>&amp;lsqb;</mo> <mi>k</mi> <mo>+</mo> <mn>1</mn> <mo>&amp;rsqb;</mo> </mtd> </mtr> </mtable> </mfenced>
Then T is obtainedk-1< Tk≤Tk+1, therefore T1≤T2≤T3≤…≤Tk-1≤Tk< Tk+1, obtain B [1]≤B [2]≤B [3] ≤ ... the element T in≤B [k-1] < B [k]≤B [k+1], this explanation, queue B1, T2, T3..., Tk-1, Tk, Tk+1By from it is small to Big order sequence;
So proceed, until Tk+1< T2, and obtain T according to method above2, T3..., Tk-1, Tk, Tk+1Press from It is small to be sorted to big order;Then, it is only necessary to finally compare Tk+1And T1Size;
Make B [0]=Tk+1, it is discussed below two situations:
(I) if Tk+1≥T1, due to T2≤T3≤…≤Tk, so T1≤Tk+1≤T2≤T3≤…≤Tk;And because B [k]= Tk, B [k-1]=Tk-1..., B [2]=T2, B [1]=T1, therefore following displacement can be made:
<mfenced open = "{" close = ""> <mtable> <mtr> <mtd> <mi>B</mi> <mo>&amp;lsqb;</mo> <mi>k</mi> <mo>+</mo> <mn>1</mn> <mo>&amp;rsqb;</mo> <mo>=</mo> <mi>B</mi> <mo>&amp;lsqb;</mo> <mi>k</mi> <mo>&amp;rsqb;</mo> <mo>=</mo> <msub> <mi>T</mi> <mi>k</mi> </msub> </mtd> </mtr> <mtr> <mtd> <mrow> <mi>B</mi> <mo>&amp;lsqb;</mo> <mi>k</mi> <mo>&amp;rsqb;</mo> <mo>=</mo> <mi>B</mi> <mo>&amp;lsqb;</mo> <mi>k</mi> <mo>-</mo> <mn>1</mn> <mo>&amp;rsqb;</mo> <mo>=</mo> <msub> <mi>T</mi> <mrow> <mi>k</mi> <mo>-</mo> <mn>1</mn> </mrow> </msub> </mrow> </mtd> </mtr> <mtr> <mtd> <mo>...</mo> </mtd> </mtr> <mtr> <mtd> <mi>B</mi> <mo>&amp;lsqb;</mo> <mn>3</mn> <mo>&amp;rsqb;</mo> <mo>=</mo> <mi>B</mi> <mo>&amp;lsqb;</mo> <mn>2</mn> <mo>&amp;rsqb;</mo> <mo>=</mo> <msub> <mi>T</mi> <mn>2</mn> </msub> </mtd> </mtr> <mtr> <mtd> <mrow> <mi>B</mi> <mo>&amp;lsqb;</mo> <mn>2</mn> <mo>&amp;rsqb;</mo> <mo>=</mo> <mi>B</mi> <mo>&amp;lsqb;</mo> <mn>0</mn> <mo>&amp;rsqb;</mo> <mo>=</mo> <msub> <mi>T</mi> <mrow> <mi>k</mi> <mo>+</mo> <mn>1</mn> </mrow> </msub> </mrow> </mtd> </mtr> <mtr> <mtd> <mrow> <mi>B</mi> <mo>&amp;lsqb;</mo> <mn>1</mn> <mo>&amp;rsqb;</mo> <mo>=</mo> <msub> <mi>T</mi> <mn>1</mn> </msub> </mrow> </mtd> </mtr> </mtable> </mfenced>
Then have B [1]≤B [2]≤B [3]≤...≤B [k-1] < B [k]≤B [k+1],
Then following assignment is remake:
<mfenced open = "{" close = ""> <mtable> <mtr> <mtd> <msub> <mi>T</mi> <mrow> <mi>k</mi> <mo>+</mo> <mn>1</mn> </mrow> </msub> <mo>=</mo> <mi>B</mi> <mo>&amp;lsqb;</mo> <mi>k</mi> <mo>+</mo> <mn>1</mn> <mo>&amp;rsqb;</mo> </mtd> </mtr> <mtr> <mtd> <msub> <mi>T</mi> <mi>k</mi> </msub> <mo>=</mo> <mi>B</mi> <mo>&amp;lsqb;</mo> <mi>k</mi> <mo>&amp;rsqb;</mo> </mtd> </mtr> <mtr> <mtd> <mo>...</mo> </mtd> </mtr> <mtr> <mtd> <msub> <mi>T</mi> <mn>3</mn> </msub> <mo>=</mo> <mi>B</mi> <mo>&amp;lsqb;</mo> <mn>3</mn> <mo>&amp;rsqb;</mo> </mtd> </mtr> <mtr> <mtd> <msub> <mi>T</mi> <mn>2</mn> </msub> <mo>=</mo> <mi>B</mi> <mo>&amp;lsqb;</mo> <mn>2</mn> <mo>&amp;rsqb;</mo> </mtd> </mtr> <mtr> <mtd> <msub> <mi>T</mi> <mn>1</mn> </msub> <mo>=</mo> <mi>B</mi> <mo>&amp;lsqb;</mo> <mn>1</mn> <mo>&amp;rsqb;</mo> </mtd> </mtr> </mtable> </mfenced>
Then there is T1≤T2≤T3≤…≤Tk-1≤Tk≤Tk+1, the then element T in queue B1, T2, T3..., Tk-1, Tk, Tk+1By from It is small to be sorted to big order;
(ii) if Tk+1< T1, due to T1≤T2≤T3≤…≤Tk, so Tk+1< T1≤T2≤T3≤…≤Tk
Again because B [k]=Tk, B [k-1]=Tk-1..., B [2]=T2, B [1]=T1, therefore following displacement can be made:
<mfenced open = "{" close = ""> <mtable> <mtr> <mtd> <mi>B</mi> <mo>&amp;lsqb;</mo> <mi>k</mi> <mo>+</mo> <mn>1</mn> <mo>&amp;rsqb;</mo> <mo>=</mo> <mi>B</mi> <mo>&amp;lsqb;</mo> <mi>k</mi> <mo>&amp;rsqb;</mo> <mo>=</mo> <msub> <mi>T</mi> <mi>k</mi> </msub> </mtd> </mtr> <mtr> <mtd> <mrow> <mi>B</mi> <mo>&amp;lsqb;</mo> <mi>k</mi> <mo>&amp;rsqb;</mo> <mo>=</mo> <mi>B</mi> <mo>&amp;lsqb;</mo> <mi>k</mi> <mo>-</mo> <mn>1</mn> <mo>&amp;rsqb;</mo> <mo>=</mo> <msub> <mi>T</mi> <mrow> <mi>k</mi> <mo>-</mo> <mn>1</mn> </mrow> </msub> </mrow> </mtd> </mtr> <mtr> <mtd> <mo>...</mo> </mtd> </mtr> <mtr> <mtd> <mi>B</mi> <mo>&amp;lsqb;</mo> <mn>3</mn> <mo>&amp;rsqb;</mo> <mo>=</mo> <mi>B</mi> <mo>&amp;lsqb;</mo> <mn>2</mn> <mo>&amp;rsqb;</mo> <mo>=</mo> <msub> <mi>T</mi> <mn>2</mn> </msub> </mtd> </mtr> <mtr> <mtd> <mrow> <mi>B</mi> <mo>&amp;lsqb;</mo> <mn>2</mn> <mo>&amp;rsqb;</mo> <mo>=</mo> <mi>B</mi> <mo>&amp;lsqb;</mo> <mn>1</mn> <mo>&amp;rsqb;</mo> <mo>=</mo> <msub> <mi>T</mi> <mn>1</mn> </msub> </mrow> </mtd> </mtr> <mtr> <mtd> <mrow> <mi>B</mi> <mo>&amp;lsqb;</mo> <mn>1</mn> <mo>&amp;rsqb;</mo> <mo>=</mo> <mi>B</mi> <mo>&amp;lsqb;</mo> <mn>0</mn> <mo>&amp;rsqb;</mo> <mo>=</mo> <msub> <mi>T</mi> <mrow> <mi>k</mi> <mo>+</mo> <mn>1</mn> </mrow> </msub> </mrow> </mtd> </mtr> </mtable> </mfenced>
Then have B [1]≤B [2]≤B [3]≤...≤B [k-1] < B [k]≤B [k+1];
Then following assignment is remake:
<mrow> <mfenced open = "{" close = ""> <mtable> <mtr> <mtd> <msub> <mi>T</mi> <mrow> <mi>k</mi> <mo>+</mo> <mn>1</mn> </mrow> </msub> <mo>=</mo> <mi>B</mi> <mo>&amp;lsqb;</mo> <mi>k</mi> <mo>+</mo> <mn>1</mn> <mo>&amp;rsqb;</mo> </mtd> </mtr> <mtr> <mtd> <msub> <mi>T</mi> <mi>k</mi> </msub> <mo>=</mo> <mi>B</mi> <mo>&amp;lsqb;</mo> <mi>k</mi> <mo>&amp;rsqb;</mo> </mtd> </mtr> <mtr> <mtd> <mo>...</mo> </mtd> </mtr> <mtr> <mtd> <msub> <mi>T</mi> <mn>3</mn> </msub> <mo>=</mo> <mi>B</mi> <mo>&amp;lsqb;</mo> <mn>3</mn> <mo>&amp;rsqb;</mo> </mtd> </mtr> <mtr> <mtd> <msub> <mi>T</mi> <mn>2</mn> </msub> <mo>=</mo> <mi>B</mi> <mo>&amp;lsqb;</mo> <mn>2</mn> <mo>&amp;rsqb;</mo> </mtd> </mtr> <mtr> <mtd> <msub> <mi>T</mi> <mn>1</mn> </msub> <mo>=</mo> <mi>B</mi> <mo>&amp;lsqb;</mo> <mn>1</mn> <mo>&amp;rsqb;</mo> </mtd> </mtr> </mtable> </mfenced> <mo>;</mo> </mrow>
Then there is T1≤T2≤T3≤…≤Tk-1≤Tk< Tk+1, the then element T in queue B1, T2, T3..., Tk-1, Tk, Tk+1By from It is small to be sorted to big order.
4. the daily emergent calling method according to claim 2 based on random sequence sort algorithm, it is characterised in that profit The comparative sorting algorithm that is staggered with adjacent element odd even is sorted from small to large to the distance between seeking help person and each respondent Comprise the following steps that:
Assuming that within some identical time point or very short time interval, a shared m respondents send response simultaneously Information is reached on APP platforms, uses variable S1, S2..., SmTo represent this m between respondent and deliverer and distance;
1st step:Due to the distance between m respondents and seeking help person S1, S2..., SmIt is at the same time or almost same What the time produced, so S1, S2..., SmInitial configuration press any one sequence permutation, it is assumed that the sequence initially just press S1, S2..., SmSequence;
2nd step, is divided to m to be discussed respectively for even number, two kinds of different situations of odd number below
(1) if m is even number
(I) is by sequence S1, S2..., SmFrom left to right adjacent element makes one group of number to (S two-by-twoi,Si+1) wherein, i=1, 2 ..., m-1, because m is even number, so just constitutingGroup is adjacent several right two-by-two;
(ii) to each group of number to (Si,Si+1) in two numbers carry out size comparison
If 1. Si≤Si+1, then keep several pairs of the order constant;
If 2. Si> Si+1, then several pairs of the order is exchanged, makes this several to be less than the number on the left side number on the right;
By above-mentioned processing more from left to right to two neighboring several sizes, S is obtained1, S2..., SmSequence is from left to right two-by-two Adjacent element according to sorting from small to large;
If now whole sequence S1, S2..., SmSort from small to large, then algorithm is terminated, and is otherwise transferred to next step (III);
(III) is to sequence S1, S2..., Sm, it is carried out in two steps:
1. by the 1st element S1With last element SmConstitute several right, then compare S1And SmSize;If S1≤Sm, then protect Hold S1And SmOrder it is constant;If S1> Sm, then S is exchanged1And SmPosition, make SmMake the 1st element, S of the sequence1Make Last element of the sequence;
2. from the 2nd element S2To second-to-last element Sm-1, element adjacent two-by-two is from left to right made into one group of number to (Si, Si+1), wherein i=2,3 ..., m-2, because m is even number, so just constitutingGroup is adjacent several right two-by-two;
(iv) to each group of number to (Si,Si+1) in two numbers carry out size comparison, wherein i=2,3 ..., m-2, if 1. Si≤ Si+1, then keep several pairs of the order constant;
If 2. Si> Si+1, then several pairs of the order is exchanged, makes this several to be less than the number on the left side number on the right;
By the processing of (iv) from left to right to two neighboring several sizes, S is obtained1≤Sm, and S2, S3..., Sm-1Sequence from a left side to Right adjacent element two-by-two according to sorting from small to large;
If now whole sequence S1, S2..., SmSort from small to large, then algorithm is terminated, and is otherwise returned in the 2nd step (1) (I) restart, be so repeated, be performed until S1, S2..., SmUntill sorting from small to large, now, algorithm will eventually Only;
(2) if m is odd number
(I) is by sequence S1, S2..., SmFrom the 1st element S1Rise, from left to right adjacent element makes one group of number to (S two-by-twoi, Si+1), wherein, i=1,2 ..., m-2, because m is odd number, so the sequence is constitutedOrganize several right, S adjacent two-by-twomIt is surplus Remaining element, element-free can be organized pair;
(ii) to each group of number to (Si,Si+1) in two numbers carry out size comparison, wherein i=1,2 ..., m-2, if 1. Si≤ Si+1, then keep several pairs of the order constant;
If 3. Si> Si+1, then several pairs of the order is exchanged, makes this several to be less than the number on the left side number on the right;
By the processing of (ii) from left to right to two neighboring several sizes, S is obtained1, S2..., Sm-1Sequence from left to right two two-phase Adjacent element according to sorting from small to large;
If now whole sequence S1, S2..., Sm-1, SmSort from small to large, then algorithm is terminated;Otherwise it is transferred to next step (ⅲ);
(III) retains the 1st element S1It is motionless, from the 2nd element S2Rise, from left to right adjacent element makes one group of number pair two-by-two (Si,Si+1), wherein i=2,3 ..., m-1, because m is odd number, so can constituteGroup is adjacent several right two-by-two;
If 1. Si≤Si+1, then keep several pairs of the order constant;
If 2. Si> Si+1, then several pairs of the order is exchanged, makes this several to be less than the number on the left side number on the right;
By the processing of (III) from left to right to two neighboring several sizes, S is obtained2, S3..., SmSequence is from left to right adjacent two-by-two Element according to sorting from small to large;
If now whole sequence S1, S2..., SmSort from small to large, then algorithm is terminated;Otherwise return in the 2nd step (2) (I) restart, be so repeated, be performed until S1, S2..., SmUntill sorting from small to large, now, algorithm will eventually Only.
CN201710197953.5A 2017-03-29 2017-03-29 A kind of daily emergent calling method based on random sequence sort algorithm Pending CN107133899A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN201710197953.5A CN107133899A (en) 2017-03-29 2017-03-29 A kind of daily emergent calling method based on random sequence sort algorithm

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201710197953.5A CN107133899A (en) 2017-03-29 2017-03-29 A kind of daily emergent calling method based on random sequence sort algorithm

Publications (1)

Publication Number Publication Date
CN107133899A true CN107133899A (en) 2017-09-05

Family

ID=59714909

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201710197953.5A Pending CN107133899A (en) 2017-03-29 2017-03-29 A kind of daily emergent calling method based on random sequence sort algorithm

Country Status (1)

Country Link
CN (1) CN107133899A (en)

Citations (7)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN102884816A (en) * 2011-12-30 2013-01-16 华为技术有限公司 Help-seeking method, apparatus, and system based on location-based service
CN102984650A (en) * 2012-11-16 2013-03-20 广东欧珀移动通信有限公司 Method of help system achieving help
KR20130047478A (en) * 2011-10-31 2013-05-08 대덕위즈주식회사 System and method for location based emergency call and wearable phone for the same
CN105391775A (en) * 2015-10-19 2016-03-09 上海救要救信息科技有限公司 Interactive help-seeking and responding method and system
CN105407456A (en) * 2015-10-22 2016-03-16 上海救要救信息科技有限公司 Method and system used for processing help-seeking information
KR20160070503A (en) * 2014-12-10 2016-06-20 한국정보공학 주식회사 Method and system for providing a position of co-operated firemen by using a wireless communication, method for displaying a position of co-operated firefighter, and fire hat for performing the method
CN106231076A (en) * 2016-07-19 2016-12-14 北京中宏佳润信息科技有限公司 Mobile salvage system and method

Patent Citations (7)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
KR20130047478A (en) * 2011-10-31 2013-05-08 대덕위즈주식회사 System and method for location based emergency call and wearable phone for the same
CN102884816A (en) * 2011-12-30 2013-01-16 华为技术有限公司 Help-seeking method, apparatus, and system based on location-based service
CN102984650A (en) * 2012-11-16 2013-03-20 广东欧珀移动通信有限公司 Method of help system achieving help
KR20160070503A (en) * 2014-12-10 2016-06-20 한국정보공학 주식회사 Method and system for providing a position of co-operated firemen by using a wireless communication, method for displaying a position of co-operated firefighter, and fire hat for performing the method
CN105391775A (en) * 2015-10-19 2016-03-09 上海救要救信息科技有限公司 Interactive help-seeking and responding method and system
CN105407456A (en) * 2015-10-22 2016-03-16 上海救要救信息科技有限公司 Method and system used for processing help-seeking information
CN106231076A (en) * 2016-07-19 2016-12-14 北京中宏佳润信息科技有限公司 Mobile salvage system and method

Non-Patent Citations (2)

* Cited by examiner, † Cited by third party
Title
庞素琳等: "多主体协同治理下城市密集建筑群火灾风险管理与应用", 《管理评论》 *
徐明远等: "《Java常用算法手册》", 31 July 2014 *

Similar Documents

Publication Publication Date Title
CN107071160A (en) A kind of emergent calling method based on mobile intelligent terminal
CN110163663A (en) Event gallery based on geographical location
CN104573981A (en) Activity management method and management server
CN104536730A (en) Interface display method and intelligent terminal
CN104023109A (en) Incoming call prompt method and device as well as incoming call classifying method and device
CN103036953B (en) A kind ofly provide the method and apparatus of dynamic location information for user
CN107180071A (en) A kind of big data risk identification based on mobile intelligent terminal, early warning and emergent platform
CN103916306B (en) The method and apparatus for realizing instant messaging
CN107911531A (en) A kind of a key method for seeking help and platform based on mobile intelligent terminal
CN110392446B (en) Method for interaction between terminal and virtual assistant server
CN105915354A (en) Group traveling communication method, server, terminal and system
CN109033376A (en) A kind of application platform of decentralization
CN107438138A (en) A kind of channel touches the recommendation method and device up to mode
CN107908636A (en) A kind of method that mankind&#39;s activity spatiotemporal mode is excavated using social media
CN107133899A (en) A kind of daily emergent calling method based on random sequence sort algorithm
CN105872246A (en) Anti-addiction method, anti-addiction device and terminal
CN109472416A (en) The indoor paths planning method and device, client extracted based on automatic road net data
CN105992145A (en) Location information sharing method and system
CN107426303A (en) A kind of information processing method and device
CN106231426A (en) Control method, intelligent television and the mobile terminal that information shows
Watson Tsunami alert: The mobile phone difference
CN107818069A (en) Data processing method and system
CN109243290B (en) Footprint display generation method and system based on offline activities
CN101772197A (en) Method, system and base station for building colony group calling
Johnston Sustainability, Engineering, and Australian Academe

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