Questions tagged [lexicographic]

lexicographic or lexicographical order is a generalization of the way the alphabetical order of words is based on the alphabetical order of their component letters.

Definition:

Given two partially ordered sets A and B, the lexicographical order on the Cartesian product A × B is defined as

(a,b) ≤ (a′,b′) if and only if a < a′ or (a = a′ and b ≤ b′).

The result is a partial order. If A and B are totally ordered, then the result is a total order as well. More generally, one can define the lexicographic order on the Cartesian product of n ordered sets, on the Cartesian product of a countably infinite family of ordered sets, and on the union of such sets.

Read more

238 questions
0
votes
1 answer

What is wrong with this sort routine?

I have an array of JavaScript objectss that have a string description. I am trying to implement a simplified sorting algorithm that will drop case, strip out HTML tags, and then strip out everything but letters and digits. I…
Christos Hayward
  • 5,777
  • 17
  • 58
  • 113
0
votes
1 answer

Change sorting order to AaBbCcDd

I have several files in a directory in my unix system that I need to sort. The problem I'm having is that when using the sort -f command it sorts in the order a A b B c C etc. ls does the same ordering. Is there a way I can make it sort with the…
0
votes
1 answer

Lexicographic sorting in java?

I am trying to sort 3 strings alphabetically using the compareTo method in java without using arrays. Is the fastest way to do this by setting up 6 compare statements and sorting by least to greatest or is there any easier way? Thanks!
Ryan
  • 57
  • 1
  • 5
  • 15
0
votes
2 answers

What is meant by lexicographical byte

I tried searching this word but unable to get proper answer... Is lexicographical means sorting alphabetically OR if two or more parameters share the same name, they are sorted by their value. Thanks for your help!!!!.....
Moeed Farooqui
  • 3,604
  • 1
  • 18
  • 23
0
votes
1 answer

Glossary test from swedish to english

This is my first thred here! This code is for a glossary test from swedish to english. I have problem with (*it).engelska)! And why cant i use (*it).engelska in this code? Many Thanks in advance!! void prov(list lista) { string…
user1690713
0
votes
2 answers

Lexicographical sort array of arrays algorithm using C#

I know I already asked this kind of question before dealing with vb6 and it was too slow, so I decided to use C# for this job; now the same code runs at double the speed, but still way too slow. The reason why it's slow is that it starts…
SSpoke
  • 5,656
  • 10
  • 72
  • 124
-1
votes
1 answer

How to sort in non-increasing and lexicographical order in Python

How do you sort in non-increasing order a list of team names and scores, and secondly in lexicographical order? I have the following line of Python that I am trying to understand. sigList.sort(key = lambda x : str(len(x)-1) + x[0], reverse=…
-1
votes
2 answers

lexicographically sorting a list containing lists

I have a list generated from a 2-d array which looks like below a = [[4,3],[4,5]] Each item in the list a is the row,column collected from the coordinates of interest of the 2-d array I would like to sort this list a, so that I can get the…
Ahamed Moosa
  • 1,395
  • 7
  • 16
  • 30
-1
votes
2 answers

Return the length of the String that comes first lexicographically

I am trying pass two strings to a function and I want to return the length of the string that comes first lexicographically. This is what I have tried so far: public static int problem4(String s, String t) { for (int i = 0; i < s.length() && …
Banan
  • 23
  • 4
-1
votes
4 answers

Why is `"12:34" < "123:45"` equal to `false`?

Can someone explain why the condition '12:34' < '123:45' is false? console.log('12:34' < '123:45' ? 'true' : 'false')
Rodrigo Guariento
  • 137
  • 1
  • 1
  • 13
-1
votes
3 answers

Lexicographic ordering with no consecutive repetition

I know algorithm of lexicographic order but in this question we can have repetition of character non-consecutively.And this make me confused. A good string s is the one which: contains only these letters of the set: [a,b,c] s[i] != s[i+1] string…
-1
votes
4 answers

What's printed by the following Pyhon code?

animals = ['horse', 'Pig', 'dog', 'Owl', 'lion', 'Hare', 'baboon', 'Fish', 'tiger', 'Zebra', 'Cow', 'Mouse', 'quail', 'Elephant'] for animal in animals: if (animal >= 'M') and (animal <= 'Z'): print(animal) Question 1: How to…
Leo
  • 93
  • 2
  • 11
-1
votes
2 answers

Making a shorted string from array of sub-string in javascript?

I am trying to solve a problem in hacker rank the given array is arr=["dd","dda","ddb"] According to problem I had to make a string in alphabetic order the correct o/p for this according to hacker rank is "ddaddbdd" For some test case the sorting…
-1
votes
2 answers

How to display "name" and "score" who have highest score?

Here my problem is I have a list of tuples and I need to find out who have the highest score,and corresponding name of the player. Sample Input: l=[ ('ram' ,16), ('sara' ,13), ('akhil',24), ('vinay',24) ] Sample Output: akhil…
Ramakrishna K
  • 43
  • 1
  • 1
  • 8
-1
votes
1 answer

Text Match combinations

My data is something like below # dummy data ID = c(1,2,3,4,5,6,7,8,9,10,11,12) addrs = c("3 xx road sg" , "4 yy road sg" , "5 apt 04-3 sg" , "Bung 2 , kl road sg","4 yy road sg" , "3 xx road sg" ,"Bung 2 , kl road sg" ,"5 apt 04-3 sg","3 xx road…
Learner_seeker
  • 544
  • 1
  • 4
  • 21
1 2 3
15
16