deceptikon 1,790 Code Sniper Team Colleague Featured Poster

The problem is that strtok() won't tell you when a token isn't present, so you need some extra logic to identify tokens either by special characteristics or by expected position. Comments are easy because they're always led by a semicolon, but the others can be tricky. For example, if both the label and instruction can be any string, how do you know if you got a label but no instruction or an instruction but no label?

You explained what you're trying to do quite nicely, but that wasn't what I asked for. I asked for details about the assembly format. I hope that your instructor didn't invent something ambiguous that's difficult to parse, because that would just be cruel.

deceptikon 1,790 Code Sniper Team Colleague Featured Poster

why array size is different inside function solution1?

Because the "array" in solution1 isn't an array, it's a pointer. Don't be tricked by the array-like syntax of int array[] in a function parameter declaration, it's just syntactic sugar and equivalent to int *array.

deceptikon 1,790 Code Sniper Team Colleague Featured Poster

compile type operator ?

Compile time operator. It means that the compiler already has all of the information it needs while compiling the code. The vast majority of this information is discarded by the time the code actually runs, which puts you at a significant disadvantage when trying to simulate compile time operations.

deceptikon 1,790 Code Sniper Team Colleague Featured Poster

C has no references, so you'd use a pointer to a pointer. The concept of using a pointer to an object to modify the object can be applied recursively, and the "object" you need to modify can be a pointer.

deceptikon 1,790 Code Sniper Team Colleague Featured Poster

If any admin or anybody has problem with me(as i am nothing in front of them), then they can ban me any time. thnaks.

That's not how it works. If you break the rules enough to accumulate too many infraction points, you'll be banned automatically by the system. Otherwise, you'll not be banned...ever.

deceptikon 1,790 Code Sniper Team Colleague Featured Poster

any response will be highly apprciated.

When you down vote every response for frivolous and trivial reasons, I'm disinclined to do so. Goodbye.

deceptikon 1,790 Code Sniper Team Colleague Featured Poster

Try this one. :rolleyes:

deceptikon 1,790 Code Sniper Team Colleague Featured Poster

I'll give you a hint: check your array indices where the element is being set to 0. You're overrunning one of your arrays and count happens to be at that address.

nitishok commented: thanks. it works with a return; added in if(i==8) +0
deceptikon 1,790 Code Sniper Team Colleague Featured Poster

This is a parsing problem, not a simple tokenizing problem. Do you have more details as to the format of the instructions? It looks like you're attempting to write a program that reads assembly-like instructions and break them down into component parts. For that I wouldn't use strtok() as the only solution.

deceptikon 1,790 Code Sniper Team Colleague Featured Poster

You should be using floating point variables if you need precision below 0, otherwise all of your weights are going to be 0.

deceptikon 1,790 Code Sniper Team Colleague Featured Poster

i isn't 0, so the first part of the logical AND succeeds. i is then incremented. Next j isn't 0, so the second part of the logical AND succeeds. j is incremented. The OR part of the test isn't performed due to short circuiting and m is set to a true value.

You can change how things work by making either i or j zero initially such that the AND part of the test fails. This will force the OR part of the condition to be executed. Changing i to zero will result in an output of "2 1" because i is now incremented twice.

deceptikon 1,790 Code Sniper Team Colleague Featured Poster

can I get simple yes no answers and a small description to both answers?

I can certainly give you simple yes and no answers, but they'd be wrong because it's not that simple. Different variable locations result in different storage areas, and thus different RAM usage.

when we launch the program after compiling, does the program take 3 bytes of RAM space?

At least 3 bytes, yes. Exactly 3 bytes, no.

the more declarations ,the more momory it takes in RAM??

No. Let's say you get a big box and toss a few small things into it, if you want to add more things, do you get a bigger box? No, you just toss the new things into the mostly empty big box. That's how the process stack works.

deceptikon 1,790 Code Sniper Team Colleague Featured Poster

Assuming that ptr is a pointer to a function, there's no difference. There are only two things you can do with a function: take its address and call it. Because of this limited operation set, the compiler can guess what you want to do from the context. If you're not calling the function then you're taking its address, and if you're not taking its address then you're calling it.

Because of that guessing, all kinds of address-of, indirection, and parentheses operators that are required for object pointers are unnecessary for function pointers.

deceptikon 1,790 Code Sniper Team Colleague Featured Poster

