473,379 Members | 1,260 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,379 software developers and data experts.

nth biggest number in unsorted array

hi friends

guys
i have a question that suppose there is very big array of unsorted number and we have to find nth biggest number in opitmized manner, then how we can do it. n parameter can be also big.

Mine logic is first create descending priority queue in place and then performing removing delete operation nth time

is there is any other optimized method.
May 4 '07 #1
3 2785
svlsr2000
181 Expert 100+
hi friends

guys
i have a question that suppose there is very big array of unsorted number and we have to find nth biggest number in opitmized manner, then how we can do it. n parameter can be also big.

Mine logic is first create descending priority queue in place and then performing removing delete operation nth time

is there is any other optimized method.
If n is smaller, declare an array of n element and store N biggest number in that. But i dont think this might be the best solution.
May 4 '07 #2
If n is smaller, declare an array of n element and store N biggest number in that. But i dont think this might be the best solution.
Is not there any inplace solution withour requiring any other storage array.
May 4 '07 #3
Ganon11
3,652 Expert 2GB
You could always perform an efficient sort on the array and then take the element n places away from the end. That would be an efficiency of O(n log n).
May 4 '07 #4

Sign in to post your reply or Sign up for a free account.

Similar topics

7
by: Egor Shipovalov | last post by:
I'm implementing paging through search results using cursors. Is there a better way to know total number of rows under a cursor than running a separate COUNT(*) query? I think PostgreSQL is bound...
0
by: Thomas Wegener | last post by:
Is there any way to put the properties in a unsorted order? Thanks Thomas
3
by: David Scemama | last post by:
Hi, I need to store (key,Value) pairs, but I don't want them sorted. I need to access to the keys or values by index. I also need to access the indexes using keys or values. The only class...
3
by: Peter J Ross | last post by:
Greetings. I'm quite new to PHP and have very little knowledge of programming in general, so I may be missing something obvious, but I can't find a solution to the following difficulty in either...
30
by: vim | last post by:
hi How to find biggest of three numbers without comaprimg numbers
29
by: fdmfdmfdm | last post by:
let's say without checking including files, how do we to represent the biggest say int in a system? I ran across a book give this code: long int biggest = 0x7FFFFFFF; Does that mean the...
3
by: gemacjr1201 | last post by:
I need to open a file that has unsorted list of names and birthdates formated like this: LASTNAME, FIRST$MM/DD/YYYY\n.It could have as much as 100 names. I will use a selection sort algorithm to...
8
Ali Rizwan
by: Ali Rizwan | last post by:
Hi, I want to find the biggest number from a database using ADODC Suppose. Database has records in arrangement 1,2,5,7,8,20,99,3,4 and i want the biggest number from this field which is 99....
2
by: clogg02 | last post by:
Hi, I have bound a DataView to a DataGridView using this.dataGridView1.DataSource = new DataView(this.dataTable1); I allow for sorting of the datagridview using clicks on the headers. Later...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
by: ryjfgjl | last post by:
In our work, we often need to import Excel data into databases (such as MySQL, SQL Server, Oracle) for data analysis and processing. Usually, we use database tools like Navicat or the Excel import...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.