Professional Responsibilities for Project Managers: A Quick Review #PMP – Project Management

Professional Responsibilities for Project Managers
Simply: Handle any issue directly, ethically, and legally. Be open and upfront. Solve issues quickly, openly,fairly.Be direct to solve an issue rather than ignoring it.

Professional Responsibility deals with:
1. Responsibilities to the profession
2. Responsibilities to the customers and the public

Responsibilities to the profession:
1. Compliance with all organizational rules
2. Advancement of the profession

Responsibilities to the customers and the public:
1. Responsibility to provide accurate and truthful information/representation to the public
2. Maintain and satisfy the responsibilities of professional services
3. Maintain and respect the confidentiality and sensitivity of information
4. Conflict of interest should not affect customers badly
5. Do not take bribes

Professional Responsibility can be categorized in five areas such as:
Integrity and professionalism
Contribute to knowledgebase
Improve individual competence
Balance stakeholders interest
Interact with Team and stakeholders

Integrity and professionalism
shortly:Always do the right thing.
Laws:Comply with all rules. Comply with the rules of the city/state/country where the project is taking place. If the project deals with any other country – it may be needed to comply with the rules of that country[before that knowing the legal rules of the other country is important].
Policies:Comply with organizational policies
Integrity:Stick with high moral principles
Professionalism:
–Processes: Maintain and execute the processes required for the project. PMI suggests 44 processes. Following these processes reduces risk and improves time, cost,efficiency. Carry out the processes required accordingly even the customers want a shortcut way.
–Respect:
show respect to othersPMI strongly advocates multiculturalism and encourages to be respectful to other culturesMaintaining confidentiality of client information is also important.

Contribute to knowledgebase
–Share the experince with PMI and with other professionals in the field
–PMI encourages to teach, publish, write, disseminate the PMI aspect of Project Management

Improve individual competence
–PMI encourages all professionals(PMPs) in this field to improve them and to gain more knowledge continuously.
–Know your professional weaknesses and try to improve them

Balance Stakeholder Interests
Interests of stakeholders may collide.
Be fair, open, direct, ethical in solving the conflicts
-Resolve the conflict in favor of the customer interest[benefit]

Interact with Team and stakeholders
–Communication should be open
–Cultural differences should be respected
–Laziness and negligence should not be tolerated

Social-Economic-Environmental-Sustainability
-If a project makes the society suffer, creates an environmental problem, the project manager should disclose theinformation and should try to avoid such situations. If needed the project manager should resign the project.

From: http://sitestree.com/?p=4766
Categories:PMP – Project Management
Tags:
Post Data:2010-12-11 06:19:48

Shop Online: https://www.ShopForSoul.com/
(Big Data, Cloud, Security, Machine Learning): Courses: http://Training.SitesTree.com
In Bengali: http://Bangla.SaLearningSchool.com
http://SitesTree.com
8112223 Canada Inc./JustEtc: http://JustEtc.net (Software/Web/Mobile/Big-Data/Machine Learning)
Shop Online: https://www.ShopForSoul.com/
Medium: https://medium.com/@SayedAhmedCanada

Some Topics on Project Communication Management #PMP – Project Management

Some Topics on Project Communication Management


For bigger projects communication also needs to be preplanned and executed effectively. Though based on circumstances the plan may be reviewed and changed.

Overview

  • Project communication can be very tricky and political
  • Deals with Compiling, Sending, Storing, distributing and managing project record
  • Handles four areas:What to communicate, to whom, how often, when

Mushroom Project Management

Managing projects by keeping everybody in the dark and checking progress periodically rather than distributing accurate project information timely and to the right audience.

Communication Management Sub Topics

Planning (Communications Planning)
Executing (Information Distribution)
Monitoring and Controlling (Performance reporting and manage stakeholders)

Definign these lines of communication and informing the plan to the stakeholders (and executing accordingly) may reduce conflict and encourage team spirit.

Role of Project Manager

Mostly communication. Communication more than decision making. 90% time in communication where 50% with the project team.

Communication Management Sub Topics

