Expert answer:Lexicographical order, assignment help

Answer & Explanation:1-Write the
program that asks the user to enter 10 names of cities (one name at a time) to
be stored in an array, sorts the resulting list of city
names lexicographically and displays the sorted list to the console.
Note: Lexicographical order is a
generalization of the way the alphabetical order of words is based on the
alphabetical order of their component letters. It is also known as dictionary
order.
Hint: Comparing two words
lexicographically can be done by using “<” and “>” for C++ strings.
Example:
Original List: Paris, Washington DC, London, Tokyo, Madrid, Rio di Janeiro,
Brussels, Ankara, Rome, Amsterdam
After
applying the Lexicographical order, the list will be become:
Resulting List:Amsterdam, Ankara, Brussels, London, Madrid, Paris, Rio di
Janeiro, Rome, Tokyo, Washington DC
If the first
letters of the two cities are the same, you should compare the next ones.
Original List:Ankara, Amsterdam
Resulting List:Amsterdam, Ankara2-You are
given the following source code to search for a number in an array
#include

using
namespace std;
int
search(int sa, int list[ ], int size)

  bool notFound = true;
  int position = -1;
  int k = 0;
  while (k

Order a plagiarism free paper now. We do not use AI. Use the code SAVE15 to get a 15% Discount

Looking for help with your ASSIGNMENT? Our paper writing service can help you achieve higher grades and meet your deadlines.

Why order from us

We offer plagiarism-free content

We don’t use AI

Confidentiality is guaranteed

We guarantee A+ quality

We offer unlimited revisions

Leave a Comment

Your email address will not be published. Required fields are marked *

Scroll to Top