|
This is what i did, The problem is that every iteration i need to sort the list that is allready sorted.
The Only thing that i need is to Insert the object into the right place in the sorted list and then Remove the last object on the list.
Do you have any idea what can i do?
modified on Monday, July 27, 2009 7:27 AM
|
|
|
|
|
With the solution I propose, this is not the case. You would only sort every so often, not with every iteration. Now I think about it, this may still be slow, because you would have to sort a larger list.
I suppose you could also use a LinkedList (for fast insert/remove) and implement some kind of binary search to find the index to insert at. LinkedList doesn't seem to have a BinarySearch() method, but I'm sure you can find an example of binary search somewhere. I think that would give you the best performance.
|
|
|
|
|
You still don't get it, do you?
assuming a fantastic CPU that does everything your algorithm needs for one iteration in a single instruction (waw), and runs at 1000GHz (waw), so it does 1 of your zillion things per picosecond, or 3E19 per year (as there are 3E7 seconds in a year); now assume it started when the universe started (some 14E9 years ago?), then it would now have finished some 4E29 thereof, way less than 1E50 (you're twenty zeroes short).
so sorting isn't relevant, your algorithm stinks, it is just undoable that many times.
Luc Pattyn [Forum Guidelines] [My Articles]
The quality and detail of your question reflects on the effectiveness of the help you are likely to get.
Show formatted code inside PRE tags, and give clear symptoms when describing a problem.
|
|
|
|
|
The Might and Magic V Map Editor's floating Toolbar with TabPage as below:
http://cid-fbeb6373d9321a7f.skydrive.live.com/self.aspx/Questions/Visual%20C%7C3/MapEditor%7C_Might%20and%20Magic%20V%20Map%20Editor.JPG
How do I design the same toolbar in Visual C# 2008?
|
|
|
|
|
Here is an Nice Example of Floating Toolbar. You have to design the internal content of Toolbar.
Floating Toolbar
modified on Sunday, July 26, 2009 12:44 PM
|
|
|
|
|
|
I have a list of specific class.
Im doing some simulation and i want to receive in the end the 100 best result.
Lets say i have this class :
class A<br />
{<br />
int j;<br />
int t;<br />
<br />
}
and i want to save in some range of j and t the best 100 "A" elements that give me the low math.pow(j/t,2) (100 result of the lowest A that i have).
Right now im insert the result to the list and then sort the list with the Compare method. each time a take the smallest result of the list and then if the current result is more small then then the small one on this. If its is smallest then i insert it into the the array , sort it and then remove the last object and continue.
What is the best way to take a List/Array of sort element and just insert the Current element to it's place in the sorted List/Array and remove that biggest element of the list ? (In C# )
modified on Sunday, July 26, 2009 7:46 AM
|
|
|
|
|
Do you really need to do that after each insert? Or can you fill the structure, then sort it and iterate the ones you want?
|
|
|
|
|
In the name of God
-----------------
Hi
Anybody know how we can find out Firefox in work ( loading page or downloading file , downloading image) ? please help me in any programing language .
best regards
bye.
|
|
|
|
|
Fullmm wrote: Anybody know how we can find out Firefox in work ( loading page or downloading file , downloading image) ?
Can you please explain it in little bit details? I am little bit confused .
You want to track information when Firfox downloading any file or Images ?
|
|
|
|
|
Manas Bhardwaj
Please remember to rate helpful or unhelpful answers, it lets us and people reading the forums know if our answers are any good.
|
|
|
|
|
I want to create a c# app. It should just display a message box, whenever I am opening Iexplorer.exe. How to do this friends? It should be run at background
|
|
|
|
|
Any way you like. I'd probably have it as a Windows Scheduled Task that starts at login.
|
|
|
|
|
ok., but How to do this in c#,
Which event will fired when browser invoked? Can I get example program?
I am new to c#.
|
|
|
|
|
I don't know what anyone else would do, but I'd likely start with calling FindWindow in an endless loop and doing whatever it is I want to do when I find one.
[
System.Runtime.InteropServices.DllImportAttribute
(
"User32"
,
SetLastError=true
,
EntryPoint="FindWindow"
)
]
private static extern System.IntPtr
API_FindWindow
(
string lpClassName
,
string lpWindowName
) ;
public static System.IntPtr
FindWindow
(
string WindowName
)
{
return ( API_FindWindow
(
null
,
WindowName
) ) ;
}
If no one gives you a better idea, then read up on P/Invoke to figure how to use this.
|
|
|
|
|
|
|
Hello everyone. I've successfully managed to control the general wave volume of Windows.
However, since vista came out, it's now possible to control the volume for every single application in the windows mixer..
Since I didn't manage to find anything anywhere here comes my question: how i can control per-application volume?
What I wanted to do was to mute/lower the volume of all BUT ONE application. ( also via some sendmessage codes I'm not aware of.. )
Can anyone help?
|
|
|
|
|
Is there a free IDE for designing a Winforms gui for a C# program? I have a copy of VS 2008 that I got from school, would that work?
Also, is Visual C# the same as C#? VS 2008 only doesn't list "C#", only "Visual C#".
Thank you.
|
|
|
|
|
You can use VS 08.. yap my friend this are same.
Thanks
Md. Marufuzzaman
|
|
|
|
|
C# is a language. Visual C# is Microsoft's compiler for C#. Visual Studio can be used as an IDE for Visual C#, and is quite handy (but not required) when you need to implement a WinForms application. An Express version of Visual Studio is available for free. And a C#-only version of Visual Studio is (or was) also available, marketed as Visual C# Standard (if I recall correctly).
|
|
|
|
|
How can I use Vscroll for listview when Scrollable is false ?
|
|
|
|
|
Hello,
I'm looking for a way to query the pending applications I'm installing by group policies. I planning a C# class for a program, running on a client in a windows domain, which queries the applications to install by GPO, compare with the installed programs and discover this ones not yet installed.
I've absolute no idea how to discover the according GPOs and I've spend a lot time with Google by searching unsuccessfully for an approach.
Has someone a hint, how i could solve this problem? How do I discover the applied GPOs on a client machine?
Please excuse my bad English and greetings from Berlin
Costa
modified 13-Sep-21 21:01pm.
|
|
|
|
|
hi
how can i convert image that is 32bppArgb (png image) to jpg so if the image is Transparent
i don't get a black image, or if the image is semi Transparent (like red color and 50 % alpha) i get the color like the png image and not a full color?
|
|
|
|
|
The jpg format does not support an alpha mask, png does. Therefore, this will be lost when you convert to jpg.
The rest of your question makes no sense to me.
Christian Graus
Driven to the arms of OSX by Vista.
Read my blog to find out how I've worked around bugs in Microsoft tools and frameworks.
|
|
|
|