Array Indexing Starts From 0 Sample Output Example 1: 5 1 2 3 4 5 44 is in position 3. Example 2: 5 12 23 34 41 52 2323 is in position 1. Example 3:   42 1 3 23 99 is not in the program.

C++ Programming: From Problem Analysis to Program Design
8th Edition
ISBN:9781337102087
Author:D. S. Malik
Publisher:D. S. Malik
Chapter17: Linked Lists
Section: Chapter Questions
Problem 16PE
icon
Related questions
Question
Given a List of Distinct N number a1,a2,a3........an.

Find The Position Of Number K In The Given List.

 

Input Format

First Line Take Input Value Of N

Second Line Take Input N Space Separated Integer Value

Third Line Take Input Value Of K

 

Output Format

Position Of K In The Given List

Constraints

  • 0 < N < 100001
  • 0 < ai < 1010
  • 0 < K < 1010

NOTE:
Array Indexing Starts From 0

Sample Output

Example 1:

5 1 2 3 4 5 44 is in position 3.
Example 2:

5 12 23 34 41 52 2323 is in position 1.
Example 3:
 
42 1 3 23 99 is not in the program.
Expert Solution
steps

Step by step

Solved in 2 steps with 2 images

Blurred answer
Knowledge Booster
Merge Sort
Learn more about
Need a deep-dive on the concept behind this application? Look no further. Learn more about this topic, computer-science and related others by exploring similar questions and additional content below.
Similar questions
  • SEE MORE QUESTIONS
Recommended textbooks for you
C++ Programming: From Problem Analysis to Program…
C++ Programming: From Problem Analysis to Program…
Computer Science
ISBN:
9781337102087
Author:
D. S. Malik
Publisher:
Cengage Learning