what :O .O.o ????

That's not a meaningful question. I'd like to think that you understood at least some subset of the words I used, so please specify which part of the explanation doesn't make sense and why. I'm happy to elaborate, if I have a clue of what to elaborate on.

deceptikon 1,790 Code Sniper Team Colleague Featured Poster

Firstly, We haven't discuss these type of things at any time.

Clearly you don't remember, but I do because I spent a lot of time explaining to you how arrays and pointers work. And I'm quite sure that I described the relationship both ways.

Secondly, You have used a hindi word "guru" ;) you are aware of hindi also ?

I'm aware of hindi, but "guru" is common in English too.

so what c[0],c[1],c[2] and so on are representing here ?

The bytes of the integer. Do some research on a concept called type punning. That's what's being done here.

deceptikon 1,790 Code Sniper Team Colleague Featured Poster

but matrix method is not well explained

Then I'd wager you need to focus on understanding matrix multiplication independent of calculating fibonacci numbers, because that's really all it is. The given algorithm in that link (converted to actual C) is just this:

void fib_r(int n, long mat[2][2])
{
    long f[2][2] = {{1, 1}, {1, 0}};
    long tmp[2][2];

    if (n > 1) {
        fib_r(n / 2, mat);
        fib_multiply(tmp, mat, mat);
        fib_copy(mat, tmp);
    }

    if (n % 2) {
        fib_multiply(tmp, mat, f);
        fib_copy(mat, tmp);
    }
}

long fib(int n)
{
    long mat[2][2] = {{1, 0}, {0, 1}};

    fib_r(n - 1, mat);

    return mat[0][0];
}

Another way to do it without recursion might look like this:

long fib(int n)
{
    long f[2][2] = {{1, 1}, {1, 0}};
    long mat[2][2] = {{1, 0}, {0, 1}};
    long tmp[2][2];

    for (; n; n /= 2) {
        if (n % 2) {
            fib_multiply(tmp, mat, f);
            fib_copy(mat, tmp);
        }

        fib_multiply(tmp, f, f);
        fib_copy(f, tmp);
    }

    return mat[0][0];
}

In both cases the lion's share of work is done by the matrix multiplication, and understanding how that comes to the conclusion with a good paper run would be a good idea:

void fib_copy(long dst[2][2], long src[2][2])
{
    int i, j;

    for (i = 0; i < 2; i++) {
        for (j = 0; j < 2; j++)
            dst[i][j] = src[i][j];
    }
}

void fib_multiply(long dst[2][2], long a[2][2], long b[2][2])
{
    int i, j, k;

    /* Clear the destination */
    for (i = …
deceptikon 1,790 Code Sniper Team Colleague Featured Poster

Can you tell me one thing that c is just a pointer, then how is it treated like an array ?

...seriously?

We've been over this so many times over the course of a few months now, I'd expect you to be a pointer guru at this point. :P

A pointer is not an array, but array indexing essentially becomes the dereference of an offset from a pointer. a[i] is equivalent to *(a + i), so it doesn't matter if a is a pointer or an array, you can use indexing syntax with both.

deceptikon 1,790 Code Sniper Team Colleague Featured Poster

Thanks for replying to my question with negative reputation, that totally makes me want to continue helping you. :rolleyes:

The "topic" you want is basically the whole of computer science and engineering, so you're not going to find a single source of information. You need to pick a specific topic and then search for that, then pick another specific topic and search for that. Just searching for "computer organization" will get you results, but not terribly useful results if you're expecting some sort or brain dump of everything there is to know.

deceptikon 1,790 Code Sniper Team Colleague Featured Poster

The 2 byte bit pattern of 512 is 0000 0010 0000 0000. The 2 byte bit pattern of 514 is 0000 0010 0000 0010. The one byte bit pattern of 2 is 0000 0010. You do the math.

deceptikon 1,790 Code Sniper Team Colleague Featured Poster

the more declarations ,the more momory it takes in RAM??

The usual situation is that each process is given a certain amount of stack space that the program can use for things like local variables and function call frames. Assuming those integers are stack objects then they'd be rolled up into the stack size and wouldn't increase the memory footprint of the program at runtime.

But there are other types of objects. Notable is static data, where the size is rolled up into the executable itself and if large, could have an impact on how much memory the running process uses when the executable is loaded.

what decides the capacity of a compiled program (exe).

Code instructions and static data (the so called text and data segments) are the two biggies for the size of an executable. Also note that static linking vs. dynamic linking will affect the size of the file because with the former libraries are stored within the executable.

You might consider looking into the Portable Executable (PE) format for Windows and the Executable and Linkable Format (ELF) format for POSIX to get an idea of how operating systems structure an executable file.

deceptikon 1,790 Code Sniper Team Colleague Featured Poster

The Fibonacci sequence. It is as np_complete said, with the addition that by definition Fib(0) == 0, Fib(1) == 1.

It's been established that nitin is going for the O(log n) approach using matrix exponentiation. I think (hope!) he already understands the "usual" implementation.

WaltP commented: Questionable ;o) +14
I_m_rude commented: awesome guess! ;) +0
deceptikon 1,790 Code Sniper Team Colleague Featured Poster

