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 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, …
Jump to PostBy Just Skimming through your Problem statement one can judge its a sorting problem, what you need to do is to analyze which sort will meets your need, if you've small array and planty of space then the following trivial algorithm will meet your requirements. But this trivial algorithm only …
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.