kplcjl 17 Junior Poster

I apparently haven't had the math education in the dark ages (1960s) that I thought I had. I know:
i^2 == -1
I haven't seen i used as an exponential value in any formula, but I've not studied Euler much either.
How in the world does 2.718 raised to power (3.14159 times i) come near -1? The only way I knew how to make an imaginary number into a real number was to multiply it by i and I thought a complex expression couldn't be made real.

PS I have free VS 2012, I thought I had .NET 4.?, but System doesn't know Numerics type.

kplcjl 17 Junior Poster

djjeavons asked "Why?", and I can't reply directly. I was trying to be helpful.
This is an English site that is used internationally. When someone whose first language isn't English, this isn't the easiest language to learn or use and usually appreciate getting tips on the nuances of the language.
Turns out the author understands what he wrote wasn't exactly correct, but isn't worth going back and correcting either. That's his peragative, it wasn't a terrible error to begin with. My mistake, trying to help out someone who didn't need it.
Note his picture would fit in in Alaska or Russia, in one, English should be a first language and in the other it should be a second language. No way to tell by the picture.

kplcjl 17 Junior Poster

To give you a little more insight in the English language, "in site" is basically a meaningless collection of two real words that would sound exactly like "insight". Site is (sort of) a specific location, you can't be in it, but you can be in a building or a hole in the ground that is on-site. Sight is related to seeing, but insight is related to seeing interactions in your mind and gaining the insight(understanding) into how they relate to each other.
A University campus is a site that can encompass several blocks and buildings, yet is still one site.

djjeavons commented: Why? -1
kplcjl 17 Junior Poster

Note that this same technique can be used between a dll and a FORM. Note that the dll will have to run on a separate thread, the same as the two forms in this example do.

kplcjl 17 Junior Poster

Note that the name "Times" does not mean multiplication is being done, it means the routine defined is being repeated in a Linq expression, so maybe a better name may be called for. I can't think of a better name myself...

kplcjl 17 Junior Poster

"I need to copy text from one place to another" Just to be sure, you meant TYPE a copy of the text. Others have addressed that.
If you want to copy to the clipboard and paste to your textbox, you MUST lose focus of your application, put focus on the other app, it must support copy to clipboard, then you must go back to your app to paste it. Textboxes implicitly support copy from clipboard. Note that reading the screen may get messy because the typing could interlap. Your alternate text source won't let you see the text in your app if it has focus and wasn't written by you.

kplcjl 17 Junior Poster

JC: There are articles galore about sorting routines because people are interested in how they work. My gripe is that the authors pick the bubble sort because it is the easiest one to code. That is an N^2 routine. This is a shortened loop because it uses ((N+1) X N)/2 loops so it basically executes half as many loops. It is still N^2 because if you double the size, you quadruple the time it takes which is the characteristic of N^2. I agree with you that if you want to sort, Array.Sort() is the way to go. I wrote an article http://www.codeproject.com/Articles/632556/Another-article-about-big-O-notation that has a routine that just about matches Array.Sort() in expected performance, but the built-in one consistently takes about 2/3 the time my routine does. So for practical reasons never use my routine to sort. 150 million items takes about 49 seconds for my routine to sort. The bubble sort takes about 3 minutes to sort 150 thousand items. The predicted time for bubble sorting 150 million items is 3 million minutes because it is 1000 times bigger, so it would take a million times as long. (There are 1,440 minutes in a day, so over 280 years, using actual times it was still over 270 years)
The complaint about the GOTO statements is valid, read up on articles that explain why the use of GOTO statements are bad. I learned coding in the spaggetii code era, it took me a while to figure that …

kplcjl 17 Junior Poster

When the global variable was referenced, the poster meant to set the arrays as static in the class but outside the calling routine. Don't send the arrays as parameters, just create the new work arrays in the routine, load the old and the new information you want to change and then just set the static arrays to the work arrays

kplcjl 17 Junior Poster

Whoops I changed the arrays to ref, but didn't set them to be nullable, both the replacement and sending variable have to match their nullable state.

A lot more thought needs to be put into keeping everything in sync. Why do you want to set a value to null? int.MinValue is just as invalid and doesn't blow up if you don't accept negative numbers