Please don't just post your homework assignment in the expectation that someone will do it for you. We require proof of effort, and then provide help, not free solutions for lazy people.

deceptikon 1,790 Code Sniper Team Colleague Featured Poster

Have you tried searching for those terms in google?

deceptikon 1,790 Code Sniper Team Colleague Featured Poster

What is this code trying to so ?

It's trying to create a simulated 2D array without calling malloc() for each row but still allow array indexing for both dimension. Let's say you want a 2D array, but the size must be a runtime value. malloc() is essentially your only option (barring C99 VLAs, but we'll ignore those for now).

There are basically three ways you can go about it. First is a straight allocation to a pointer:

#include "stdio.h"
#include "stdlib.h"

int main(void)
{
    int rows = 3, cols = 4;
    int *p = malloc(rows * cols * sizeof *p);
    int i, j, k = 0;

    /* Populate */
    for (i = 0; i < rows; ++i) {
         for (j = 0; j < cols; ++j)
             p[i * cols + j] = ++k;
    }

    /* Display */
    for (i = 0; i < rows; ++i) {
         for (j = 0; j < cols; ++j)
             printf("%4d", p[i * cols + j]);

         putchar('\n');
    }

    /* Release */
    free(p);

    return 0;
}

Notable in this option is only a single call to malloc(), but also the awkward indexing calculation. What we'd really like to do is index the simulated array just like we would a real 2D array: p[i][j]. But to do that we need to simulate a 2D array in the form that it would be as a real array, that is, each p[i] evaluates to a pointer to the first element of the subarray. This leads …

I_m_rude commented: bow to you james sir! hats off to you! +2
deceptikon 1,790 Code Sniper Team Colleague Featured Poster

I am getting this error when executing the code.

I guess you'll have to use the same logic and write working code then. ;)

deceptikon 1,790 Code Sniper Team Colleague Featured Poster

Here's pseudocode for what you're doing:

cx = 10

while cx <> 0
    while cx <> 0
        int 21h
        dec cx
    loop

    dec cx
loop

So cx starts out as 10 and gets decremented to 0 by the inner loop. Then the outer loop decrements it again to make it negative and tests it against zero. cx is obviously not zero at this point, so the outer loop repeats. cx is still not zero, so the inner loop repeats.

Now you're looking at an underflow situation, where the inner loop will repeat until cx underflows, and hopefully wraps back around to 0. But ultimately this code represents a bug and should be fixed.

My guess would be that you're trying to use cx to represent two things (rows and columns) but the two nested loops are stepping on each other. You can get around that by saving and restoring cx around the inner loop:

; Print a right triangle

mov cx, 10     ; Decreasing number of rows remaining
mov ax, 1      ; Increasing number of asterisks per row

rows:
    mov dx, cx ; Save cx for later
    mov cx, ax ; Use ax's value for the inner loop counter

    cols:
        int 21h
    loop cols

    mov cx, dx ; Restore cx for the outer loop
    inc ax     ; Add an asterisk for the next row
loop rows

Another alternative would be to eschew the loop instruction and do it manually with two registers instead of one.

deceptikon 1,790 Code Sniper Team Colleague Featured Poster

I have made it through only part a.

Then please post the code to prove you've done it. Our rules clearly state that we require proof of effort on homework.

b) allow user to print array in ascending or descending order.

I imagine either you've learned about bubble sort, or you're allowed to use Array.sort().

c) allow user to search for specific int value (you can use your code from part 2)

Presumably you've already done part 2, so what's the problem?

d) allow user to view max value, min value, average and standard deviation of the array values.

