Hello.
I have been asked to write a function which Return the minimum index of
the nodes with a lexigraphically larger name".
But I am confused that what is lexigraphically
eehyf 0 Newbie Poster
Recommended Answers
Jump to PostIf you use C's strcmp() function it will return an integer > 0 if string1 is lexicographically larger than string2. Example: "Z" is greater than "A" because A comes first in …
Jump to Postlexigraphically - I take that to mean strings sorted or compared. Is that how your nodes are named? Perhaps a bit more information would help.
Jump to Postif all you care to compare is the first character, just access it directly. Consider:
char n1[32] = "ada"; char n2[32] = "john"; if( n1[0] > n2[0] ) cout << "n1 has the larger first char"; else cout << "n2 has a first char larger or equal …
All 9 Replies
Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster
vmanes 1,165 Posting Virtuoso
eehyf 0 Newbie Poster
stilllearning 148 Posting Whiz
eehyf 0 Newbie Poster
eehyf 0 Newbie Poster
Alex Edwards 321 Posting Shark
vmanes 1,165 Posting Virtuoso
grumpier 149 Posting Whiz in Training
Be a part of the DaniWeb community
We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.