Planning (Communications Planning)

-output: Communication management plan
-How often
-Media/format-email, web, meeting
-what information
-to whom

Several things contribute in Communications Planning such as Enterprise Environmental Factors, Organizational Process Assets, Project Management Plan, Project Scope Statement.

Tools:

Communication Channels: Determine the path of communications. N people can communicate in n(n-1)/2 ways. A subset may be selected. Sometimes, determination of official channel of communication is important. Technology like netmeeting, video-conferencing may also be used in communicating.

Communication management plan:

-who should be informed
-what
-who will send
-Method of sending
-Update how often
-Define terms

Executing (Information Distribution)

Communications Model

–Active Listening
–Effective Listening
–Feedback
–Non Verbal
–Paralingual

Methods Of communication

Informal Written
Formal Written
Informal Verbal
Formal Verbal

Monitoring and Controlling (Performance reporting and manage stakeholders)

….

Note: Here project management is described according to the PMI and PMBOK(Project Management Body of Knowledge)

From: http://sitestree.com/?p=4765
Categories:PMP – Project Management
Tags:
Post Data:2010-07-15 22:53:01

Shop Online: https://www.ShopForSoul.com/
(Big Data, Cloud, Security, Machine Learning): Courses: http://Training.SitesTree.com
In Bengali: http://Bangla.SaLearningSchool.com
http://SitesTree.com
8112223 Canada Inc./JustEtc: http://JustEtc.net (Software/Web/Mobile/Big-Data/Machine Learning)
Shop Online: https://www.ShopForSoul.com/
Medium: https://medium.com/@SayedAhmedCanada

Initiate a Project #PMP – Project Management

Initiating Projects

How a project starts?

Projects are done for one of the following three reasons
Business Requirements: Example: The government requires airline companies to implement safety-management systems. A company needs to find out the success of their ecommerce web-site.

Opportunities:To take advantage of an opportunity like technology breakthrough. Example: many projects may be planned targeting iPhone.

Problem: To reduce/eliminate a problem. Airport x faces 2/3 accidents every year, the airport authority may wish to perform a project to identify causes and develop solutions.

How a project is selected?
Project Selection:
A particular project may have different alternative solutions. A company may have multiple project plans and they need to select one of them.
But How?

1. Scoring Model: Identify some matrix to find which project strategy is better or which project will be more profitable. Assign values for these parameters and select which one provides greater value.

2. Benefit contribution: Use cost benefit analysis, short term and long term cost benefit analysis.

3. Economic models:

Benefit Cost Ratio
Cash Flow
Internal Return Rate
Present Value and Net Present Value
Opportunity Cost
Discounted Cash Flow
Return on Investment

Will a project succeed?

There are many mathematical models to justify/predict the success of a project.

Do we need to consider project stakeholders?

Yes. Because the project may benefit some people and may cause dis-advantages to some people. Project managers need to manage and convince both of the groups.

How a project is formalized?

A project charter is developed to present the business needs and the outcome. It is just a document that is reviewed before (or for)project authorization.

Input to Developing the project Charter

Contract
Statement of Work
Enterprise environmental factors
Organizational process assets

Tools for Developing the project Charter

Project Selection Methods
Project Management Methodology
Project management information systems
Expert Judgement

Output of Developing the project Charter

Project Justification
Project description
Project requirements
Assumptions
High level schedule and milestones
Budget
Proposed project manager

Preliminary Project Scope Statement

After a project charter is authorized. A Preliminary Project Scope Statement may need to be developed. It may be discussed with the project stakeholders to facilitate project success.

Input to Developing Project Scope Statement

Similar to the inputs to Developing the project Charter
Tools and Techniques

Project Management Methodology
Project Management Information System

Preliminary Project Scope Statement lists:

Objectives
The product
Requirements of the product
Project boundaries
Initial work breakdown structure
Schedule
Team
Risks
Cost estimate From: http://sitestree.com/?p=4764
Categories:PMP – Project Management
Tags:
Post Data:2011-06-24 22:48:04