Can you do this manually? If you can't do something on paper with a handful of numbers then you have no hope of telling a computer how to do it.

e) user controls must be provided and can be as a command line prompt and response.

That's a fancy way of saying that you need a user menu for selecting which action to take and for acquiring the initial array size. But since you've accomplished part a, you shouldn't have any problems with this part either.

deceptikon 1,790 Code Sniper Team Colleague Featured Poster

Loops are programming 101. You really shouldn't be trying to write a GUI until you at least understand the most basic core concepts of the language. It's also not very wise to jump right in without any kind of beginner text; you should find yourself a book on VB.NET, any of them will do.

kvprajapati commented: Words :) +14
deceptikon 1,790 Code Sniper Team Colleague Featured Poster

Will i have two executables. Each for an environment?

Yes. Technically you could write an app for one environment and rely on emulation like Wine for running on the other environment, but if you want native support then there will be two executables.

Do i have to write two totally different codes for different enviroments.

It depends. If you use platform dependent APIs (such as Windows UI elements) or do a lot of system level stuff then there will be pieces of code that must be ported.

If yes, is there anyway to MAP the code from one enviroment to another.

Not so much, though you can use platform independent solutions wherever possible. And when you have no choice, isolate the non-portable code as much as possible by wrapping it in classes and functions that can be more easily swapped out with a different implementation.

deceptikon 1,790 Code Sniper Team Colleague Featured Poster

why havn't we yet heard of a story about a virus that burned out the whole hardware ?

Primarily because it's impractical for the same reason you don't hear about Linux or OSX viruses that often. The dependencies are fairly extreme, so the virus would only work on very specific hardware configurations.

is the OS protecting PC??

Defense mechanisms are in place, though not necessarily against malicious software. For example, if you've ever done any overclocking, you'll probably have encountered the situation where your processor overheats and the machine hard stops to avoid damage. That's a defense mechanism against overheating of the CPU.

Manually manging memory means, assigning every integer to memory by typing its address by the programmer.

That's not how it works, unless you're targeting a specific address like old DOS' real mode VGA locations. More often you're using the stack space provided by the OS and simply adjusting the stack pointer to reserve bytes for an object. Even in assembly language we don't manage memory in the way you've described unless our program is the operating system.

deceptikon 1,790 Code Sniper Team Colleague Featured Poster

maybe

Discussion of virus implementation is prohibited on Daniweb. But yes, it's possible to physically harm hardware through software, if one is so inclined.

Also "Does the programmer have to control memory manually in Assembly ?"

Yes, unless you call into a library that manages memory for you.

deceptikon 1,790 Code Sniper Team Colleague Featured Poster

Anyway, I just spent 10 minutes painting DW a manly Green

Maybe a lil' darker. The contrast isn't quite high enough with the white and gray (especially the gray) to really hit home as a good color scheme.

deceptikon 1,790 Code Sniper Team Colleague Featured Poster

Awesome! So i can display any error statement like this??

It depends on what you mean by "this". Note that what I showed you is the internal setup of perror() on my standard library implementation. You can't simply toss my __errno_map into your code and expect perror() to change how it works on the compiler you're using.

deceptikon 1,790 Code Sniper Team Colleague Featured Poster

how do you come to know about these types of links which you have given above ?

Programming is my hobby as well as my job, so I do a lot of reading on the subject. It should go without saying that I'll encounter interesting texts and web pages every now and again. ;)

deceptikon 1,790 Code Sniper Team Colleague Featured Poster

why the compiler need to search those header files which are not included in the main.c ?

Because there might be a definition of the variable or function in one of those other files. The headers that are included are already part of the translation unit, so the compiler can see them. Note that a translation unit is basically what the compiler works with after the preprocessor runs.

Can you explain your hard case again ?

I'm guessing you haven't worked with a command line compiler before. ;) Modern IDEs make multi-file projects easier to work with and build, but it can hide the nitty gritty aspects of building such as separate compilation.

C supports separate compilation in that you can compile some source files into an object file. That object file can then be used by the linker at any time without requiring you to recompile the original source files (unless they change).

