SophiaPretty

(5)

$14/per page/Negotiable

About SophiaPretty

Levels Tought:
Elementary,Middle School,High School,College,University,PHD

Expertise:
Accounting,Algebra See all
Accounting,Algebra,Applied Sciences,Architecture and Design,Art & Design,Biology,Business & Finance,Calculus,Chemistry,Communications,Computer Science,Economics,Engineering,English,Environmental science,Essay writing Hide all
Teaching Since: Jul 2017
Last Sign in: 313 Weeks Ago, 5 Days Ago
Questions Answered: 15833
Tutorials Posted: 15827

Education

  • MBA,PHD, Juris Doctor
    Strayer,Devery,Harvard University
    Mar-1995 - Mar-2002

Experience

  • Manager Planning
    WalMart
    Mar-2001 - Feb-2009

Category > Computer Science Posted 11 Dec 2017 My Price 10.00

pointers to implement a dynamic array and a singly

Use pointers to implement a dynamic array and a singly linked list. You will encapsulate both in an ADT. Specifically, your ADT will include the following data members:

  • int *array;   //dynamic array
  • int size_array; //number of elements stored in the dynamic array
  • int capacity; //the current number of integer spaces allocated to the dynamic array
  • struct Node {

          int value;

          Node *next

     };

  • Node *head; //point to the first node on the linked list
  • int size_linkedList; //number of nodes on the linked list
  • Your ADT will also include the following member functions:a default constructor to initialize the array and linked list correspondingly
  • the "big-3": destructor, copy constructor and overloaded assignment operator
  • void push_back(int val ); This member function inserts the value 'val' to the end of the dynamic array and the end of the linked list. Note that this function will require memory allocation (i.e., need to call the new operator). 
  • void pop_back(); This member function deletes the last number from the array, and the last number from the linked list. Note that this function will require memory deallocation, i,e., need to call the delete operator. 
  • an overloaded put operator (<<) to print out all the data items stored on the dynamic array and the linked list. Note that you are recommended to overload this operator as a friend function of your ADT. 

 

i have attached the the following files underneath. Please make changes as necessary

  • //
    //  linked_list.cpp
    //  linked_list
    //
    //  Created by Devesh Patel on 5/1/17.
    //  Copyright © 2017 Devesh Patel. All rights reserved.
    //

    #include <stdio.h>
    #include "linked_list.h"

    using namespace std;

    linkedList::

    linkedList::~linkedList(){
        node *toDel = head;
        while(toDel != NULL){
            head = toDel->next;
            delete toDel;
            toDel = head;
        }
       
    }

    linkedList::linkedList( const linkedList& l1){
        node * cur = l1.head, *tail = NULL , *write = NULL;
        while(cur != NULL){
            write = new node;
            write->value = cur->value;
            write->next = NULL;
           
            if(tail == NULL){
                head = write;
                tail = write;
            }else{
                tail->next = write;
                tail = write;
               
            }
            cur = cur->next;
           
        }
        size_array = l1.size_array;
    }
       
    //
    //  linked_list.h
    //  linked_list
    //
    //  Created by Devesh Patel on 5/1/17.
    //  Copyright © 2017 Devesh Patel. All rights reserved.
    //

    #ifndef linked_list_h
    #define linked_list_h
    #include <iostream>

    class linkedList{
    private:
        int *array;
        int size_array;
        int capacity;
       
        struct node{
            int value;
            node *next;
        };
       
        node *head;
        int *size_head;
       
    public:
        //default constrctors
        int myArray();
        linkedList( int *array, int size_array, int capacity);
       
        //Big Three
        ~linkedList(); // destructor
        linkedList( const linkedList& ); // clone constructor
        linkedList operator=( const linkedList& rhs); // operator
       
        void push_back(int val);
        void pop_back();
       
    };

    #endif /* linked_list_h *///
    //  main.cpp
    //  linked_list
    //
    //  Created by Devesh Patel on 5/1/17.
    //  Copyright © 2017 Devesh Patel. All rights reserved.
    //

    #include <iostream>

    int main(int argc, const char * argv[]) {
        // insert code here...
        std::cout << "Hello, World!\n";
        return 0;
    }


Answers

(5)
Status NEW Posted 11 Dec 2017 10:12 AM My Price 10.00

-----------  ----------- H-----------ell-----------o S-----------ir/-----------Mad-----------am ----------- Th-----------ank----------- yo-----------u f-----------or -----------you-----------r i-----------nte-----------res-----------t a-----------nd -----------buy-----------ing----------- my----------- po-----------ste-----------d s-----------olu-----------tio-----------n. -----------Ple-----------ase----------- pi-----------ng -----------me -----------on -----------cha-----------t I----------- am----------- on-----------lin-----------e o-----------r i-----------nbo-----------x m-----------e a----------- me-----------ssa-----------ge -----------I w-----------ill----------- be----------- qu-----------ick-----------ly

Not Rated(0)