Shop Online: https://www.ShopForSoul.com/
(Big Data, Cloud, Security, Machine Learning): Courses: http://Training.SitesTree.com
In Bengali: http://Bangla.SaLearningSchool.com
http://SitesTree.com
8112223 Canada Inc./JustEtc: http://JustEtc.net (Software/Web/Mobile/Big-Data/Machine Learning)
Shop Online: https://www.ShopForSoul.com/
Medium: https://medium.com/@SayedAhmedCanada

Review: Overview of Project Management #PMP – Project Management

Overview of Project Management [Source Internet]


What is a project?
A project is an activity that using plans and processes creates a product, a service, or a result. A product is a physical product like a TV, a service is like the Internet, a website; result [analytical model, proof of something] is the knowledge based outcome of a research project. Project is a continuous process that takes an idea/concept, targets an outcome, plans how to get the outcome, uses several processes/activities to gain the outcome. Applies monitoring and controlling to get the desired outcome timely.

Difference between projects and operations?


Operation is not a project, operations are done to keep something/an organization going. For a University, taking classes, conducting researches are operations. For a food shop, selling foods is an operation. But the process to create a University or a food shop is a project. Software development process is mostly project oriented.

Project Phases


A project has some definite phases such as:
Initiating
Planning
executing
Monitoring
closing

Initiate: Start a project
Plan: Plan how to achieve the goal. Plan regarding execution and monitoring.
Execute: Execute the plans to achieve the goal.
Monitor: Monitor the progress of the project. Modify plans and also modify execution.
Close: Close with project when goal is achieved

Project Knowledge Area


Each project needs to use some knowledge and skills to attain it’s goals. Projects use processes to get the result. Each process may address one aspect of the project. Each process requires raw input, tool and techniques and produces some output. Each of the processes may require knowledge in one area. Common project knowledge areas are:

1. Project scope management
2. Project time management
3. Project cost management
4. Project human resource management
5. Project procurement management
6. Project risk management
7. Project quality management
8. Project integration management
9. Project communication management

How Projects are affected by the style of the organization


1. Functional Organization:


Each functional department is a separate entity. Projects are done usually within a functional unit independent of other units. If the help of other units is required, it is done through the hierarchy of the functional managers. Usually an unit has a manager. Based on the size, each unit may have multiple managers with hierarchy.Such organization may not carry out many projects, project managers may not be so important, project managers may be just part-time with little/no authority.

2. Projected Organization:


Organized around projects. They mostly do projects. Most resources are invested for projects. Here, project managers have the supreme authority and usually are full time.

3. Matrix Organization:


Just a mix of the functional and projected organizations. The matrix may be strong in projected area and weak in functional area or vice versa.

Terms you need to know in Project Management


Project
Organization
Project stakeholder
Process
Knowledge Area
Performing organization
Project management
Program
Program Management
Program Management Office

Project Knowledge Area-Sub Areas


1. Project scope management

Scope Plan
Scope definition
Work breakdown structure
Scope control
Scope verification

2. Project time management

Activity definition
Activity sequencing
Activity resource estimating
Activity duration
Schedule development
Schedule control

3. Project cost management
Cost estimate
Cost budgeting
Cost control

4. Project human resource management

Planning human resources
Acquiring the project team
Developing the project team
Managing the project team

5. Project procurement management

Manage acquiring products

6. Project risk management

Plan the risk management
Identify the risks
Perform risk analysis
Develop a risk resource plan
Monitor and control risks

7. Project quality management

Quality planning
Quality assurance
Quality control

8. Project integration management

Developing the project management plan
Directing and managing project execution
Monitoring and controlling the project work
closing the project

9. Project communication management

Plan communication
Distribute needed information to the stakeholders
Report project performance and status
Communicate to resolve issues among the stakeholders From: http://sitestree.com/?p=4763
Categories:PMP – Project Management
Tags:
Post Data:2012-06-10 13:01:57