The compiler and linker often run in the same invokation of a "compiler" program like gcc, or tcc (Turbo C's compiler), or bcc32 (Borland C++'s compiler), or cl (Microsoft's compiler). So you can pass in both source files for compilation and object files for linking all in the same command line (ie. gcc main.c impl.o).

And therein lies the problem, because the compiler can't see what's in those object files even though they might contain exactly the definitions that would suppress an undefined object or function error.

deceptikon 1,790 Code Sniper Team Colleague Featured Poster

Is this the list you're talking about??

For Microsoft's perror(), yes. Other implementations of the standard library may have different values of errno that are supported and different messages. For example, my implementation presently maps errno values like this:

extern struct _errno_mapping __errno_map[] = {
    {EDOM,     "EDOM",     "Domain error"},
    {EILSEQ,   "EILSEQ",   "Encoding error"},
    {ERANGE,   "ERANGE",   "Range error"},
    {EINVAL,   "EINVAL",   "Invalid argument"},
    {ENOENT,   "ENOENT",   "No such file or directory"},
    {ENOMEM,   "ENOMEM",   "Not enough memory"},
    {EIO,      "EIO",      "I/O error"},
    {ENFILE,   "ENFILE",   "Too many open files"},
    {EACCESS,  "EACCESS",  "Permission denied"},
    {EUNKNOWN, "EUNKNOWN", "Unknown error"},
    {ESETP,    "ESETP",    "Error setting file position"},
    {EGETP,    "EGETP",    "Error getting file position"},
    {ESFMT,    "ESFMT",    "Unexpected string format"},
    {-1,       "",         ""} /* Sentinel record with an invalid errno value */
};

Where the sentinel implicitly gets converted to "Unrecognized error" in strerror()'s implementation:

/*
    @description: 
        Maps the number in errnum to a message string.
*/
char *strerror(int errnum)
{
    size_t i;

    /* Simple case for no error */
    if (errnum == 0)
        return "No error";

    /* Look for a matching errno code */
    for (i = 0; __errno_map[i].code >= 0; ++i) {
        if (__errno_map[i].code == errnum)
            return (char*)__errno_map[i].msg;
    }

    return "Unrecognized error"; /* Give up ;) */
}
deceptikon 1,790 Code Sniper Team Colleague Featured Poster

There's another way to set the flags, or you can use another output method, but that's essentially the normal way to override cout's convenience behavior. I can't think of any clever way off the top of my head that isn't too awkward to be reasonable.

Any thoughts?

If it was on a test then you would have learned it in class or through homework. Though I can't help much unless you provide the exact question rather than paraphrasing it.

deceptikon 1,790 Code Sniper Team Colleague Featured Poster
cout << fixed << setprecision(7) << space << endl;

Don't forget to include <iomanip>, and take care with expectations when it comes to floating point arithmetic. The results are often approximations and can suffer from accumulated errors.

stengeljjj commented: This works to fix issue +0
deceptikon 1,790 Code Sniper Team Colleague Featured Poster

If at all there is a differnce between their execution times in the range of nanoseconds or picoseconds?

Execution is measured in "waste of programmer time" intervals that increase in direct proportion to the triviality of the statement.

Ancient Dragon commented: LOL +14
iamthwee commented: ha ha ha... ha +14
WaltP commented: Love it!! +14
deceptikon 1,790 Code Sniper Team Colleague Featured Poster

i would like to know is there any advantange or necessity for having loops in a linked lists.

Well, a circular linked list is itself a loop, and they're quite useful. Internal cycles strike me more as a bug or faulty logic (hence the need for detection algorithms), but there may be niche uses that I'm not aware of.

deceptikon 1,790 Code Sniper Team Colleague Featured Poster

And when i have declared a variable but didn't define it, then linker will give error, why not compiler ? isn't compiler don't know that this variable is not defined yet ?

As Walt said, the compiler doesn't know. It doesn't know because all it's compiling is a single translation unit, but the project could contain many files and many translation units, all in various stages of building. Here are two examples (of many) that make multi-file introspection a non-trivial and inefficient task:

  1. Simple Case ($ cc main.c impl.c): main.c declares foo, and foo is defined in impl.c. While compiling main.c the compiler would need to search through all other source and header files not included in main.c for the definition of foo before it could accurately produce a diagnostic message.

  2. Hard Case ($ cc main.c impl.o): main.c declares foo, and foo is defined in impl.c. But impl.c has already been compiled into impl.o, and the compiler doesn't have access to impl.c. Now it has to do part of the linker's job and search through impl.o for exported definitions of foo before it can correctly report undefined objects.

deceptikon 1,790 Code Sniper Team Colleague Featured Poster

"Best" is subjective and dependent on the needs of the situation, but a concise and reasonable generic solution is this one:

int count_set_bits(int value)
{
    int n = 0;

    while (value) {
        value &= value - 1;
        ++n;
    }

    return n;
}

The benefit of this algorithm over the more naive loop is that this one only iterates as many times as there are set bits. The naive loop would loop as many times as there are bits in the type and include an extra test for a set bit:

int count_set_bits(int value)
{
    int n = 0;
    size_t i;

    for (i = 0; i < sizeof value * CHAR_BIT; ++i) {
        if (value & 1)
            ++n;

        value >>= 1;
    }

    return n;
}

Further options make increasingly more assumptions about the machine, but they can be very quick relative to the loop options because there aren't any conditionals or jumps.

This is a page you might find informative for bit magic.

I_m_rude commented: very nice explained! ;) +2
deceptikon 1,790 Code Sniper Team Colleague Featured Poster

