I want to write a program which take input and save the poistions of the array elements in another array.
let if i enter an array
A[0]= 4
A[1]=1
A[2]=2
A[3]=3
now the output array will hold
1
2
3
0
i-e the posistions of the array elements starting from the smallest number.
As 1 is the smallest number and it is on 1 posistion the output array will hold values like this
B[0]=1 //Posistion of the smallest number
B[1]=2 //Posistion of second smallest number
B[2]=3 //and so on
B[3]=0 //as 4 is on 0 posistion so it will be on this location of out //array.
This is the problem any one to solve it.
Awais Ahmad
0
Newbie Poster
Recommended Answers
Jump to PostIt seems as if the simplest way to affect a solution for your scenario would be to implement any of the available sorts, focusing on array index rather than array content.
Jump to PostThat's a better description of the project, but you could have posted it in your original thread.
As I see it the trick is to keep track of the original element indexes after you have sorted the array. I can think of two ways to do that.
First, …
All 5 Replies
Ψmon
2
Light Poster
Lerner
582
Nearly a Posting Maven
cikara21
37
Posting Whiz
cikara21
37
Posting Whiz
Laiq Ahmed
42
Junior Poster
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.