Shop Online: https://www.ShopForSoul.com/
(Big Data, Cloud, Security, Machine Learning): Courses: http://Training.SitesTree.com
In Bengali: http://Bangla.SaLearningSchool.com
http://SitesTree.com
8112223 Canada Inc./JustEtc: http://JustEtc.net (Software/Web/Mobile/Big-Data/Machine Learning)
Shop Online: https://www.ShopForSoul.com/
Medium: https://medium.com/@SayedAhmedCanada

Ajax: Basic Operations Code #Programming Code Examples #Ajax #Ajax


Get a handle to XMLHttpRequest object

 function getAjaxObject(){

    var ajaxObject = false;

    if (window.XMLHttpRequest){

         ajaxObject = new XMLHttpRequest();

    }else if (window.ActiveXObject) {
      try{
        ajaxObject = new ActiveXObject("Msxml2.XMLHTTP");

      }catch(e){
         try{
          ajaxObject = new ActiveXObject("Microsoft.XMLHTTP");

         }catch(e){
           ajaxObject = false;

         }

      }
    }
    return ajaxObject; 

  }



use of onreadystatechange

if (ajaxObject){
//takeAction - reference to a function
   ajaxObject.onreadystatechange = takeAction; 
}



Sample code:

 var ajaxObject = getAjaxObject();

 if (ajaxObject ){
    ajaxObject.onreadystatechange = takeAction; 

    ajaxObject.open("POST","file.jsp", true);

    ajaxObject.setRequestHeader("Content-type", "application/x-www-form-urlencoded");

    ajaxObject.send("id=500&name=keith&age=18");

 }



function takeAction(ajaxObject){
  if (ajaxObject.readyState == 4) {

     //do something with the response
  }
 }


function takeAction(ajaxObject){

  if (ajaxObject.readyState == 4) {

     if (ajaxObject.status == 200 || ajaxObject.status == 304){ //response was sent succesfully 

          //do something with the response
     }
  }
 }



function takeAction(ajaxObject){
  if (ajaxObject.readyState == 4) {

     if (ajaxObject.status == 200 || 
ajaxObject.status == 304){ 
//response was sent succesfully 

          //do something with the response
          alert(ajaxObject.responseText);

     }
  }
 }






function getAjaxObject(){
    var ajaxObject = false;
    if (window.XMLHttpRequest){

         ajaxObject = new XMLHttpRequest();
    }else if (window.ActiveXObject) {

      try{
        ajaxObject = new ActiveXObject("Msxml2.XMLHTTP");

      }catch(e){
         try{
          ajaxObject = new ActiveXObject("Microsoft.XMLHTTP");

         }catch(e){
           ajaxObject = false;
         }

      }
    }
    return ajaxObject; 
  }

  function entryPoint(){

    var ajaxObject = getAjaxObject();

     if (ajaxObject ){
    ajaxObject.onreadystatechange = function(){

      takeAction(ajaxObject); 
    };
    ajaxObject.open("POST","file.jsp", true);

    ajaxObject.setRequestHeader("Content-type", "application/x-www-form-urlencoded");

    ajaxObject.send("id=500&name=keith&age=18");

 }
 }
 function takeAction(ajaxObject){
  if (ajaxObject.readyState == 4) {

     if (ajaxObject.status == 200 || ajaxObject.status == 304){
 //response was sent succesfully 

          //do something with the response
          alert(ajaxObject.responseText);

          var testDiv = document.getElementById("test");

          testDiv.innerText = ajaxObject.responseText; 

     }
  }
 }



Processing Response Data:

var data = ajaxObject.responseXML;

data.getElementsByTagName("name")

data.getElementsByTagName("name")[0]

data.getElementsByTagName("name")[0].firstChild

data.getElementsByTagName("name")[0].firstChild.nodeValue


JSON Example:

{"person":{ "name":"Keith Tang", "school":"uofm" } } 

var data = eval('('+ ajaxObject.responseText +')');
var name = data.person.name;
var school = data.person.school; 



if (ajaxObject.status == 200 || ajaxObject.status == 304){ 
//response was sent succesfully 
          //do something with the response

          alert(ajaxObject.responseText);
          var testDiv = document.getElementById("test");

          testDiv.innerHTML = ajaxObject.responseText; 

     }




