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

java.io.File.list() giving different order as the folders created sequentially

java.io.File.list() giving different order as the folders created sequentially While creating the Temporary folders with name as "Temp" + auto-incremented number e.g. Temp1, Temp2, Temp3...Temp10, Temp11 and so on. But when I use…
Kishore_2021
  • 645
  • 12
  • 38
-2
votes
2 answers

Sort Array List lexicographically ignoring integers

I have this code. I want to order a list of strings. Every item in the list consists of a three word sentence. I want to ignore the first word and sort the sentence lexicographically with the 2nd and 3rd words. If the 2nd or 3rd words contain an…
kaka
  • 597
  • 3
  • 5
  • 16
-2
votes
1 answer

Python3 Sorted function not behaving as expected, getting different output

Why is this weird behaviour: a = ['This','is','some','banana'] "_".join(sorted(a)). Output - This_is_banana_some It should give the output - is_banana_some_this Am I missing something?
Akash Singh
  • 171
  • 1
  • 10
-2
votes
1 answer

Sorting String List by rules

How to sort string list apart from ascending or descending order based on ACII table using comparator or comparable. Let us assume that a string list contains words which starts with either number (1start) or special character (@fill) or lowercase…
Ram
  • 11
  • 3
-2
votes
1 answer

Print characters and their frequencies in order of occurrence in a given string but i cant' understand line "freq[str[i] - 'a']++; "

Print characters and their frequencies in order of occurrence This is the whole program link if you want to know other details Below is program void printCharWithFreq(string str) { int n = str.size(); // 'freq[]' implemented as hash table…
-2
votes
1 answer

How to sort lexicographically array of strings JavaScript

How to sort lexicographically array of e.g. [aa bb cc dd ee] where the you take the first lexicographically smallest name and append it to the lexicographically largest name, Then take the second lexicographically smallest name and append it to the…
-2
votes
1 answer

Ordered ranking for a list of permutations

I am trying to develop a method for finding the orderd rank of a particular sequence in the following lists. a = list(sorted(itertools.combinations(range(0,5),3))) b = list(sorted(itertools.permutations(range(0,5),3))) a represents a list of…
Siddharth Chabra
  • 448
  • 6
  • 22
-2
votes
1 answer

C - recursive permutations in lexicographical order

I am trying to make permutations of strings with up to 8 characters. The problem is it must be done with recursion and it must be in lexicographical order. I found one solution with the recursion but it only works for 4 characters max. After that,…
-3
votes
1 answer

We are missing some condition for n>2, can someone help to find special cases which our code is missing?

Problem Statement: You are given a sequence A1, A2,…, AN and you have to perform the following operation exactly X times: Choose two integers i and j such that 1≤i
-3
votes
2 answers

lexicographically smallest palindrome

Im writing a program where i have to find out if the string can be made a palindrome if it can be made, fill the missing alphabets in a string (represented by a '.' ). However the missing alphabet must be filled in such a way that the resulting…
Arthas
  • 145
  • 1
  • 12
-4
votes
2 answers

how to convert str to int

I'm making a guessing game and i need to know how to stop it from putting my answers in lexicographical order as that makes a bug in my game. I've tried instead of having elif Guess < str(value): making it elif Guess < int(value): but i get the…
Lazer
  • 73
  • 1
  • 1
  • 8
-4
votes
2 answers

Read words until user writes 'end', then, order lexicographically(as in a dictionary), show the last word

User will enter words until the last word written is "end", then the code has to order lexicographically, as we have in a dictionary, all the words entered before 'end' and print the last word, the one classified the last. //..... Scanner word =…
edusola93
  • 9
  • 5
-7
votes
2 answers

Lexicographic Order in C

I am working on strings in C and I would like to ask What exactly Lexicographic Order is and how is being used in C. Which is the best way to compare 2 strings . I have read about strcmp and it's lexicographic comparison but I am confused.
Social Programmer
  • 147
  • 1
  • 4
  • 12
1 2 3
15
16