0

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.

Edited by SHE.RE

3
Contributors
4
Replies
13
Views
3 Years
Discussion Span
Last Post by ddanbe
0

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.

0

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;
  }
};
This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.