Note: Brought from our old site: http://www.salearningschool.com/example_codes/ on Jan 2nd, 2017 From: http://sitestree.com/?p=10178
Categories:Programming Code Examples, Ajax, Ajax
Tags:AjaxAjax
Post Data:2017-01-02 16:04:23

Shop Online: https://www.ShopForSoul.com/
(Big Data, Cloud, Security, Machine Learning): Courses: http://Training.SitesTree.com
In Bengali: http://Bangla.SaLearningSchool.com
http://SitesTree.com
8112223 Canada Inc./JustEtc: http://JustEtc.net (Software/Web/Mobile/Big-Data/Machine Learning)
Shop Online: https://www.ShopForSoul.com/
Medium: https://medium.com/@SayedAhmedCanada

Use bitset with enum together #Programming Code Examples #C++ #Bitset


 
 

/* The following code example is taken from the book

 * "The C++ Standard Library - A Tutorial and Reference"
 * by Nicolai M. Josuttis, Addison-Wesley, 1999

 *
 * (C) Copyright Nicolai M. Josuttis 1999.
 * Permission to copy, use, modify, sell and distribute this software

 * is granted provided this copyright notice appears in all copies.
 * This software is provided "as is" without express or implied

 * warranty, and with no claim as to its suitability for any purpose.
 */
#include <bitset>

#include <iostream>
using namespace std;

int main()
{
    /* enumeration type for the bits

     * - each bit represents a color
     */
    enum Color red, yellow, green, blue, white, black, //...,

                 numColors };

    // create bitset for all bits/colors
    bitset<numColors> usedColors;

    // set bits for two colors
    usedColors.set(red);
    usedColors.set(blue);


    // print some bitset data
    cout << "bitfield of used colors:   " << usedColors
         << endl;
    cout << "number   of used colors:   " << usedColors.count()

         << endl;
    cout << "bitfield of unused colors: " << ~usedColors
         << endl;

    // if any color is used

    if (usedColors.any()) {
        // loop over all colors
        for (int c = 0; c < numColors; ++c) {

            // if the actual color is used
            if (usedColors[(Color)c]) {

                //...
            }
        }
    }
}

/* 
bitfield of used colors:   001001

number   of used colors:   2
bitfield of unused colors: 110110

 */        
  

Note: Brought from our old site: http://www.salearningschool.com/example_codes/ on Jan 2nd, 2017 From: http://sitestree.com/?p=10185
Categories:Programming Code Examples, C++, Bitset
Tags:C++Bitset
Post Data:2017-01-02 16:04:23

Shop Online: https://www.ShopForSoul.com/
(Big Data, Cloud, Security, Machine Learning): Courses: http://Training.SitesTree.com
In Bengali: http://Bangla.SaLearningSchool.com
http://SitesTree.com
8112223 Canada Inc./JustEtc: http://JustEtc.net (Software/Web/Mobile/Big-Data/Machine Learning)
Shop Online: https://www.ShopForSoul.com/
Medium: https://medium.com/@SayedAhmedCanada

Transform binary representation into integral number using bitset #Programming Code Examples #C++ #Bitset


 
 

/* The following code example is taken from the book

 * "The C++ Standard Library - A Tutorial and Reference"
 * by Nicolai M. Josuttis, Addison-Wesley, 1999

 *
 * (C) Copyright Nicolai M. Josuttis 1999.
 * Permission to copy, use, modify, sell and distribute this software

 * is granted provided this copyright notice appears in all copies.
 * This software is provided "as is" without express or implied

 * warranty, and with no claim as to its suitability for any purpose.
 */
#include <bitset>

#include <iostream>
#include <string>
#include <limits>
using namespace std;

int main()

