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

Finding the "middle" string

So I am trying to write a code to find the middle string of a set of given strings, in this case 3. By middle I mean whichever is the middle in lexicographic order. The code I have written compiles and works no problem but with certain combinations…
M. G
  • 5
  • 1
  • 4
0
votes
4 answers

Lexicographic sorting in Java creating a strange order

I am trying to sort an object array by the names that are inside of the array. grades[].name I am using an insertion method with lexicographic sorting using compareTo and it is sort of working so I know I am using the compareTo correctly but not…
Grimmjow56
  • 19
  • 1
  • 1
  • 9
0
votes
1 answer

Method for finding the lexicographic number of a string

I'm trying to do a homework assignment for my Java class. The assignment is to make a method that will run a binary search through an array of strings, and return the position. The teacher told us to assume the elements of the array were in…
Devon
  • 3
  • 6
0
votes
2 answers

Sorting 3 strings Lexicographically using conditionals in C

I cannot wrap my mind around doing this logically. I have mapped out all possibilities for sorting and based my algorithm on that. ABC ACB BAC BCA CAB CBA Only six possible combinations for 3 strings, and so, I thought it a very quick and easy…
compute
  • 75
  • 9
0
votes
2 answers

How to sort a 2D numpy array lexicographically by one column?

how to sort numpy 2D array with 2 elements: For example I have: [['0.6435256766173603' 'some text'] ['0.013180497307149886' 'some text2'] ['0.017696632827641112' 'some text3']] I need: [['0.6435256766173603' 'some text'] …
TheRutubeify
  • 646
  • 1
  • 7
  • 24
0
votes
1 answer

how to get lexicographic order of a string having an alphabet

i have an alphabet composed of 4 letters [a, c, g, t]. i have an incremental dictionary of these letters: [a, c, g, t, aa, ac, ag, at, aaa, aac, aag, aat, aca, acc, acg, act, aga, agc, agg, agt, ata, atc, atg, att, aaaa ...] i want to assign to…
0
votes
2 answers

Reading a file for each word and sorting those words with a Binary Search Tree (Lexicographically)

Hello fellow programmers, I'm working on an assignment that requires us to read a file and take each word from that file and sort it in a table that displays the word and the line number it exists on. example: File that get's read contains: this…
user7741850
0
votes
2 answers

Matlab dir('*.txt') command is not listing txt files in order

I am reading text files from a folder using dir('*.txt') in MATLAB. Text files are named 0, 4, 8, 12, ..180.txt. dir returns 0 first, then 100, then 104 and so on. Why is this happening?
Dileep
  • 45
  • 1
  • 4
0
votes
4 answers

Sort a array of array of integers lexicographically

I'm using qsort() to sort a 2D array of integers lexiographically, each row being one input, but having problems with pointer arithmetic when traversing a row in the array. Idea is to concatenate each column in one row into a string, and strcmp…
adizone
  • 203
  • 1
  • 5
  • 13
0
votes
1 answer

Sorting user input in lexicographical returning memory characters?

I am attempting to alphabetically sort user input with a maximum of 10,000 words and a max length of 25 words. I am using 'stop' to end user input prematurely which is running me into some issues. The current program results in the following as…
Nuggets10
  • 81
  • 5
0
votes
3 answers

lexicographic comparison of strings [case-insensitive]

I want to sort the text of a file in lexicographic order but I'm having trouble understand what lexicographic order really does. Ordering strings produces another issue; the relational operators use ASCII values so betty < Diane is false when it…
FastKid12
  • 89
  • 6
0
votes
1 answer

Hbase use integer as row key and lexicographical order

I'm designing an Hbase schema where the row key should be an integer. I intend to use scan API from java with startrow and endrow with integer values. I guess I can transform my integers in a String with '0' padding to respect the lexicographical…
mvera
  • 904
  • 12
  • 23
0
votes
1 answer

order definition for comparisons in SQL ROW subqueries?

I was wondering when a row subquery is performed with a comparison operator such as > or >=, is the order of comparison defined using lexicographic (i.e. dictionary) order or is it defined element-wise? That is, for ROW (A, B), should (79, 48) >…
thor
  • 21,418
  • 31
  • 87
  • 173
0
votes
0 answers

Get the previous and next values of a string in lexicographic order

I'm working with a noSQL database and for certain reasons I can't use equality filtering in my queries e.g select all from database where id = 10 is NOT allowed but inequality filtering is allowed e.g select all from database where id > 1 My…
user2924127
  • 6,034
  • 16
  • 78
  • 136
0
votes
2 answers

Having trouble with the sort command outputting everything multiple times

I've got a temp file made with mktemp. Before the script exits, I must ouput the contents of the file to the screen. The contents have to be lexicographically sorted. When I try to apply sort to the temp file, it outputs a sorted result multiple…
Many Questions
  • 125
  • 1
  • 10