kplcjl 17 Junior Poster
        /// <summary>
        /// It is really handy to use intellisense to define what your code does,
        /// especially when going back to code you wrote five years ago
        /// to remind you after forgetting what you were doing back then
        /// </summary>
        /// <param name="playerNumbers"></param>
        /// <param name="playerCount"></param>
        /// <param name="playerLastName"></param>
        /// <param name="playerPoints"></param>
       static void ProcessDelete(ref int[] playerNumbers, ref int playerCount, ref String[] playerLastName, ref int[] playerPoints)
        {//Why ref playerCount when it never changes and why not set the new arrays to the playerCount?
            Int32?[] newArray = new int?[playerNumbers.Length]; String[] newArray2 = new String[playerLastName.Length]; int[] newArray3 = new int[playerPoints.Length];
            int index = 0;//note that newArray has been reset to a nullable int array and Int32 IS int
            int index2 = 0;
            int index3 = 0;
            int r = 0;//r is currently constant, either plan for it to change or hard-code
            int j = 0;
            int t = 0;
            while (index < playerNumbers.Length && index2 < playerLastName.Length && index3 < playerPoints.Length)
            {
                if (index != playerCount) { newArray[r] = playerNumbers[index]; }
                //{ Write out in comments what you want to do when you create dead code both to remind yourself
                // what you intended to do and other coders why you put dead code in a location
                //}
                if (0 != 1) 
                {//write out why you are putting in ineffective if statements and the plan to fix them
                    newArray[0] = playerNumbers[0];
                }
                //Better yet don't write an if statement, just why you think one should be here
                {//There …
kplcjl 17 Junior Poster

FYI int[] IS a reference object, so if you change a value in the array, all objects that have access to the array also has access to the changes made. If you change the length of the array, you just created a new object, so if you change its values and then assign it to the passed array, then the calling routines don't have access unless you included the ref keyword.
As pointed out, everything is an object so you have to make clearer how you can't access objects and why.

kplcjl 17 Junior Poster

Agreed, that a while loop in the main routine could be used and therefore have the routine called once multiple times, but this was posted by a begining programmer, so I thought I'd introduce the recursive call in an unusual manner. (Normally the state of the program logic is used to determine if the recursive call continues or ends.)

kplcjl 17 Junior Poster

Thanks Tinstaffl,
For some reason I wanted to play around with the stick figure more. Do note in the IDE you can change the properties of the Console screen the debugger uses and the debugger keeps those changes for that application. Here is my playcode, it goes down as well as across:

            /// <summary>
            ///  Console walking stick figure. (Sideways and down)
            /// </summary>
            /// <param name="cols">Supply the number of columns the figure should walk</param>
            static void stick(int cols)
            {
                if (cols < 1)
                {
                    Console.WriteLine("You entered a column number ({0} less than one. Exiting the stick figure program", cols);
                    return;
                }
                string head1 = "  0 ";
                string body1 = " !T!";
                string body2 = "  X";
                string legs0 = " / \\";
                string legs1 = "/   \\";
                string legs2 = "  | ";
                string numberOfSpaces = "";
                int startLine = 0;
                bool legsShouldPrint = true;

                Console.WriteLine(head1);
                Console.WriteLine(body1);

                for (int i = 0; i < cols; i++)
                {
                    Console.Clear();
                    for (int j = 0; j < startLine; j++) Console.WriteLine();
                    if (i % 4 == 3) startLine++;

                    Console.WriteLine(numberOfSpaces + head1);
                    Console.WriteLine(numberOfSpaces + body1);
                    Console.WriteLine(numberOfSpaces + body2);
                    if (legsShouldPrint)
                    {
                        Console.WriteLine(numberOfSpaces + legs0);
                        Console.WriteLine(numberOfSpaces + legs1);
                    }
                    else
                    {
                        Console.WriteLine(numberOfSpaces + legs2);
                        Console.WriteLine(numberOfSpaces + legs2);
                        Thread.Sleep(180);
                    }
                    numberOfSpaces += " ";
                    legsShouldPrint = !legsShouldPrint;
                    Thread.Sleep(180);
                }
                // Use a recursive call to run it again. Note that this creates a copy of the routine with each recursion.
                // Unlikely but possible to run out of storage.
                Console.Write("Do it …
kplcjl 17 Junior Poster

Well, I obviously am too inexperienced with Daniweb controls. I tried the Code routine and that "Here is code" was the result. Then I used Inline Code and have had problems with that in the past. Indentation problems there. I use functions in a test Console instead of the main routine so I can keep logic and just execute it when I want that section executed.This time it screwed over the spaces put in the string as well putting code outside the area I had marked as code.

kplcjl 17 Junior Poster

` static void stick()
{
string head1 = " 0 ";
string body1 = " !T!";
string legs0 = " / \";
string legs1 = "/ \";
string legs2 = " | ";
string numberOfSpaces = "";
bool legsShouldPrint = true;

        Console.WriteLine(head1);
        Console.WriteLine(body1);

        for (int i = 0; i < 72; i++)
        {
            Console.Clear();


            Console.WriteLine(numberOfSpaces + head1);
            Console.WriteLine(numberOfSpaces + body1);
            if (legsShouldPrint)
            {
                Console.WriteLine(numberOfSpaces + legs0);
                Console.WriteLine(numberOfSpaces + legs1);
            }
            else
            {
                Console.WriteLine(numberOfSpaces + legs2);
                Console.WriteLine(numberOfSpaces + legs2);
                Thread.Sleep(180);
            }
            numberOfSpaces += " ";
            legsShouldPrint = !legsShouldPrint;
            Thread.Sleep(180);

        }
        Console.Read();
    }

`

kplcjl 17 Junior Poster

Here is code:

kplcjl 17 Junior Poster

The Padleft solution is another alternative, I used the string you supplied but didn't use. I suspect it is more efficient using Pad. Your delay seemed really short and that does produce a running man effect. When I added 100 to your delay, it was better but still had a hitch to his walk. I also added aesthtic effects to make the man more reasonably proportioned.

kplcjl 17 Junior Poster

Line 302 has:
control.text = String.Concat("Level ", levelNum.ToString, " Lives ", lives.ToString, " Money: ", rewards.ToString)
This would do the same thing in a shorter format:
control.text = String.Format("Level {0} Lives {1} Money: {2}", levelNum, lives, rewards)

kplcjl 17 Junior Poster

One of the things that has always amazed me about most stories of time traveling machines is that you always end up at the same location where you started. (Except for the more "realistic" spaceships that travel in time.)
The earth at its equator is spinning at around a 1000 miles per hour, everyone on earth is traveling around 4000 miles per hour around the sun. We're moving even faster than that in our galaxy. And galaxies are pulling away from each other at nearly the speed of light. Yet, we have people go outside the century old ruins of a castle, and poof, the castle is 100 yards away and a few years old.

kplcjl 17 Junior Poster

@Grimjack, your novel had two separate points of view, because two people can't have the same point of view. In fact everyone experiences changing points of view as they go through life. Since I didn't read it, for all I know, that is two points of view from the same person.
Can the person who time travels ever get back to where they started? (Since a person died in the past, if you go back in the past to save them, there is no reason to go back in the past because you saved them, so how could you get back to where you did go back, since you wouldn't need to go back in the first place.) They've got some great movies like that already, so that wasn't my idea. (I think.)

kplcjl 17 Junior Poster

It's been 45 years or so since I read flatland. My memory is fuzzy, so if you want to challenge me, I won't argue. Flatlanders never looked up or down because that dimension didn't exist to them. They were all circular in shape, their buildings were rectangular lines. They were visited by a 3-dimentional sphere which caused great consternation because it suddenly appeared as a point and got to be a bigger and bigger circle (person) in their world, and then it got smaller and smaller until it just disappeared.
It never explained how these circular people moved. I wondered if they had pathways, how you got on and off a path. (Doors like buildings had?)
Time makes a wonderful fourth dimension. We appear from nothing, we get bigger and bigger, then smaller and smaller until we disappear. So we are fourth dimensional creatures visiting a three dimensional world. We just aren’t true fourth dimensional creatures because we don’t control movement through all 4 dimensions, we just use one to change where we are in the other three dimensions. So flatlanders really were 3 dimensional creatures.

kplcjl 17 Junior Poster

I've got to learn to read the article headers!!!
OK, how do you define an array object in JavaScript?
Note that passing a string array for the second object, the output in C# is: one<br/>2<br/>System.String[]<br/>
Also, all languages have some similarities, of course it's a little more difficult to see them in assembler.

kplcjl 17 Junior Poster

PS In C#, you can't define "var[]", but you can:

                    private static object[] lw(object bat, object bat2, object bat3)
                    {
                        object[] nw = new object[3];
                        nw[0] = bat;
                        nw[1] = bat2;
                        nw[2] = bat3;
                        return nw;
                    }
                    static void Main(string[] args)
                    {
                        int two = 2;
                        double v = 3.0034;
                        var Apple = lw("one", two, v);
                        foreach (var xX in Apple) Console.Write(xX + "<br/>");

Produces:
one<br/>2<br/>3.0034<br/>

kplcjl 17 Junior Poster

Don't know the language you are using. I do know C# and unless that is psudo-code, it won't even compile in C#. In C#, "this" is a keyword to point to the base object's values, something like "private string bat, bat2, bat3;" In that case the routine could look like "void lw (string bat, string bat2, string bat3)" and the {} could be an exact copy, but in no way would you get an array. I have to admit I don't remember if the compiler wouldn't allow you to assign the function to a value, but I believe not.
Here is a C# example:

        /// <summary>
        /// Returns an array of strings
        /// </summary>
        /// <param name="bat">Index 0</param>
        /// <param name="bat2">Index 1</param>
        /// <param name="bat3">Index 2</param>
        /// <returns></returns>
        private static string[] lw(string bat, string bat2, string bat3)
        {
            string[] nw = new string[3];
            nw[0] = bat;
            nw[1] = bat2;
            nw[2] = bat3;
            return nw;
        }
        static void Main(string[] args)
        {
            var Apple = lw("one", "two", "three");
            foreach (var xX in Apple) Console.WriteLine(xX + "<br/>");

...
This produces:
one<br/>
two<br/>
three<br/>

Note that this created an array, populated and returned it to the var Apple. You have to define your Enumerable object and populate it.

kplcjl 17 Junior Poster

My version is Visual Studio 2010 Express. I believe that version is 4.0 but the express System Assembly does not include System.Speech.

Dang.

As far as the ASP.Net user, you are using the C# code to generate HTML and JScript (Looks exactly like JavaScript to me) to render on a web browser. The web definitely have sound generators but I don't know how to write it so the web can play it.

You can look to see if the synthesizer can write a file format of the sounds generated and if that file when linked on the web plays sounds, you may be able to play that on the web. All conjecture on my part.

Considering the error thrown when a sound bar doesn't exist, may be a bad conjecture.

kplcjl 17 Junior Poster

Sorry, Events and Event Handlers are two different things, you subscribe to the handler to call a routine when the event is triggered.

kplcjl 17 Junior Poster

Bogdan, the author is creating two independent forms, that are designed to be independent. Event processors are delegate handlers. You subscribe software by adding it to the event. In this case "child_FormClosed" is a subroutine that is built and owned by the parent form. By subscribing the child's FormClosed event to it, the child doesn't care that the delegate is owned by by another form, when it closes, it calls this event and does nothing further with the child form other than closing it. Normally this is used to clean-up a form gracefully before it gets close. The child could also do this and both functions would fire when the child was closed. When the parent form is hidden in the button event that creates the new child form, it remains active but completely inaccessable to the user. It would remain that way until you shut down the sever without this event. But because it is owned by the parent, the parent executes the code to allow you to access the form because it now becomes visible.

Why you need this, is to inform the parent form to again give user control in the parent form instead of becoming a sneaky memory leak where GC is supposed to solve that problem.

kplcjl 17 Junior Poster

sorry fat-finger combined with fuzzy thoughts. ...numerics

kplcjl 17 Junior Poster

I also want programmers to understand, when they get to keypress control, their responsibility on how their app acts, goes through the roof because you've disabled so many built in controls, you could render your app useless.

For instance, FORMS implements for you, mouseless screen navigation because it was possible to have a computer without a mouse. You should implement that yourself in any keypress event handler, at least let the cursor leave the control when either tab key is hit. Part of the reason I don't want to have keypress event handles, is because I don't want to learn how they are sent and what signal is received when sent.

Programmers disable things, sometimes without a clue on what they are disabling. Accepting things written without being fully thought out is something normally done by everyone.

Hopefully, people realize mouseless is possible because once someone hits one of those form fields, their only options when mouseless is to hold down the power key (not counted as a keyboard key) for a minute or bring up task manager (no personal clue how to do that without a mouse), pick the app you are on, and kill it, removing any benefit the app might have had.

kplcjl 17 Junior Poster

deceptikon: I noticed your tag line:
"Respect is like a punch to the face. If you deserve it, you don't have to ask."
It's interesting because a single post can seem to gather both, causing you to wonder if you deserved either.

I'm kind of wondering about your tag. I seem remember seeing it years before transformers made it to the movies. Before that, they were silly/cool toys to me. Silly because I was an adult and above those things, cool because it reminded me of the toys I had as a kid and this was in reality, better than my imagination could make the ones I had.

Did you pick your name because of the transformer culture I never bothered to learn until I watched the movies?

I also applologize for how I handled this thread. My personal coding style is to treat the user as an adult, not some kid whose hand has to be slapped the second they slip on the keyboard. On the other hand, some apps make me regret they don't know about cntrl-Z. Some Nanny treatment by the programmer can be nice.

kplcjl 17 Junior Poster

Sorry for being so discourtious, you're right, it's obvious my brain opperates at a different level.

kplcjl 17 Junior Poster

Help whom? The original poster is 3 years gone.
I certainly would be pissed at a control that didn't let me use the arrow keys, the backspace key, the delete key. Those are part and parcel of a numeric entry. What if the number is real? How about negative numbers?
Personally, I like to be told after the fact that I screwed up, not the machine going dead with no clue what I'm screwing up.

ddanbe commented: Good point! +15
kplcjl 17 Junior Poster

Sort of looks like a VB language version. Have no idea how that all works. In .NET you have Dictionary(TKey, TValue) Constructor (System.Collections.Generic) that can be used. This will NOT sort the data, but will efficiently determine if the word is unique. I don't see how the above code snippet could do that. You can set the TValue type to bool, value to true, and ignore it. You can then transfer the Keys list into an array and use the built-in array.Sort function.
If you aren't using .NET, I don't have the experience to help you.

TrustyTony commented: Out of topic, this is Python forum -3
kplcjl 17 Junior Poster

Of course you could get a single line instruction and use a loop by preceeding the above with
for (; 1 == 2; ) ;
You can make it a single line in a loop with:
for (int i=0; i < 1; i++)

kplcjl 17 Junior Poster

for the single line command challenge:

Console.WriteLine("        1\n      121\n    12321\n  1234321\n123454321\n  1234321\n    12321\n      121\n        1");

Of course that violates the "using a loop" constraint :)

kplcjl 17 Junior Poster

Of course after posting, I see misspelling of "backwards"

kplcjl 17 Junior Poster

No way would I try a one-liner. I tested this on 5 and 50 and both worked properly.

        /// <summary>
        /// Goes from 1 to 99, lists on Console the number list forward and backword
        /// Right adjusting the values. All values except the last number are repeated in reverse order
        /// IE if 5 is passed 123454321
        /// </summary>
        /// <param name="num"></param>
        static void stringlist(int num)
        {
            if (num < 0) num = -num;
            else if (num <= 1)
            {
                Console.WriteLine("1");
                return;
            }
            if (num > 99)
            {
                Console.WriteLine("Passed number ({0}) exceeds 100, setting to 99", num);
                num = 99;
            }
            List<string> forward = new List<string>();
            StringBuilder left = new StringBuilder(), right = new StringBuilder(), pad = new StringBuilder();
            int len = 0;
            for (int i = 1; i <= num; i++)
            {
                pad.Append("    ");
                left.Append(i);
                string x = left.ToString() + right.ToString();
                forward.Add(x);
                len = x.Length;
                right.Insert(0, i);
            }
            foreach (string x in forward)
                if (x.Length == len) Console.WriteLine(x);
                else Console.WriteLine("{0}{1}", pad.ToString(0, len - x.Length), x);
            for (int i = forward.Count - 2; i > -1; i--)//-2 points to the next to last number
                Console.WriteLine("{0}{1}", pad.ToString(0, len - forward[i].Length), forward[i]);
        }
kplcjl 17 Junior Poster

ddanbe: thanks for the endorsement. Caused me to relook at my code. Wait... That shouldn't work! Yep, didn't notice the last field isn't included in the List and it didn't work correctly. After the loop finishes, add:

            if (len > 0)
                SplittedStringList.Add(str.Substring(str.Length - ++len, --len));
kplcjl 17 Junior Poster

Whoops declare temp and never use it!

kplcjl 17 Junior Poster

I didn't want to read the comments because they would probably come up with good answers and I didn't want to spoil my thoughts before trying something.
There are several problems with this code. First off, strings are immutable. Every time you alter a string you add a new record into memory, when you reassign a variable to the new value the old value is put into garbage collection. Read up on interning, it might help you understand it better. Also read up on StringBuilder, it is designed to efficently do character math.
I messed up by not understanding what you were doing so it was good that I kept your original code as a control. Added one ; after a ;. Whoops had to fix that too. Anyway here is my alternate solution.

        static List<string> SplitWithDelimitersN(string str)
        {
            List<string> SplittedStringList = new List<string>();
            int len = 0;
            string temp = string.Empty;
            for (int i = 0; i < str.Length; i++)
            {
                if (char.IsLetterOrDigit(str[i]))
                    len++;
                else
                {
                    SplittedStringList.Add(str.Substring(i-len,len));
                    SplittedStringList.Add(str[i].ToString());
                    len=0;
                }
            }
            return SplittedStringList;
        }
kplcjl 17 Junior Poster

Also, in search put a bool in your loop to exit your search when you find the number you are looking for.

kplcjl 17 Junior Poster

Andreas, Personally prefer: array2[j++]=array[i];

In your search function you have hardcoded 10. What happens when there are 5 items in the array? What happens when there are 20 and the 15'th has the number you are looking for?

kplcjl 17 Junior Poster

One of the nice things C# has is the XML documentation. What's nice about that is that it activates intellisence so you can document it. Renaming the int parameter as suggested is a good idea because even if it is in a dll, you don't have to correct your calling code to a better method name. What's great about the IDE tool is that it automatically builds the doc format when you type in ///. (An extreme pain when you are writing code in notepad. 1. For the formatting. 2. no intellisense.) That also organizes it so the documentation applies to the part you are documenting. That too, won't affect things calling the ddl.

kplcjl 17 Junior Poster

FYI, when talking about secure logins, providing any information on the validity of either the userID or the password is a complete no-no. Instead of just passing the userID, pass both the userID and the encrypted password to the connection making sure both are part of the where clause.
It's beyond the scope of this routine, but it is a good practice to just allow the general user execute access to stored procedures, so this should call a procedure that returns the logon information information you want to retrieve.

kplcjl 17 Junior Poster

Congradulations, on solving it. A possible alternate solution would be to put the two forms into thread calls. That would free them from the parent thread and the calling form could close while they kept going.

kplcjl 17 Junior Poster

By the way, Big O notation on the web makes a big deal about the log you should use, which, according to what I've read should be the natural log. Which is total BS. I got completely different log numbers than you did because my log numbers were base 10, but the ratios exactly matched because a logarithm IS a log, which IS a log. Why I used base 10 is because it is extremely easy for me to calculate what the log of 10,000 is(4) or 100,000,000(8) in my head. 150,000,000 in my head isn't so easy, so I used my calculator which can also give me natural logn numbers. IE
8.17609... divide by 8 multiply by 1.5 voila 1.533017... Which gets into precision which is why I kept it to 4 places when the actual numbers only matched to 2 places.

kplcjl 17 Junior Poster

Arrg, paired asterisks denotes Italic so just before it goes in or out of Italic, imagine the asterisk.
Playing around with double ** asterisks. Ahh ** bold in typing, shows in preview.

kplcjl 17 Junior Poster

PS I didn't notice asterisks "*" were removed. My typing window suddenly went Italic at the second quote, the preview window shows everything including the asterisk in the quote. When I posted, it was gone. You need to imagine asterisks in the above note.

kplcjl 17 Junior Poster

Sorry, you're right, but my numbers weren't off. I said the expected increase should be 1.533 and said actual increase was 1.522. Those are not percentages, those are expected rate of increase vs. actual.
Expected increases are nLn, not straight Ln, So the numbers are 1.5 e718.826 vs 1.0 e718.421
18.82615/18.42068
1.5 == 1.533017510754217542457716001798 (1.5 e7/1.0 e7 == 1.5) Considering the variance of luck included in the algorithm those are close enough to call them even. Going from 100K to 1M the expected rate should be 12 times higher. The first one took 19 milliseconds, so expected is 228 milliseconds and actual was 228 ms.

kplcjl 17 Junior Poster

OK, I said that sorting using the method I suggested as an efficient method of sorting that should be logn. I then got the perception it was running at N efficiency. That was my mistake, after reviewing the numbers, I realized it really is working at logn, just that as you increase the numbers, logn begins to look just like N. For instance increasing the size from 100 to 150 million items with N, the time should increase by 1.5 times. With logn, it should increase by 1.533 times, when it actually increased by 1.522 times. The lower numbers should show more dramatic changes, for instance sorting 100 items should take 20 times as long as sorting 10 items. 0 milliseconds times 20 is still 0 milliseconds. The first time I could measure time was at 10K and at 2 milliseconds, it was in no way an accurate measure. Going from 100K to 1M should take 12 times as long and it increased exactly 12 times. This sort method is definitely logn and bubble is definitely N^2. (N^2 quadruples the time when the number doubles. 100K sorts in over 30 seconds and 200K sorts in over 2 minutes with a bubble sort. The binary sort will sort 100M items in over 30 seconds, 150M >46 seconds. I don't have the memory to do 200M.)