{
    /* print some numbers in binary representation
     */
    cout << "267 as binary short:     "

         << bitset<numeric_limits<unsigned short>::digits>(267)
         << endl;

    cout << "267 as binary long:      "

         << bitset<numeric_limits<unsigned long>::digits>(267)
         << endl;

    cout << "10,000,000 with 24 bits: "

         << bitset<24>(1e7<< endl;

    /* transform binary representation into integral number
     */

    cout << ""1000101011" as number:  "
         << bitset<100>(string("1000101011")).to_ulong() << endl;

}

 /* 
267 as binary short:     0000000100001011
267 as binary long:      00000000000000000000000100001011

10,000,000 with 24 bits: 100110001001011010000000
1000101011" as number:  555

 */       
  

// create a bitset that is 8 bits long
bitset<8> bs;
// display that bitset
for( int i = (int) bs.size()-1; i >= 0; i-- ) {
cout < < bs[i] << " ";
}
cout < bs2( (long) 131 );
// display that bitset, too
for( int i = (int) bs2.size()-1; i >= 0; i-- ) {
cout < < bs2[i] << " ";
}
cout << endl;

Note: Brought from our old site: http://www.salearningschool.com/example_codes/ on Jan 2nd, 2017 From: http://sitestree.com/?p=10184
Categories:Programming Code Examples, C++, Bitset
Tags:C++Bitset
Post Data:2017-01-02 16:04:23

Shop Online: https://www.ShopForSoul.com/
(Big Data, Cloud, Security, Machine Learning): Courses: http://Training.SitesTree.com
In Bengali: http://Bangla.SaLearningSchool.com
http://SitesTree.com
8112223 Canada Inc./JustEtc: http://JustEtc.net (Software/Web/Mobile/Big-Data/Machine Learning)
Shop Online: https://www.ShopForSoul.com/
Medium: https://medium.com/@SayedAhmedCanada

Read file content #Programming Code Examples #C++ #File


#include <iostream>
#include <fstream>
using namespace std;

int main()
{
  ifstream in("test", ios::in | ios::binary);

  if(!in) {
    cout << "Cannot open input file.n";
    return 1;
  }

  double num;
  char str[80];

  in.read((char *) &num, sizeof(double));
  in.read(str, 14);
  str[14] = ''; // null terminate str

  cout << num << ' ' << str;

  in.close();

  return 0;
}

Note: Brought from our old site: http://www.salearningschool.com/example_codes/ on Jan 2nd, 2017 From: http://sitestree.com/?p=10197
Categories:Programming Code Examples, C++, File
Tags:C++File
Post Data:2017-01-02 16:04:23

Shop Online: https://www.ShopForSoul.com/
(Big Data, Cloud, Security, Machine Learning): Courses: http://Training.SitesTree.com
In Bengali: http://Bangla.SaLearningSchool.com
http://SitesTree.com
8112223 Canada Inc./JustEtc: http://JustEtc.net (Software/Web/Mobile/Big-Data/Machine Learning)
Shop Online: https://www.ShopForSoul.com/
Medium: https://medium.com/@SayedAhmedCanada

A Simple C++ Program #Programming Code Examples #C++ #File


#include <iostream>
#include <fstream>
using namespace std;

int main()
{
  ifstream in("test", ios::in | ios::binary);

  if(!in) {
    cout << "Cannot open input file.n";
    return 1;
  }

  double num;
  char str[80];

  in.read((char *) &num, sizeof(double));
  in.read(str, 14);
  str[14] = ''; // null terminate str

  cout << num << ' ' << str;

  in.close();

  return 0;
}

Note: Brought from our old site: http://www.salearningschool.com/example_codes/ on Jan 2nd, 2017 From: http://sitestree.com/?p=10196
Categories:Programming Code Examples, C++, File
Tags:C++File
Post Data:2017-01-02 16:04:23

Shop Online: https://www.ShopForSoul.com/
(Big Data, Cloud, Security, Machine Learning): Courses: http://Training.SitesTree.com
In Bengali: http://Bangla.SaLearningSchool.com
http://SitesTree.com
8112223 Canada Inc./JustEtc: http://JustEtc.net (Software/Web/Mobile/Big-Data/Machine Learning)
Shop Online: https://www.ShopForSoul.com/
Medium: https://medium.com/@SayedAhmedCanada

Use sorting criterion in sort function #Programming Code Examples #C++ #Std Algorithms

/* The following code example is taken from the book
 * "The C++ Standard Library - A Tutorial and Reference"
 * by Nicolai M. Josuttis, Addison-Wesley, 1999
 *
 * (C) Copyright Nicolai M. Josuttis 1999.
 * Permission to copy, use, modify, sell and distribute this software
 * is granted provided this copyright notice appears in all copies.
 * This software is provided "as is" without express or implied
 * warranty, and with no claim as to its suitability for any purpose.
 */

#include <iostream>
#include <vector>
#include <deque>
#include <list>
#include <set>
#include <map>
#include <string>
#include <algorithm>
#include <iterator>
#include <functional>
#include <numeric>

/* PRINT_ELEMENTS()
 * - prints optional C-string optcstr followed by
 * - all elements of the collection coll
 * - separated by spaces
 */
template <class T>
inline void PRINT_ELEMENTS (const T& coll, const char* optcstr="")
{
    typename T::const_iterator pos;

    std::cout << optcstr;
    for (pos=coll.begin(); pos!=coll.end(); ++pos) {
        std::cout << *pos << ' ';
    }
    std::cout << std::endl;
}

/* INSERT_ELEMENTS (collection, first, last)
 * - fill values from first to last into the collection
 * - NOTE: NO half-open range
 */
template <class T>
inline void INSERT_ELEMENTS (T& coll, int first, int last)
{
    for (int i=first; i<=last; ++i) {
        coll.insert(coll.end(),i);
    }
}

using namespace std;

void printCollection (const list<int>& l)
{
    PRINT_ELEMENTS(l);
}

bool lessForCollection (const list<int>& l1, const list<int>& l2)
{
    return lexicographical_compare
                (l1.begin(), l1.end(),   // first range
                 l2.begin(), l2.end());  // second range
}

int main()
{
    list<int> c1, c2, c3, c4;

    // fill all collections with the same starting values
    INSERT_ELEMENTS(c1,1,5);
    c4 = c3 = c2 = c1;

    // and now some differences
    c1.push_back(7);
    c3.push_back(2);
    c3.push_back(0);
    c4.push_back(2);

    // create collection of collections
    vector<list<int> > cc;

    cc.push_back(c1);
    cc.push_back(c2);
    cc.push_back(c3);
    cc.push_back(c4);
    cc.push_back(c3);
    cc.push_back(c1);
    cc.push_back(c4);
    cc.push_back(c2);

    // print all collections
    for_each (cc.begin(), cc.end(),
              printCollection);
    cout << endl;

    // sort collection lexicographically
    sort (cc.begin(), cc.end(),    // range
          lessForCollection);      // sorting criterion

    // print all collections again
    for_each (cc.begin(), cc.end(),
              printCollection);
}
/*
1 2 3 4 5 7
1 2 3 4 5
1 2 3 4 5 2 0
1 2 3 4 5 2
1 2 3 4 5 2 0
1 2 3 4 5 7
1 2 3 4 5 2
1 2 3 4 5

1 2 3 4 5
1 2 3 4 5
1 2 3 4 5 2
1 2 3 4 5 2
1 2 3 4 5 2 0
1 2 3 4 5 2 0
1 2 3 4 5 7
1 2 3 4 5 7

 */

Note: Brought from our old site: http://www.salearningschool.com/example_codes/ on Jan 2nd, 2017 From: http://sitestree.com/?p=10193
Categories:Programming Code Examples, C++, Std Algorithms
Tags:C++Std Algorithms
Post Data:2017-01-02 16:04:23

Shop Online: https://www.ShopForSoul.com/
(Big Data, Cloud, Security, Machine Learning): Courses: http://Training.SitesTree.com
In Bengali: http://Bangla.SaLearningSchool.com
http://SitesTree.com
8112223 Canada Inc./JustEtc: http://JustEtc.net (Software/Web/Mobile/Big-Data/Machine Learning)
Shop Online: https://www.ShopForSoul.com/
Medium: https://medium.com/@SayedAhmedCanada