sorting assignment 1.txt - \/HW1\/Implement the three member functions of linked_list class bubble-sort selection-sort and insertion-sort\/as described in

sorting assignment 1.txt - /HW1/Implement the three...

This preview shows page 1 - 2 out of 4 pages.

//HW1 //Implement the three member functions of linked_list class: bubble-sort, selection-sort, and insertion-sort. //as described in the code blow //Due: 11:59pm, Friday, September 15 //Submit a text vesion of your program to blackboard //Linked List Examples by C-Y (Roger) Chen, Syracuse University #include "stdafx.h" #include <iostream> using namespace std; class node { public: int value; node * next; node() { next = nullptr; } node(int k) { value = k; next = nullptr; } }; class linked_list { public: int num_nodes; node * head; linked_list() { num_nodes = 0; head = nullptr; } void make_random_list(int k);//create a linked list of //k nodes with values in 0 ..99 randomly void print(); //Print values of all nodes from head node void reverse(); //Reverse the order of nodes of linked list //void remove_all(int k); //Remove all nodes whose node values are k //void insert(int k); //create a new node with value k and insert it to an already sorted list. After the insert, the linked list is still sorted.
Image of page 1
Image of page 2

You've reached the end of your free preview.

Want to read all 4 pages?

  • Left Quote Icon

    Student Picture

  • Left Quote Icon

    Student Picture

  • Left Quote Icon

    Student Picture