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
1 answer

How to compute S-pairs in Macaulay2?

Buchberger's algorithm requires computing S-pairs (more on page 83 of Ideals, Varities and Algorithm by Cox et all 2008, 3rd edition) S(f,g)=LCM(LT(f),LT(g))/LT(f) *f - LCM(LT(f),LT(g))/LT(g) * g where LCM is the least common multiple (equivalent…
hhh
  • 50,788
  • 62
  • 179
  • 282
1
vote
1 answer

Search Binary Tree C, Lexicographic order, next permutation, recursive

I have a homework, done the most part of it but i'm stuck at a point. I have to search through a binary tree and find a keyword, if the keyword doesn't show up I have to find the lexicographically next string at the tree witch has as a prefix the…
1
vote
1 answer

Get next lexicographic character

Is there a method of java characters that will return the next character in lexicographical order? char x = 'a'.next(); 'a'.next() would return b. 'b'.next() would return c. etc.
1
vote
2 answers

Lexicographically order two lists of variables using constraints

I'm trying to implement a lexicographic ordering constraint in BProlog using its CLP(FD). As far as I can see from the manual BProlog doesn't provide a built-in lexLeq constraints (though there exist efficient propagation algorithms for this global…
Bakuriu
  • 98,325
  • 22
  • 197
  • 231
1
vote
1 answer

How to order a data frame by values contained in the lists present in one of the columns?

I am using R and have a data frame which has four columns. One of them is numeric, and another one has lists in each row: column_1 column_2 column_3 column_4 a x 1 c("334", "538", "645", "763") b y …
Abhinav Sood
  • 799
  • 6
  • 23
1
vote
1 answer

Checking lexicographic order python from text file

I have a text file that contains: I like potatoes Potatoes are good Potatoes contain starch And I want to test if each sentence is in lexicographical order. If the sentence is I would like it to output "This is in lexicographic order" I'm not too…
UdonSenpai
  • 55
  • 1
  • 6
1
vote
2 answers

Retrieve Kth lexicographically smallest string from trie tree

I am currently trying to solve a problem which involves retreiving kth lexicographically smallest string from a trie. Example: let us consider the following set of strings: {"a", "b", "c", "aa", "aab", "ab", "ac", "aac"}. Next, lets say that I am…
Bhoot
  • 2,614
  • 1
  • 19
  • 36
1
vote
4 answers

All the strings lexicographically greater than X and smaller than Y

How can I find all the strings in "python" which are lexicographically greater than X and smaller than Y? X and Y are of same length. Example: X = "ab" and Y = "ad" So the answer will be: "ab", "ac" and "ad" How can I do this?
bazinga
  • 2,120
  • 4
  • 21
  • 35
1
vote
2 answers

Algorithm to print all combination of letters of the given string in lexicographical order

I tried to create the code to generate all possible combination of the given string in the lexicographical order: The code that I wrote is: void get(char *n) { int l=strlen(n); sort(n,n+l); int k=0,m,i,j,z; while(k
sac
  • 137
  • 2
  • 5
  • 15
1
vote
1 answer

Lexicographic ordering of triplets of integers in Matlab

I have the following problem: I have an array of N integer triplets (i.e. an Nx3 matrix) and I would like to order it lexicographically in Matlab. In order to do so I thought of using the built-in sort algorithm of Matlab, but I wanted to ask if the…
1
vote
1 answer

Algorithm to convert string to int while mainting lexicographical order

I need an algorithm that will map a string of length four to a four digit number. The problem is it has to maintain lexicographical order. It doesn't need to not have collisions, it's just that if S <= T, F(S) <= F(T). The only additional…
Alex Beals
  • 1,965
  • 4
  • 18
  • 26
1
vote
1 answer

Lexicographical Ordering of Strings Containing Punctuation

When declaring dependencies in Gradle I like to keep my dependencies in alphabetical order, however I have come across a situation when I am not sure what the correct order would be. Wikipedia states "Various conventions also exist for the handling…
Rylander
  • 19,449
  • 25
  • 93
  • 144
1
vote
1 answer

PHP: sort multi language strings with English last

I'm build a site that is not in English, but some of the data may contain English. When I sort lists, for example: sort($tags, SORT_LOCALE_STRING); English strings always come first (because Latin letters have the lowest ordinals in Unicode), even…
Guss
  • 30,470
  • 17
  • 104
  • 128
1
vote
3 answers

Sorting a list of vectors lexicographically according to priorities

Say I have a list of vectors of strings: ["a", "c", "duck"] ["a", "a", "f"] ["bee", "s", "xy"] ["b", "a", "a"] I want to sort the vectors in this way: first sorting lexicographically with respect to the element at index 0, and if there's a tie, it…
user3213711
  • 145
  • 2
  • 3
  • 11
1
vote
1 answer

I am trying to order rectangles in lexicographical order. (x,y,width, height)

If a rectangle has the same x value then compare the y value, then check the width and height and so on. public class RectangleTester { public static void main(String[] args) { ArrayList list = new ArrayList<>(); …
fubrick
  • 51
  • 6