give example of a C++ program that sorts list of integers. The list should have a size of power of two. Example: list size = 2, 4, 8, 16…

Algorithm
1. Divide the array into two lists until a single element remains in any list

While merging given two sorted lists pull out the smallest element from the heads.

Recommended Answers

All 4 Replies

We won't do your homework for you. What have you tried?

give example of a C++ program that sorts list of integers. The list should have a size of power of two. Example: list size = 2, 4, 8, 16…

Algorithm
1. Divide the array into two lists until a single element remains in any list

While merging given two sorted lists pull out the smallest element from the heads.

I can play that game too.

We won't do your homework for you. What have you tried?

I normally (just as decepticon) don't give solutions to homework.
I'll make an exception this time:

ref class Resource
{
private:
  bool disposed;
public:
  Resource()
  {
    disposed = false;
  }

  ~Resource() // IDisposable
  {
    Dispose(true);
  }

protected:
  !Resource() // Finalize
  {
    Dispose(false);
  }

  void Dispose(bool disposing)
  {
    if (disposing)
    {
      // dispose managed resources
    }
    // dispose unmanaged resources

    disposed = true;
  }
};
Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.