link list, C/C++ Programming

Assignment Help:
For this program you will add and test 2 new member functions to the IntSLList class posted on the website.

The two member functions are:

insertByPosn(int el, int pos)
Assuming that the positions of elements of a list begin numbering at 1 and continue to the end of the list, you will insert a new node with info value el at position pos. pos will become the position of the new node in the modified list. For example, if pos = 1, insert the new node at the head of the list. If pos = 2, for example, insert the new node BEFORE the node currently at position 2. If the list is empty prior to insertion, insert the new node in the list and adjust head and tail pointers. If pos is too large, don''t do anything. If pos is 0 or negative, don''t do anything.

deleteByPosn(int pos)
Assume position of elements are defined as above. If pos is zero or negative, do nothing. If the list is empty prior to the request to delete a node, do nothing. If pos is too large, do nothing.

To aid in verifying results, you should use the following modified version of printAll. This requires: include

void IntSLList::printAll(string locn) const {
cout << "Contents of the list " << locn << endl;
for (IntSLLNode *tmp = head; tmp != 0; tmp = tmp->next)
cout << tmp->info << " ";
if (head != 0)
cout << "Head is: " << head->info << " Tail is: " << tail->info << endl << endl;
}

For extra credit, you can also create the following:

reverseList()
Traverse the existing list beginning at the head and create a new (reversed) list with head newhead and tail newtail. Put new nodes in the new list by putting the new nodes at the head of the new list each time. Do not call any other member functions during this process. If the list to be reversed is empty, make sure that you account for this case. After the new (reversed) list is created, delete the old list using its destructor.

Related Discussions:- link list

Program to calls to echo the typed characters, Write a main program that us...

Write a main program that uses these system calls to echo the typed characters. The pseudo code will look something like: void traphandler ()  {    if (R0 == 0) { // read sys

Simple text editor using c programming in linux environment, Deliverables: ...

Deliverables: you are required to upload your c code in the assignment dropbox set in Moodle. You are supposed to work with Linux gcc compiler and pico editor for compiling via the

Fill an array of randomly generated integers, The task consists of two part...

The task consists of two parts which are both preferably implemented in one source file. Towards the end of this document you will find a code skeleton that you must assume. Start

Program to calculate students marks, #include using namespace std; void...

#include using namespace std; void print(int marks_arr[],int cnt) { int ind[cnt]; int i=0; int j=0; int k=0; int s=0; for(k=0;k { ind[k]=0; } int cnt1=0; for(i=0;i

Control structures in cpp, Control structures The control structures app...

Control structures The control structures appear in both structured programming languages as well as object oriented programming languages.  The three constructs used are: i)

Pointer to an array, Write a method (belonging to the TermStructure class) ...

Write a method (belonging to the TermStructure class) that takes a pointer to an array of bonds and an integer, representing the number of bonds in the array as arguments, and esti

Develop a c program for linux, develop a C program for Linux called pipes.c...

develop a C program for Linux called pipes.c that does the following: In the main() function, it creates a pipe using the pipe() function, then creates two child processes with

Data types, #question write a prog c & cpp

#question write a prog c & cpp

Law of motion, Ask question asdasasas#Minimum 100 words accepted#

Ask question asdasasas#Minimum 100 words accepted#

Problem : Luminous Jewels - Polishing Necklace, Byteland county is very fam...

Byteland county is very famous for luminous jewels. Luminous jewels are used in making beautiful necklaces. A necklace consists of various luminous jewels of particular colour. Nec

Write Your Message!

Captcha
Free Assignment Quote

Assured A++ Grade

Get guaranteed satisfaction & time on delivery in every assignment order you paid with us! We ensure premium quality solution document along with free turntin report!

All rights reserved! Copyrights ©2019-2020 ExpertsMind IT Educational Pvt Ltd