But that doesn't happen with other header files isn't it??

It has nothing to do with header files, the rules of C++ don't change just because you break your program down into different files. In fact, headers are nothing more than a glorified cut and paste. When you say #include "sum.h", the entire contents of the sum.h header file are textually pasted over that directive. So this:

#include<iostream>
#include "sum.h"
using namespace std;
int main()
{
    sum(5,4);
    displaysum();
    cin.get();
}

Becomes this:

// The entire contents of iostream go here
// The entire contents of sum.h go here
using namespace std;
int main()
{
    sum(5,4);
    displaysum();
    cin.get();
}

We directly use the functions?

You can directly use a member function without qualification inside the class definition because this is implied. So this:

class Foo {
    void Bar() { ... }
    void Baz()
    {
        Bar();
    }
};

Is equivalent to this:

class Foo {
    void Bar() { ... }
    void Baz()
    {
        this->Bar();
    }
};

Outside of a class definition, no such implicit object exists and the compiler will assume that an unqualified function call refers to a non-member function.

deceptikon 1,790 Code Sniper Team Colleague Featured Poster

is there any alternative to it?

Well, you could read the message and see that strcpy_s() is provided as a "safe" alternative. strcpy_s() is a part of the C11 standard (it's not standard at all in C++), but C11 was only ratified in January of this year, so there aren't any solid implementations of it yet.

But Microsoft bugged us with that stupid warning long before the bounds checked functions were included in C11, and C11 doesn't deprecate the non-range checked functions, so it doesn't excuse the warning at all. I always disable it from the project settings (Configuration Properties -> C/C++ -> Advanced -> Disable Specific Warnings). You can also disable it directly from code with this pragma:

#pragma warning(disable:4996)

But that hurts your code's portability.

deceptikon 1,790 Code Sniper Team Colleague Featured Poster

The problem here is the function ExecuteAddtion is not passing the result to the main class variable sum.

No, the problem is that you're expecting the two completely separate objects to magically communicate just because their types are related. It's no different from creating two integers, incrementing one, and expecting the other to be incremented too even though you did nothing with it.

WaltP commented: Quantum programming? It's real, isn't it? +14
deceptikon 1,790 Code Sniper Team Colleague Featured Poster

I'm sensing a confusion with pointers and aliasing. Have you played with Binky yet?

deceptikon 1,790 Code Sniper Team Colleague Featured Poster

I don't have any at the moment. Since you seem to like videos, try searching YouTube for linked list tutorials. I'm sure you'll find something decent enough with plenty of hand waving.

deceptikon 1,790 Code Sniper Team Colleague Featured Poster

This thread is for ideas only. The actual code snippets would be created as articles here.

deceptikon 1,790 Code Sniper Team Colleague Featured Poster

ok if time complexity increases will that algorithm be a flop????

Not necessarily, but an algorithm with poorer time complexity must be used judiciously. For example, you wouldn't use bubble sort for a general sort function because it has quadratic complexity and will perform badly on larger data sets. That's why any general sorting function in production quality libraries will use an algorithm that's at least O(n logn) in the average case.

deceptikon 1,790 Code Sniper Team Colleague Featured Poster

for wat reason we are taking time complexity into account????for wat purpose???

To give us an idea of how the algorithm scales as the amount of data grows.

bcoz all programmers cant take less steps for finishing an algorithm

I'm unable to translate your meaning from that sentence.