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
1
vote
3 answers

Java - Find the next word in lexicographic order

Please excuse me for my formatting mistakes as I am very new here. I have a Java assignment, in which I have to find the lexicographic lowest word that is larger then the given word from a scanner without putting the string in lexicographic order.…
JungleJeem
  • 51
  • 8
1
vote
1 answer

How to sort a list of lists in lexicographic order?

I want to sort the elements of a Haskell list in lexicographic order, Is there any method? Before sorted: [ [], [1,2], [1], [1,2,3], [2], [1,3], [2,3], [3]] After sorted: [ [], [1], [1,2], [1,2,3], [1,3], [2], [2,3], [3]]
user1072605
  • 97
  • 2
  • 8
1
vote
4 answers

How does this algorithm for generating the next lexicographically ordered permutation work?

This is the step by step process I found for ordering lexicographical permutations: Take the previously printed permutation and find the rightmost character in it, which is smaller than its next character. Let us call this character as ‘first…
entropy
  • 169
  • 3
  • 13
1
vote
2 answers

How do lexicographical permutations work algorithmically?

or example, if you are given "abcd", the lexicographical permutations would be: abcd abdc acbd acdb adbc adcb bacd badc bcad bcda bdac bdca cabd cadb cbad cbda cdab cdba dabc dacb dbac dbca dcab dcba I understand intuitively how it is meant to…
entropy
  • 169
  • 3
  • 13
1
vote
1 answer

Convert word into number for lexicographical order

I am trying to calculate a "score" for a word so that it will be used to determine it's lexicographical order in a Redis sorted set (words listed in alphabetical order). Reading this post it says: How to turn a word into a score? For instance, if…
fire
  • 21,383
  • 17
  • 79
  • 114
1
vote
1 answer

making sort order in merge() numeric

I have two easy matrices (or df's) to merge: a <- cbind(one=0:15, two=0:15, three=0:15) b <- cbind(one=0:15, two=0:15, three=0:15) #a <- data.frame(one=0:15, two=0:15, three=0:15) #b <- data.frame(one=0:15, two=0:15, three=0:15) No problem: after…
enfascination
  • 1,006
  • 9
  • 20
1
vote
2 answers

Efficient Means of Implementing Collation & Sorting?

I'm writing lexicography software, which may theoretically need to sort tens of thousands of strings with arbitrary (dictionary-project-specific) collations. There are two means of specifying custom collations: a map of graphemes to unicode-style…
Logan R. Kearsley
  • 682
  • 1
  • 5
  • 19
1
vote
3 answers

How to encode a number as a string such that the lexicographic order of the generated string is in the same order as the numeric order

For eg. if we have two strings 2 and 10, 10 will come first if we order lexicographically. The very trivial sol will be to repeat a character n number of time. eg. 2 can be encoded as aa 10 as aaaaaaaaaa This way the lex order is same as the…
Pradeep Vairamani
  • 4,004
  • 3
  • 36
  • 59
0
votes
1 answer

Invert string's lexicographic order value

Given that there is a lexicographically-sorted list of UTF-8 string s1, s2, s3, ... of unknown length, is it possible to invert each string value, such that when the list is sorted lexicographically again using the inverted value, the reverse order…
Code
  • 6,041
  • 4
  • 35
  • 75
0
votes
0 answers

Select blob keys by prefix in Cassandra

I am using a Cassandra-compatible database (that is ScyllaDB) I use it purely as a Key-Value Store with keys and values being Blob, that is Vec type. That is, it is created by CREATE KEYSPACE kv WITH REPLICATION = { 'class' : 'SimpleStrategy',…
0
votes
1 answer

Lexicographically middle string between 2 strings

public static String getMiddleString(String S, String T) { if(S.length()
0
votes
1 answer

Gurobi with multiple objectives

I am solving a multi-objective linear program with a lexicographic order in Gurobi and I set a time limit (c++ program calling the solver). I want to retrieve the gap for the last objective that was being optimized when the time limit was reached,…
0
votes
1 answer

Why doesn't PriorityQueue waitlist protect lexicographical order of surgeries?

This is a toy example of a waitlist (`PriorityQueue') in which each surgery on the waitlist should have a lexicographical order on the pairs (p, date). The p is an integer and the date is a datetime object. Clearly integers in python have an order,…
Galen
  • 1,128
  • 1
  • 14
  • 31
0
votes
1 answer

How to do this Lexicography Lc problem the right way

I'm attempting to solve a practice leetcode problem with the question is to merge each first individual characters of the 2 string that have smaller lexicography order into a string, here is an example of it. And here is what I tried: def…
V21
  • 57
  • 6
0
votes
0 answers

CPLEX staticLexFull does not provide feasible solution

I am currently using the multi-objective optimization feature of CPLEX via staticLexFull. I notice strange behavior with CPLEX 12.10 and 22.1: even though the instance is feasible, CPLEX always finishes with no solution, hence nothing can be…
qnhant5010
  • 195
  • 2
  • 12