473,738 Members | 10,643 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Find 3 smallest values in array

3 New Member
Dearest how can i find three smallest values in array
I solve it by sorting array in ASC Order then i print first three values but i want to another efficient way can you have any efficient way
Feb 29 '08 #1
1 2370
sicarie
4,677 Recognized Expert Moderator Specialist
Probably depends on your sorting algorithm. What are you using right now?
Feb 29 '08 #2

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

Similar topics

4
6485
by: Code4u | last post by:
I need to write an algorithm that sheds the outliers in a large data set, for example, I might want to ignore the smallest 2% of values and find the next smallest. Boost has a nth_element algorithm, however, it partially sorts the data. I have a requirement that the data remain in the orginal order. Of course I could make a copy of the vector or array and then apply nth_element, but this would be expensive in memory and would require...
2
2272
by: J. J. Cale | last post by:
In IE6 both these functions *seem* to be working. I don't see much recursion in this group except the occasional setTimeout problems. Besides the obvious stack problems that can occur if one recurses too deep are there other reasons for this that I should know about? This example returns the position of the leftmost element of a specific type but it could be any array or any type of comparison regex or whatever. Also I'm sure these can...
3
9077
by: RobG | last post by:
I would like a query that will tell me the minimum non-zero value in a row. Say I have a table with a column called recordID that contains unique record IDs, and have a set of values named V1, V2 up to V9 that I want to find the minimum value for each record. The values are decimal floating point numbers, some of the columns contain zeros but I want to ignore those and get the minimum non-zero number. I know how to do column sorting,...
13
9695
by: Bob | last post by:
Hi, I have a newbie question. What is the smallest type object size? I am doing some calculation with individual bits and want to minimize memory usage. I though bool might do it but it seems like each bool is a byte, instead of a bit. Is bool the smallest possible type? Thanks, Bob
2
4859
by: elissa | last post by:
hi guys i really wish if some one could help me with this problem , well i solved it but the output is always wrong so can some one help me: the Question is in this link: http://people.westminstercollege.edu/faculty/ggagne/fall2006/306/handouts/hw2/index.html can some one please help me with the dynamic programing part of the question this is what i did so far: --------------------------------- #include <iostream> using...
30
5245
by: =?Utf-8?B?VGhvbWFzVDIy?= | last post by:
Hello, I have an array that holds 4 values ( they contain random numbers). I would like to find the lowest value (if there is a tie i would like to find one of the tie.) then remove that value. I am new to Programming and C#. Thanks for any help you can provide Thomas
1
2059
by: Elaine121 | last post by:
Hi i'm writing a program where you have to determine the smallest, number of distinctions and the average from an array of values. in my test class i get an error that says cannot find symbol - constructer IntValues() here is my program: public class IntValuesTest { public static void main(String args) { int valueNum = {45, 84, 56, 79, 63, 92, 76, 54, 61, 72};
19
29254
by: Eugeny Myunster | last post by:
I know, only simple one: #include <stdio.h> int main() { int min=0,max=0,i,arr; for(i=0;i<12;i++) arr=rand()%31-10; for(i=0;i<12;i++)
8
3467
by: Sunny | last post by:
Hi, do someone know, How we can find the smallest distance between a bunch of lat 7 long? Like I have 10 Latitude & Longitude. -73.924598,40.879010 -73.924506,40.878978 -73.924506,40.878978 -73.921406,40.878178 -73.921406,40.878178
0
8969
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
9476
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
1
9263
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
9208
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
8210
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
0
4825
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
3279
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
2745
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2193
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.